[Lazarus] Using extensions for text file names in files of Lazarus 0.9.25 with/and fpc 2.2.2rc .
Mehmet Erol Sanliturk
sanliturk at ttnet.net.tr
Tue Jul 22 12:45:11 CEST 2008
Luiz Americo Pereira Camara rašė:
> I tried that sometime ago without success:
> http://thread.gmane.org/gmane.comp.ide.lazarus.general/22010
I studied Your code and found where problem is: DataDescription need
initialize through variable. Working code (seems that TRGBA comes from
GraphicEx.pas, but webpage with that source cose is timeouted so i use
TRGBAQuad instead):
uses IntfGraphics, LclType, GraphType;
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
procedure DumpMem(Data: PCardinal; Size: Integer);
var
i: Integer;
Color: TRGBAQuad;
begin
for i := 0 to Size - 1 do
begin
Color := TRGBAQuad(Data[i]);
WriteLn('Red: ', Color.Red, ' Green: ', Color.Green,
' Blue: ',Color.Blue, ' Alpha: ', Color.Alpha);
end;
end;
var
ImgReader: TLazReaderBMP;
IntfImg: TLazIntfImage;
aprasas: TRawImageDescription;
begin
ImgReader := TLazReaderBMP.Create;
IntfImg := TLazIntfImage.Create(0,0);
//IntfImg.DataDescription.Init_BPP32_B8G8R8A8_M1_BIO_TTB(0, 0);
aprasas.Init_BPP32_B8G8R8A8_BIO_TTB(0, 0); // there is
IntfImg.DataDescription:=aprasas; // solution
IntfImg.LoadFromFile('red.bmp', ImgReader);
DumpMem(PCardinal(IntfImg.PixelData), IntfImg.DataDescription.Height
* IntfImg.DataDescription.Width);
ImgReader.Destroy;
IntfImg.Destroy;
end;
--
Valdas Jankūnas
More information about the Lazarus
mailing list