1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| function its(i:integer):string; begin result:=IntToStr(i); end;
procedure DumpMem(Data: pCardinal; Size: integer);
var
i: Integer;
px: tRGBAQuad;
begin
for i := 0 to Size - 1 do begin
px := tRGBAQuad(Data[i]);
with px do
Form1.memo1.Lines.Add(Format('%s %.3u, %s %.3u, %s %.3u, %s %.3u',
['Red', Red, 'Green', Green, 'Blue', Blue, 'Alpha', Alpha]));
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
ImgReader: TLazReaderBMP;
IntfImg: TLazIntfImage; // IntfGraphics
rid: TRawImageDescription; // GraphType
begin
ImgReader := TLazReaderBMP.Create;
IntfImg := TLazIntfImage.Create(0,0);
rid.Init_BPP32_B8G8R8A8_BIO_TTB(0, 0); // there is
IntfImg.DataDescription := rid; // solution
IntfImg.LoadFromFile(Application.Location + 'MS_3x2_2818.bmp', ImgReader);
// IntfImg.LoadFromFile(Application.Location + 'MS_3x2_3820.bmp', ImgReader);
memo1.Lines.Add('MS_3x2_2818.bmp :');
memo1.Lines.Add('IntfImg.PixelData = '+its(SizeOf(IntfImg.PixelData))+ ', DDH : ' + its(rid.Height) + ', DDW : ' + its(rid.Width));
memo1.Lines.Add('BitsPerPixel : ' + its(rid.BitsPerPixel) + ', Depth : ' + its(rid.Depth));
//// DumpMem(pCardinal(IntfImg.PixelData), IntfImg.DataDescription.Height * IntfImg.DataDescription.Width);
memo1.Lines.Add('');
// curieux : BitsPerPixel : 32, Depth : 32, examen hexa --> 28 @ 0E, 18 @ 1C !...
// j'aurais dû avoir l'une (au moins) des deux variables = 24 (18hex=24dec, 20=32)
ImgReader.Destroy;
IntfImg.Destroy;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
ImgReader: TLazReaderBMP;
IntfImg: TLazIntfImage; // IntfGraphics
rid: TRawImageDescription; // GraphType
begin
ImgReader := TLazReaderBMP.Create;
IntfImg := TLazIntfImage.Create(0,0);
rid.Init_BPP32_B8G8R8A8_BIO_TTB(0, 0); // there is
IntfImg.DataDescription := rid; // solution
// IntfImg.LoadFromFile(Application.Location + 'MS_3x2_2818.bmp', ImgReader);
IntfImg.LoadFromFile(Application.Location + 'MS_3x2_3820.bmp', ImgReader);
memo1.Lines.Add('MS_3x2_3820.bmp :');
memo1.Lines.Add('IntfImg.PixelData = '+its(SizeOf(IntfImg.PixelData))+ ', DDH : ' + its(rid.Height) + ', DDW : ' + its(rid.Width));
memo1.Lines.Add('BitsPerPixel : ' + its(rid.BitsPerPixel) + ', Depth : ' + its(rid.Depth));
//// DumpMem(pCardinal(IntfImg.PixelData), IntfImg.DataDescription.Height * IntfImg.DataDescription.Width);
memo1.Lines.Add('');
ImgReader.Destroy;
IntfImg.Destroy;
end; |
Partager