You've already forked lazarus-ccr
industrial: Anti-aliased drawing of scaled TLEDNumber at lowest size.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7313 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -375,9 +375,20 @@ procedure TCustomLEDNumber.Paint;
|
|||||||
var
|
var
|
||||||
Points: array[0..MAX_POINTS] of TPoint;
|
Points: array[0..MAX_POINTS] of TPoint;
|
||||||
ARect: TRect;
|
ARect: TRect;
|
||||||
|
AADraw: Boolean; // anti-aliased drawing flag
|
||||||
|
savedScaleFactor: Double;
|
||||||
begin
|
begin
|
||||||
lbDrawBMP.Width := Width;
|
AADraw := (Font.PixelsPerInch <> 96) and (FSize = 2);
|
||||||
lbDrawBMP.Height := Height;
|
if AADraw then begin
|
||||||
|
savedScaleFactor := FScaleFactor;
|
||||||
|
FScaleFactor := 2*FScaleFactor;
|
||||||
|
lbDrawBMP.Width := 2*Width;
|
||||||
|
lbDrawBMP.Height := 2*Height;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
lbDrawBMP.Width := Width;
|
||||||
|
lbDrawBMP.Height := Height;
|
||||||
|
end;
|
||||||
|
|
||||||
Initialize(Points);
|
Initialize(Points);
|
||||||
lbDrawBMP.Canvas.Brush.Color := FBgColor;
|
lbDrawBMP.Canvas.Brush.Color := FBgColor;
|
||||||
@@ -385,7 +396,7 @@ begin
|
|||||||
ProcessCaption(Points);
|
ProcessCaption(Points);
|
||||||
|
|
||||||
Canvas.CopyMode := cmSrcCopy;
|
Canvas.CopyMode := cmSrcCopy;
|
||||||
if BorderStyle <> lnbNone then
|
if (BorderStyle <> lnbNone) then
|
||||||
begin
|
begin
|
||||||
ARect := ClientRect;
|
ARect := ClientRect;
|
||||||
case BorderStyle of
|
case BorderStyle of
|
||||||
@@ -402,6 +413,11 @@ begin
|
|||||||
inc(ARect.Right, 1);
|
inc(ARect.Right, 1);
|
||||||
inc(ARect.Bottom, 1);
|
inc(ARect.Bottom, 1);
|
||||||
Canvas.StretchDraw(ARect, lbDrawBMP);
|
Canvas.StretchDraw(ARect, lbDrawBMP);
|
||||||
|
end else
|
||||||
|
if AADraw then begin
|
||||||
|
ARect := ClientRect;
|
||||||
|
Canvas.StretchDraw(ARect, lbDrawBMP);
|
||||||
|
FScaleFactor := savedScaleFactor;
|
||||||
end else
|
end else
|
||||||
Canvas.Draw(0, 0, lbDrawBMP);
|
Canvas.Draw(0, 0, lbDrawBMP);
|
||||||
end;
|
end;
|
||||||
|
Reference in New Issue
Block a user