Trouble in mirroring a bitmap lazarus / 39-Graphics ---------------------------------------------------------------------- CSGM · 2010-12-28 18:15 Hi everyone, I'm a new user of Lazarus and FPC, and I'm have some trouble when I try to mirror a bitmap along the y axe. I'm working in window7, professional edition. I have the same code in Delphi and it works fine. But the similar code (below) in Lazarus doesnt work. I thank a lot for any help or tip. I have implemented the following code in Lazarus: also follow the original bitmap and output using the sent code. Thanks csgm {-----------------------------------------------------------------} type     TRGBArray = array[0..3] of TRGBTriple;     pRGBArray = ^TRGBArray; procedure MirrorVertical(Bitmap: TBitmap); var i, j, w: Integer;     In: pRGBArray;     Out: pRGBArray; begin      w := bitmap.width * sizeof(TRGBTriple);      GetMem(In, w);      auxLBMP:=bitmap.CreateIntfImage;      for j := 0 to Bitmap.Height - 1      do begin              move(auxLBMP.GetDataLineStart(j)^, In^, w);              Out := auxLBMP.GetDataLineStart(j);              for i := 0 to Bitmap.Width - 1              do Out := In[Bitmap.Width - 1 - i];         end;      bitmap.LoadFromIntfImage(auxLBMP);      auxLBMP.Free;      FreeMem(In); end; {-----------------------------------------------------------------} ---------------------------------------------------------------------- Marc · 2010-12-29 12:41 Not the most efficient code. A few things: - What the use of an array [0..3] of RGB triple ? - You assume the line data is stored as 24bit RGB and not as RGBA - you don't increase the Out pointer, so you overwrite the first pixel of every line - For now try avoiding LoadFromIntfImage, since it loads through the BitmapHandle and MaskHandle, which converts the image to a devicedepth (and possibly destroying alpha) Try following Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i type  PRGBTriple = ^TRGBTriple; procedure MirrorVertical(Bitmap: TBitmap);var   i, j, half: Integer;  Pixel: TRGBTriple;  In: PRGBTriple;  Out: PRGBTriple;begin   auxLBMP := bitmap.CreateIntfImage;   half := Bitmap.Width div 2 - 1;   for j := 0 to Bitmap.Height - 1 do    begin      In := auxLBMP.GetDataLineStart(j);      Out := In;      Inc(In, Bitmap.Width - 1);      for i := 0 to half do       begin         Pixel := Out^;       Out^ := In^;         In^ := Pixel;         Inc(Out);         Dec(In);      end;   end;   bitmap.LoadFromIntfImage(auxLBMP);   auxLBMP.Free;end; ---------------------------------------------------------------------- CSGM · 2010-12-29 14:46 Hi Marc, thank you very much for answer my doubt. The code has worked very fine. I'm going to check the rest of my code. Can you indicate some material to study about graphic manipulation? Once, Thank you very much.