On Thu, 9 Nov 2006 14:39:17 +0300 Sergei Gorelkin <[EMAIL PROTECTED]> wrote:
> Hello, > > I have a procedure like this: > > procedure PaintIntoMemory(aWidth, aHeight, rowstride: Integer; > aMemory: Pointer); > > It 'paints' some stuff into memory block described by its arguments, > treating memory as RGB bitmap. Then, I want to draw the result on > TCanvas. In Delphi, it is quite simple: > > Bitmap := TBitmap.Create; > Bitmap.PixelFormat := pf24Bit; > Bitmap.Width := ...; > Bitmap.Height := ...; > PaintIntoMemory(Bitmap.Width, Bitmap.Height, > BytesPerScanline(Bitmap.Width, 24, 32), Bitmap.Scanline[0]); > ... > aCanvas.Draw(0,0,Bitmap); > > But how to do the same in Lazarus? I guess that I must create a > TLazIntfImage, specify its pixel format, then use its PixelData > property... Or it is better allocate a TRawImage, paint into it and > then call TLazIntfImage.SetRawImage method? > Please point me to a right direction :) Thank you in advance. I guess, your procedure PaintIntoMemory writes the pf24bit format: 3 bytes per pixel: 1byte blue, 1byte green, 1byte red Every line DWord aligned. I added an example (lazarus/examples/scanline/bitmapscanline1.lpi) giving some hints, how to create a TLazIntfImage with the pf32bit format and how to use an approach similar to Delphi's TBitmap.ScanLine. Mattias _________________________________________________________________ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives