Wenn ich die Pixel in der TLazIntfImage färbe (mittels GetDataLineStart() ),
dann bekomme ich immer die umgekehrte Reihenfolge der Farbwerte.
Ich muß erst die Reihenfolge umkehren, dann erhalte ich den gewünschten Farbton.
Änderung der Eigenschaft ByteOrder in der RawImage bringt da keine Änderung.
Oder gibt es da noch eine Eigenschaft, die man dazu aktivieren muß?
Herzlichen Dank!
P. Nikolaus
Hier mein kleines Programm dazu (Image1 ist fast so groß wie die Form selber):
Code: Alles auswählen
unit Unit3;
{$mode objfpc}{$H+}
interface
uses
Classes, LResources, Forms, Controls, Graphics, ExtCtrls, LCLIntf, IntfGraphics, GraphType;
type
TForm3 = class(TForm)
Image1: TImage;
procedure FormChangeBounds(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
end;
var Form3: TForm3; intf: TLazIntfImage;
implementation
function UmkehrFarbe(col:TColor):TColor; // RGB --> BGR
begin result:= col and $FF00 + col shr 16 + (col and $ff) shl 16; end;
procedure FarbRect(r:TRect; col:TColor); // färbt das Rechteck mit col
var i,j:integer; c:TColor;
begin
with intf,r do
begin c:=UmkehrFarbe(col);
for j:=top to bottom-1 do for i:=left to right-1 do
PColor(GetDataLineStart(j)+3*i)^:= c;
end;
end;
procedure TForm3.FormChangeBounds(Sender: TObject);
var raw:TRawImageDescription;
col:TColor; r:TRect; w,h:integer;
begin
intf:=TlazIntfImage.create(0,0);
with image1 do begin w:=width; h:=height; r:= Bounds(0,0,w,h); end;
raw.Init_BPP24_B8G8R8_BIO_TTB(w,h); // 24 bpp
// with raw do
// ByteOrder:= TrawImageByteOrder(1-byte(ByteOrder)); // ändert nichts!
intf.DataDescription:=raw;
col:=clblue;
FarbRect(r, col); // benutzt UmkehrFarbe(col) !
Farbrect(Rect(10,10,100,100), clskyblue);
image1.Picture.Bitmap.LoadFromIntfImage(intf);
intf.Free;
end;
procedure TForm3.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if key = 27 then halt; // Escape-Taste
end;
initialization
{$I unit3.lrs}
end.
Code: Alles auswählen
program project3;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Unit3, LResources
{ you can add units after this };
{$IFDEF WINDOWS}{$R project3.rc}{$ENDIF}
begin
{$I project3.lrs}
Application.Initialize;
Application.CreateForm(TForm3, Form3);
Application.Run;
end.