Quoting Luiz Americo Pereira Camara <[EMAIL PROTECTED]>:

I need to load the data of bitmap files into a buffer in the RGBA
format, but i'm somewhat lost.

I made a program to process BMP files. The images were fixed 640x480. This is an example of how I loaded the images.

const
  MaxImgH = 480;
  MaxImgW = 640;

type
  TRGB32=record
    blue,green,red,dummy: byte;
  end;
  pTRGB32=^TRGB32;

  TProcImg = array[0..MaxImgH-1,0..MaxImgW-1] of TRGB32;
  pTProcImg = ^TProcImg;

procedure LoadandProcessPicture;
var
  PaintBitmap: TBitmap;
  OrigImgLaz: TLazIntfImage;
  OrigImg: pTProcImg;
begin
  PaintBitmap.LoadFromFile('fileName.bmp');

  OrigImgLaz := TLazIntfImage.Create(0,0);
  OrigImgLaz.LoadFromBitmap(PaintBitmap.Handle,PaintBitmap.MaskHandle);

  OrigImg:=pTProcImg(OrigImgLaz.PixelData);

// Now I can access TLazIntfImage like OrigImg^[y,x].red, OrigImg^[y,x].green, ...

  OrigImgLaz.Free;
  PaintBitmap.Free;
end;

Hope this helps.

Paulo


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

Reply via email to