Recent

Author Topic: BGRABitmap - layers  (Read 27098 times)

circular

  • Hero Member
  • *****
  • Posts: 3508
    • Personal webpage
Re: BGRABitmap - layers
« Reply #15 on: April 28, 2012, 09:38:40 am »
Using BGRALayers you can do

TBGRALayeredBitmap.InsertLayer(DestinationIndex, SourceIndex: integer)
Conscience is the debugger of the mind

Gintas

  • Jr. Member
  • **
  • Posts: 71
    • Developer's Diary
Re: BGRABitmap - layers
« Reply #16 on: May 05, 2012, 08:43:21 pm »
Circular you really kick some butt.
Now  I am trying to move layers with a mouse. I got good example with moving
TShape,but when I try code with a LayerOffset it moves way to fast.

circular

  • Hero Member
  • *****
  • Posts: 3508
    • Personal webpage
Re: BGRABitmap - layers
« Reply #17 on: May 06, 2012, 11:53:58 am »
I suppose you should update your fixedx at each mousemove, because coordinates are relative to the shape in your example whereas they are relative to whole image with a layer.
Conscience is the debugger of the mind

fenix

  • New Member
  • *
  • Posts: 10
Re: BGRABitmap - layers
« Reply #18 on: May 30, 2012, 10:15:04 am »
circular,

In the function
function TBGRACustomLayeredBitmap.ComputeFlatImage: TBGRABitmap;
I offer to ammend code
Code: [Select]
  if LayerVisible[i] then
to
Code: [Select]
  if LayerVisible[i] and (LayerOpacity[i]<>0) then

Thanx,
Fenix
« Last Edit: May 30, 2012, 10:17:23 am by fenix »

circular

  • Hero Member
  • *****
  • Posts: 3508
    • Personal webpage
Re: BGRABitmap - layers
« Reply #19 on: May 31, 2012, 01:27:55 am »
Ok. Done.  Thanks.  :)
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 3508
    • Personal webpage
Re: BGRABitmap - layers
« Reply #20 on: September 14, 2012, 09:11:05 pm »
I've added some features in BGRALayers (on subversion). There are new functions :
- MoveLayerUp / MoveLayerDown to move up or down a layer in the stack
- Draw and ComputeFlatImage can take (firstLayer,lastLayer) as additionnal parameters, so you can draw a range of layers.
- Freeze/Unfreeze functions : you can freeze a range of layers that you will not change, so that they will not be computed again when you call Draw
- FreezeExceptOneLayer : a helper function that freezes everything and unfreeze one layer, useful for example if you move a layer, change only one layer, and when the movement is finished, you need to call Unfreeze to get all the layers updating again.

This freeze/unfreeze capability is only provided for optimization purposes. For example, if you try to freeze just one layer, it will not do anything, because there is no point in making a frozen copy of only one layer.
« Last Edit: September 14, 2012, 09:13:03 pm by circular »
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 3508
    • Personal webpage
Re: BGRABitmap - layers
« Reply #21 on: September 15, 2012, 01:06:07 pm »
Hello people, i've just optimized advanced blending operations and layers with advanced blending operations.

TBGRALayeredBitmap has a new property LinearBlend (False by default) to specify if you want to use linear blending instead of gamma corrected blending (i.e. dmDrawWithTransparency).

TBGRABitmap has a new function :
BlendImageOver(x, y: integer;  Source: TBGRACustomBitmap; operation: TBlendOperation; AOpacity: byte; ALinearBlend: boolean);

Which does in one step the blending operation and the "merge over" operation. So you can render a layer with one call to that function.
Conscience is the debugger of the mind

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: BGRABitmap - layers
« Reply #22 on: September 15, 2012, 02:09:32 pm »
Thanks :)

circular

  • Hero Member
  • *****
  • Posts: 3508
    • Personal webpage
Re: BGRABitmap - layers
« Reply #23 on: September 15, 2012, 02:46:45 pm »
You're welcome.  :)
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 3508
    • Personal webpage
Re: BGRABitmap - layers
« Reply #24 on: September 16, 2012, 02:00:17 pm »
Hello people,

I've added :
- OpenRaster support (layered bitmap file format with .ora extension).
- new blending operations : boDivide, boSoftLight, boHardLight, boExclusion, boLinearExclusion, boSubtract, boLinearSubtract, boSubtractInverse, boLinearSubtractInverse (increase interoperability with Krita image editor)

You can now load and save TBGRALayeredBitmap :
- load from Paint .NET (*.pdn) and from OpenRaster (*.ora)
- save to OpenRaster (*.ora)

Interoperability with Gimp is poor because Gimp handles poorly blendind modes in OpenRaster format.
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 3508
    • Personal webpage
Re: BGRABitmap - layers
« Reply #25 on: September 16, 2012, 02:02:47 pm »
Here is a test project for playing with layered bitmap files (you need to use lastest svn) :
Conscience is the debugger of the mind

lainz

  • Guest
Re: BGRABitmap - layers
« Reply #26 on: September 16, 2012, 05:45:37 pm »
This remembers me Corel Photo Paint it's really nice.

You will add free transform tool? (scaling, rotating, perspective, etc..).

When you finish this stuff you can try 9 slice scaling:

I've tryed to do something with this for BGRAImageButton and Windows 7 Drawer with BGRABitmapThemeUtils.pas unit in BGRAControls, it works, but it has limited functionality.

circular

  • Hero Member
  • *****
  • Posts: 3508
    • Personal webpage
Re: BGRABitmap - layers
« Reply #27 on: September 16, 2012, 06:00:15 pm »
Well, i'm planning to merge it with LazPaint.

I don't see the link with 9 slice scaling. But it can be a tool added to LazPaint.
Conscience is the debugger of the mind

lainz

  • Guest
Re: BGRABitmap - layers
« Reply #28 on: September 16, 2012, 06:57:43 pm »
Check BGRAImageButton or BGRABitmapThemeUtils.pas in BGRAControls.

Well I've done just functions to scale with that, but there is no tool.

In google you can see how it works:
http://www.google.com/search?q=9+slice+scaling&rlz=1C1LENN_enAR480&sugexp=chrome,mod%3D15&um=1&ie=UTF-8&hl=es&tbm=isch&source=og&sa=N&tab=wi&ei=aARWUNPXK4SA9gT654GwDg&biw=1092&bih=479&sei=bgRWUMCHGpSi8gT9qYCIDw

Edit: Also the functions in BGRABitmapThemeUtils are limited, you only can set 'BorderWidth' and 'BorderHeight', so you can't manipulate each of the 4 imaginary lines.

Edit 2: This is a really nice article:
http://www.centigrade.de/en/blog/article/modern-user-interface-design-tools-part-2-graphical-approach-of-gui-design-tools/

and this other
http://www.w3.org/TR/2005/WD-css3-background-20050216/#the-border-image
« Last Edit: September 16, 2012, 07:19:54 pm by lainz »

circular

  • Hero Member
  • *****
  • Posts: 3508
    • Personal webpage
Re: BGRABitmap - layers
« Reply #29 on: September 16, 2012, 07:17:25 pm »
Oh thanks. Well, yes it can be added as a tool. But I was saying that I don't see how it is related to layers.
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018