Problem with TLazIntfImage : works with windows but not with linux lazarus / 39-Graphics ---------------------------------------------------------------------- Axxel · 2011-03-21 22:09 Hi  Sorry for advance for my english because I'm french. I Try this code source usin the TLazIntfImage to work with scanlines like delphi. This code allow to force the red channel at the maximum. (I took it form this example : http://wiki.lazarus.freepascal.org/Developing_with_Graphics ) Code: [Select]procedure TForm1.FadeIn2(aBitMap: TBitMap);  var    IntfImg1, IntfImg2: TLazIntfImage;    ImgHandle,ImgMaskHandle: HBitmap;    FadeStep: Integer;    px, py: Integer;    CurColor: TFPColor;    TempBitmap: TBitmap;    Row1, Row2: PRGBTripleArray;  begin    IntfImg1:=TLazIntfImage.Create(0,0);    IntfImg1.LoadFromBitmap(aBitmap.Handle,aBitmap.MaskHandle);    IntfImg2:=TLazIntfImage.Create(0,0);    IntfImg2.LoadFromBitmap(aBitmap.Handle,aBitmap.MaskHandle);    TempBitmap:=TBitmap.Create;    //with Scanline-like    for FadeStep:=1 to 32 do begin      for py:=0 to IntfImg1.Height-1 do begin        Row1 := IntfImg1.GetDataLineStart(py); //like Delphi TBitMap.ScanLine        Row2 := IntfImg2.GetDataLineStart(py); //like Delphi TBitMap.ScanLine        for px:=0 to IntfImg1.Width-1 do begin          Row2^[px].rgbtRed:= 255;          Row2^[px].rgbtGreen := (FadeStep * Row1^[px].rgbtGreen) shr 5; // Fading          Row2^[px].rgbtBlue := (FadeStep * Row1^[px].rgbtBlue) shr 5;        end;      end;      IntfImg2.CreateBitmaps(ImgHandle,ImgMaskHandle,false);      TempBitmap.Handle:=ImgHandle;      TempBitmap.MaskHandle:=ImgMaskHandle;      Canvas.Draw(0,0,TempBitmap);    end;    IntfImg1.Free;    IntfImg2.Free;    TempBitmap.Free;  end; I compile it under widows and this is a success ! http://img823.imageshack.us/img823/7431/winrl.jpg An now I compile it under Ubuntu 10.10 and i have this result : http://img689.imageshack.us/img689/6290/linuxf.jpg I've tried a lot of things but unsuccessful  Everyone have an idea how can we works with the scanlines under linux without this bug ? I thought there is a bug into the linux LCL no  Thank you for advance! ---------------------------------------------------------------------- theo · 2011-03-21 22:42 Quote from: Axxel on March 21, 2011, 11:09:04 pm(I took it form this example : http://wiki.lazarus.freepascal.org/Developing_with_Graphics ) I read there: QuoteIf you know that the TBitmap is using blue 8bit, green 8bit, red 8bit you can directly access the bytes, which is somewhat faster: I guess you don't know this. Maybe it's not 24bpp but 32bpp or something else. You could try with an array of TRGBQuad. It's probably easier to do it like the first example in "Fading example", then you don't have to worry about pixelformats. ---------------------------------------------------------------------- circular · 2011-03-22 00:38 Or you can use BGRABitmap, I made it for this ---------------------------------------------------------------------- Marc · 2011-03-22 10:07 You falsely assume that all rawimages have the same data format. Where on windows a pixel might be stored as a 3-byte RGB, it might be stored completely different on linux. It can be stored in 4 bytes, but also in 2 bytes (5-5-5) if your screen depth is only 16 bits. Look at the IntfImage RawImageDescription  how the pixels are really stored. When accessing raw image data, never assume the pixel layout. ---------------------------------------------------------------------- Axxel · 2011-03-26 15:57 Hi. Thanks ! It works wery well now with the TRGBQuad