On Wed, 29 Mar 2006 15:04:13 +0200
Tomas Gregorovic <[EMAIL PROTECTED]> wrote:

> Mattias Gaertner napsal(a):
> 
> >On Mon, 27 Mar 2006 15:29:44 +0200
> >Tomas Gregorovic <[EMAIL PROTECTED]> wrote:
> >
> >  
> >
> >>Mattias Gaertner napsal(a):
> >>
> >>    
> >>
> >>>On Mon, 13 Mar 2006 11:09:19 +0100
> >>>Tomas Gregorovic <[EMAIL PROTECTED]> wrote:
> >>>
> >>> 
> >>>
> >>>      
> >>>
> >>>>Mattias Gaertner napsal(a):
> >>>>
> >>>>   
> >>>>
> >>>>        
> >>>>
> >>>>>On Fri, 10 Mar 2006 14:15:44 +0100
> >>>>>Tomas Gregorovic <[EMAIL PROTECTED]> wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>     
> >>>>>
> >>>>>          
> >>>>>
> >>>>>>Hi,
> >>>>>>finally I have finished my long battle around bitmap masks.
> >>>>>>
> >>>>>>I have implemented method CreateBitmapMask, which creates mask
> >>>>>>            
> >>>>>>
> >>>according >>>        
> >>>      
> >>>
> >>>>>>to transparent color. The white pixels stand for opacity and black
> >for >>>>>            
> >>>>>>
> >>>>>>transperency (I have found out that this is in contrary to Delphi).
> >I  >>>>>hope this routine will function under all supported OSes - I have
> >>>>>>            
> >>>>>>
> >>>tested >>>        
> >>>      
> >>>
> >>>>>>it on win only.
> >>>>>>
> >>>>>>Next, I had to change btimap and image transparent* properties to
> >>>>>>            
> >>>>>>
> >>>behave >>>        
> >>>      
> >>>
> >>>>>>like Delphi equivalents.
> >>>>>>
> >>>>>>The difficult problem was how to keep transparency built  in source
> >of >>>>>            
> >>>>>>
> >>>>>>bitmaps such as *.xpm. This I have solved by creating new seperate
> >>>>>>            
> >>>>>>
> >>>mask  >>>accessible throught AlphaMaskHandle, which stores alpha
> >channel >>data  >>>that were previously stored in MaskHandle object.
> >>>      
> >>>
> >>>>>>I have attached small test project, which nicely illustrates right
> >>>>>>            
> >>>>>>
> >>>mask  >>>functioning.
> >>>      
> >>>
> >>>>>>  
> >>>>>>
> >>>>>>       
> >>>>>>
> >>>>>>            
> >>>>>>
> >>>>>You added an AlphaMaskHandle, but I don't see when we need both
> >>>>>MaskHandle and AlphaMaskHandle.
> >>>>>Why not use the MaskHandle for the Mask?
> >>>>>
> >>>>>And btw: Not all widgetsets use separate Handle and MaskHandle.
> >>>>>
> >>>>>
> >>>>>Mattias
> >>>>>
> >>>>>
> >>>>>     
> >>>>>
> >>>>>          
> >>>>>
> >>>>Sorry, my fault. Now when I have better looked into code I see it.
> >>>>Therefore I have moved into using only MaskHandle and added flag 
> >>>>FAlphaMasked, which says whether the MaskHandle is source bitmap alpha
> >
> >>>>mask and then the transparent color is not used.
> >>>>   
> >>>>
> >>>>        
> >>>>
> >>>I took a closer look at the patch:
> >>>You rewrote TBitmap.InitFPImageReader to not use for the
> >transparentcolor >>the left, bottom pixel of the coming stream. Why?
> >>> 
> >>>
> >>>      
> >>>
> >>Because under Windows with bmp picture all pixels with the same color as
> >
> >>the left bottom pixel are black (maybe clNone) and I haven't found any 
> >>way how to get theirs original color.
> >>
> >>    
> >>
> >>>Canvas.Pixels[0,Height-1] does not work under gtk, so
> >>>TBitmap.GetTransparentColor does not work this way.
> >>> 
> >>>
> >>>      
> >>>
> >>That's really pitty. Is it not implemented yet or is it impossible?
> >>    
> >>
> >
> >Not implemented. I don't how to implement it.
> >
> > 
> >  
> >
> >>>And where do you actually create the alpha mask?
> >>> 
> >>>
> >>>      
> >>>
> >>I create the aplha mask in function CreateBitmapMask. I draw source 
> >>bitmap to monochromatic mask bitmap using a trick which changes the 
> >>transparent color to white in the mask bitmap. I am not sure if it is 
> >>multiplatform.
> >>    
> >>
> >
> >And where is the 8 or 16 bit alpha mask created?
> >  
> >
> I don't know what you are actually asking about. The CreateBitmapMask 
> function creates only 1 bit mask, because it is enough to make one color 
> transparent.
> 
> Is there some need to create any bit-depth masks?

I got the bad feeling there is a misunderstanding.
At the moment the LCL only provides 1 bit transparency. For the LCL it does
not matter if the alpha channel is separated in a MaskHandle or contained in
the Handle. The gtk interface uses a combo Handle, while the win32 interface
uses a separate MaskHandle.
Of course we want alpha transparency, i.e. >1 bit, which is typically 8 or
16 bit alpha channel. 
AFAIK the gtk1 does not support 8 bit masks (at least not without tricks),
but the gtk2 supports them.
The only missing part is to add 8 bit transparency support to the gtk2
interface and some properties to TBitmap, so the user can select the alpha
depth.
I thought, your patch is starting the latter. But maybe you meant something
different?


Mattias

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to