<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Verdana; font-size: 12pt; color: #000000'>Thanks Peter for your example. <br>I'm understand your code but my first goal was to display an image (from an imagelist) without the transparency effect (that's why I set Transparent to false). <br><br>I didn't understand why if I set the transparent property to false the effect seem to be active.<br><br>Bug or (probably) something is missing in my code.<br>A solution was found with the a 'fillrect' with a white brush. But is it normal? <br><br>Regards.<br><br><br>--<br>Pierre Delore<br><br>http://datalinkwristapps.free.fr<br>http://dpsite.free.fr<br>
<br><br>Le 22/02/2010 11:37, Peter Williams a écrit :<br>> Hi Pierre and Lazarus List<br>> <br>> see my comments below...<br>> <br>> Fond Regards,<br>> Peter Eric (aka 'pew') WILLIAMS<br>> from Hobart, Tasmania, Australia -- phone (03) 6236-9675<br>> <br>> My free website is: http://pewtas.googlepages.com (or)<br>> http://tinyurl.com/yuyejs<br>> <br>> (please visit my free website and let me know what you think about it.)<br>> <br>> 2010/2/22 Pierre Delore<dpliste@free.fr>:<br>>> hi all,<br>>><br>>> Thanks for your answers.<br>>><br>>> I forgot to specify that I'm in Win32 with 0.9.28.2 (not a snapshot).<br>>><br>>> Peter, I uncommented the 2 lines and I replaced clGreen by clWhite. The<br>>> image is displayed correctly.<br>>> I changed the background of the image and I set it to blue (FF0000). The<br>>> image is displayed correctly.<br>>> I also replace the clWhite by clBlue. The image is displayed correctly.<br>>><br>> <br>>> From Delphi graphical game I created, which I converted to Lazarus ...<br>> some time ago,<br>> <br>> ( code from the attached file "uFixedWidthFonts.pas" )<br>> <br>> const<br>> Rects_low = 0;<br>> Rects_high = 255;<br>> <br>> type<br>> // these lines "borrowed" from SDL.pas<br>> SInt16 = smallint;<br>> UInt16 = word;<br>> <br>> // [ALVAROGP] TSDL_Rect converted to class, to avoid warnings<br>> TSDL_Rect = class<br>> public<br>> x, y: SInt16;<br>> w, h: UInt16;<br>> end;<br>> <br>> // end lines from SDL<br>> <br>> PFixedFont = ^TFixedFont;<br>> TFixedFont = object<br>> private<br>> Image: TBitmap;<br>> // [ALVAROGP] Rects redefined as array of class TSDL_Rect<br>> Rects: array[Rects_low..Rects_high] of TSDL_Rect;<br>> //...<br>> TransparentColor : Tcolor;<br>> //...<br>> <br>> //code...<br>> // Determine the transparent color<br>> TransparentColor := Image.Canvas.Pixels[Rects[Rects_low].x +<br>> Rects[Rects_low].w, 0];<br>> <br>> Note: the above line can be simplified as:<br>> <br>> // this will return a TColor of the colour of the pixel @ location [0,0] of<br>> // TBitmap e.g. the top left corner pixel of the image.<br>> // You could choose ANY x,y pixel of the image to be the background colour.<br>> <br>> TransparentColor := Image.Canvas.Pixels[0, 0];<br>> <br>> // set colour of the Canvas Brush to TransparentColor<br>> Canvas.Brush.Color := TransparentColor;<br>> <br>> // now fill the background of the Canvas with the TransparentColor<br>> Canvas.FillRect(0,0,pwidth,pheight);<br>> <br>> // my modifications to your code *should* make the background of the<br>> // Canvas to the same colour as the TBitmap's colour at pixel [0,0]<br>> // before you draw Bitmap -- with the next line of code.<br>> <br>>> Canvas.Draw(0, 0, Bitmap);<br>> // or with my var declarations it would be:<br>> Canvas.Draw(0, 0, Image);<br>> <br>> // hopefully now Bitmap will be drawn on a clWhite background... which<br>> is the effect you said in your email you're wanting.<br>> <br>>> finally<br>>> Bitmap.Free;<br>> // or with my var declarations it would be:<br>> Image.Free<br>>> end;<br>>><br>>> inherited Paint;<br>>> end;<br>> <br>> <br>>> Somebody can explain me why I had this problem?<br>>><br>> <snip><br>>><br>>> Regards<br>>><br>>> --<br>>> Pierre Delore<br>>><br>>> http://datalinkwristapps.free.fr<br>>> http://dpsite.free.fr<br>>><br>> <snip><br>> <br>> <br>> <br>> --<br>> _______________________________________________<br>> Lazarus mailing list<br>> Lazarus@lists.lazarus.freepascal.org<br>> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus<br><br>-- <br>Pierre Delore<br>http://datalinkwristapps.free.fr<br><br></div></body></html>