Also das mit Assembler lass ich lieber, damit kenn ich mich nämlich überhaupt ger nicht aus.
Komischerweise funktioniert folgende Funktion ohne Probleme. Die macht natürlich nicht das was ich will, aber diese Funktion geht:
Delphi-Quellcode:
procedure Antialiasing(
const DC: TCanvas;
const Rectangle: TRect);
var
cx, cy: Smallint;
r, g, b: Byte;
Row1: pRGBTripleArray;
Row2: pRGBTripleArray;
Row3: pRGBTripleArray;
TEMP: TBitmap;
CurRect: TRect;
begin
TEMP := TBitmap.Create;
try
with TEMP
do begin
Width := Rectangle.Right - Rectangle.Left;
Height := Rectangle.Bottom - Rectangle.Top;
CurRect := Rect(0, 0, Width, Height);
PixelFormat := pf24Bit;
Canvas.CopyRect(CurRect,
DC, Rectangle);
with Canvas
do begin
for cy := 1
to (Height - 2)
do begin
Row1 := ScanLine[cy - 1];
Row2 := ScanLine[cy];
Row3 := ScanLine[cy + 1];
for cx := 1
to (Width - 2)
do begin
r := (Row1[cx - 1].rgbtRed+Row1[cx].rgbtRed+
Row1[cx + 1].rgbtRed+
Row2[cx - 1].rgbtRed+
Row2[cx + 1].rgbtRed+
Row2[cx - 1].rgbtRed+
Row3[cx].rgbtRed+
Row3[cx + 1].rgbtRed+
Row3[cx].rgbtRed)
div 9;
g := (Row1[cx - 1].rgbtGreen+
Row1[cx].rgbtGreen+
Row1[cx + 1].rgbtGreen+
Row2[cx - 1].rgbtGreen+
Row2[cx + 1].rgbtGreen+
Row2[cx - 1].rgbtGreen+
Row3[cx].rgbtGreen+
Row3[cx + 1].rgbtGreen+
Row3[cx].rgbtGreen)
div 9;
b := (Row1[cx - 1].rgbtBlue+
Row1[cx].rgbtBlue+
Row1[cx + 1].rgbtBlue+
Row2[cx - 1].rgbtBlue+
Row2[cx + 1].rgbtBlue+
Row2[cx - 1].rgbtBlue+
Row3[cx].rgbtBlue+
Row3[cx + 1].rgbtBlue+
Row3[cx].rgbtBlue)
div 9;
Row2[cx].rgbtBlue := b;
Row2[cx].rgbtGreen := g;
Row2[cx].rgbtRed := r;
end;
end;
end;
DC.CopyRect(Rectangle, Canvas, CurRect);
end;
finally
TEMP.Free;
end;
end;
Was wird hier anders gemacht?