From 019e5e3a8e3cd2e0df29d9e61c6a809e1d854fad Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Wed, 22 Jan 2020 06:28:50 +0000 Subject: [PATCH] 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 --- .../industrialstuff/source/lednumber.pas | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/components/industrialstuff/source/lednumber.pas b/components/industrialstuff/source/lednumber.pas index e63f37942..9f9d8233d 100644 --- a/components/industrialstuff/source/lednumber.pas +++ b/components/industrialstuff/source/lednumber.pas @@ -375,9 +375,20 @@ procedure TCustomLEDNumber.Paint; var Points: array[0..MAX_POINTS] of TPoint; ARect: TRect; + AADraw: Boolean; // anti-aliased drawing flag + savedScaleFactor: Double; begin - lbDrawBMP.Width := Width; - lbDrawBMP.Height := Height; + AADraw := (Font.PixelsPerInch <> 96) and (FSize = 2); + 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); lbDrawBMP.Canvas.Brush.Color := FBgColor; @@ -385,7 +396,7 @@ begin ProcessCaption(Points); Canvas.CopyMode := cmSrcCopy; - if BorderStyle <> lnbNone then + if (BorderStyle <> lnbNone) then begin ARect := ClientRect; case BorderStyle of @@ -402,6 +413,11 @@ begin inc(ARect.Right, 1); inc(ARect.Bottom, 1); Canvas.StretchDraw(ARect, lbDrawBMP); + end else + if AADraw then begin + ARect := ClientRect; + Canvas.StretchDraw(ARect, lbDrawBMP); + FScaleFactor := savedScaleFactor; end else Canvas.Draw(0, 0, lbDrawBMP); end;