Folgenden Code verwende ich um alles, was auf Image1 nicht weiß ist schwarz zu Färben.
Da die Maske für SetShape() aber Schwarz als Transparents und Weiß als sichtbar interpretiert, müsste ich alles was Weiß ist Schwarz färben und alles andere Weiß.
Kompliziert, ich weiß

Wenn ich jetzt Test halber im Folgenden Code statt:
Code: Alles auswählen
pRGBTRiple(Line)[px].rgbtBlue := 0;
pRGBTRiple(Line)[px].rgbtRed := 0;
pRGBTRiple(Line)[px].rgbtGreen := 0;
Code: Alles auswählen
pRGBTRiple(Line)[px].rgbtBlue := 50;
pRGBTRiple(Line)[px].rgbtRed := 50;
pRGBTRiple(Line)[px].rgbtGreen := 50;
Jetzt meine Frage: Warum?
Die genaue stelle, an der SIGSEV auftritt füge ich später noch hinzu.
So, hier ist die Position: AV tritt in der Unit GraphType in der Zeile 1624 auf
Code: Alles auswählen
procedure TForm1.Button2Click(Sender: TObject);
var
ConvBitmap: TCanvasOPBitmap;
px, py: integer;
Line: PAPixel32;
begin
ConvBitmap := TCanvasOPBitmap.Create();
AssignBitmapToOpBitmap(image1.Picture.Bitmap, ConvBitmap);
ConvBitmap.PixelFormat := opbitmap.pf24bit;
for py := 0 to Height do
begin
Line := ConvBitmap.ScanLine[py];
for px := 0 to Width do
begin
if ((pRGBTRiple(Line)[px].rgbtBlue <> 255) or (pRGBTRiple(Line)[px].rgbtRed <> 255) or (pRGBTRiple(Line)[px].rgbtGreen <> 255)) then
begin
pRGBTRiple(Line)[px].rgbtBlue := 0;
pRGBTRiple(Line)[px].rgbtRed := 0;
pRGBTRiple(Line)[px].rgbtGreen := 0;
end;
end;
end;
AssignOpBitmapToBitmap(ConvBitmap, Image2.Picture.Bitmap);
Image2.Repaint;
ConvBitmap.Free;
end;