<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
I am investigating this, because similar artefacts can be seen in
the new PPI related stretched images in Lazarus.<br>
<br>
Add below code to a form with 2 TImages on it. (on windows / fpc
3.1.1 39275)<br>
<br>
It stretches the image to 3 times it size.<br>
<br>
<img src="cid:part1.5DF1DFB2.953EA75D@mfriebe.de" alt=""><br>
<br>
The magnified result (bottom part)<br>
<img src="cid:part2.2FB0EFAC.CCAA3FCF@mfriebe.de" alt=""><br>
<br>
1) For a single pixel line (left) of a solid color, I would expect a
3 pixel wide line without anti aliasing. Though yes, the anti
aliasing could be ok...<br>
<br>
2) But if there is anti aliasing, and even if the anti aliasing
goes over 3 pixels, aren't the shades just in reverse order.<br>
Shouldn't the darkest be farest from the red, not closest?<br>
<br>
3) Similar the dark red part of the right line (The right line is
1px bright and 1px dark red before stretch).<br>
Aren't the shades in the wrong order? (there are 3 shades of dark
red, on the right side of the bright red, starting with the
darkest.)<br>
<br>
<br>
<br>
<br>
procedure TForm1.FormCreate(Sender: TObject);<br>
var<br>
ScFI, ScFI2: TFPCompactImgRGBA8Bit;<br>
ScCanvas: TFPImageCanvas;<br>
i, x, y: Integer;<br>
c : TFPColor;<br>
begin<br>
ScFI := TFPCompactImgRGBA8Bit.Create(30, 30);<br>
<br>
for x := 0 to 29 do for y := 0 to 29 do begin<br>
c.alpha := $FFFF;<br>
c.green := 0;<br>
c.blue := 0;<br>
c.Red := 0;<br>
ScFI.Colors[x,y] := c;<br>
end;<br>
<br>
for i := 1 to 20 do begin<br>
c.alpha := $FFFF;<br>
c.green := 0;<br>
c.blue := 0;<br>
c.Red := $FFFF;<br>
ScFI.Colors[10,i] := c;<br>
ScFI.Colors[20,i] := c;<br>
//c.blue := 10;<br>
c.Red := $7F7F;<br>
ScFI.Colors[21,i] := c;<br>
end;<br>
<br>
for x := 0 to 29 do for y := 0 to 29 do<br>
Image1.Canvas.Pixels[x,y] :=<br>
Byte(ScFI.Colors[x,y].red) +<br>
Byte(ScFI.Colors[x,y].green) << 8 +<br>
Byte(ScFI.Colors[x,y].blue) << 16;<br>
<br>
ScFI2 := TFPCompactImgRGBA8Bit.Create(90, 90);<br>
ScCanvas := TFPImageCanvas.create(ScFI2);<br>
ScCanvas.StretchDraw(0,0, 90, 90, scFI);<br>
<br>
for x := 0 to 89 do for y := 0 to 89 do<br>
Image2.Canvas.Pixels[x,y] :=<br>
Byte(ScCanvas.Colors[x,y].red) +<br>
Byte(ScCanvas.Colors[x,y].green) << 8 +<br>
Byte(ScCanvas.Colors[x,y].blue) << 16;<br>
end;<br>
<br>
</body>
</html>