Skip to content

Commit

Permalink
*Fixed issue #111 "Partly ugly antialiasing effects"
Browse files Browse the repository at this point in the history
  • Loading branch information
carloBarazzetta committed Sep 16, 2020
1 parent a23fac8 commit bfedc67
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
1 change: 0 additions & 1 deletion Demo/Source/UDataModule.pas
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ interface

uses
System.SysUtils, System.Classes,
Vcl.BaseImageCollection, //if you are compiling with older version than 10.3 remove this line
SVGIconImageCollection;

type
Expand Down
3 changes: 1 addition & 2 deletions Demo/Source/UMain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ interface
System.Actions,
System.ImageList, //if you are compiling with older version than XE7 remove this line
SVGIconImageListBase, SVGIconImageCollection, SVGIconVirtualImageList,
{$IFDEF D10_3+}Vcl.VirtualImageList,{$ENDIF}
UDataModule;

type
Expand Down Expand Up @@ -303,7 +302,7 @@ procedure TMainForm.SelectThemeRadioGroupClick(Sender: TObject);
LStyleName := SelectThemeRadioGroup.Items[SelectThemeRadioGroup.ItemIndex];
{$IFDEF DXE+}
TStyleManager.TrySetStyle(LStyleName);
//UpdateIconFontsColorByStyle(IconFontsImageList); TODO
ImageDataModule.SVGIconImageCollection.Change;
{$ELSE}
SelectThemeRadioGroup.Visible := False;
{$ENDIF}
Expand Down
2 changes: 1 addition & 1 deletion Demo/Source/UMainNew.pas
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ procedure TMainForm.SelectThemeRadioGroupClick(Sender: TObject);
LStyleName := SelectThemeRadioGroup.Items[SelectThemeRadioGroup.ItemIndex];
if TStyleManager.ActiveStyle.Name <> LStyleName then
TStyleManager.TrySetStyle(LStyleName);
//UpdateIconFontsColorByStyle(IconFontsImageList); TODO
ImageDataModule.SVGIconImageCollection.Change;
UpdateGUI(False);
finally
Screen.Cursor := crDefault;
Expand Down
8 changes: 8 additions & 0 deletions Source/SVGIconImageCollection.pas
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ TSVGIconImageCollection = class(TComponent)
function GetNameByIndex(AIndex: Integer): String; override;
function GetBitmap(AIndex: Integer; AWidth, AHeight: Integer): TBitmap; override;
procedure Draw(ACanvas: TCanvas; ARect: TRect; AIndex: Integer; AProportional: Boolean = False); override;
{$ELSE}
procedure Change;
{$ENDIF}

constructor Create(AOwner: TComponent); override;
Expand Down Expand Up @@ -408,6 +410,12 @@ procedure TSVGIconImageCollection.Draw(ACanvas: TCanvas; ARect: TRect; AIndex: I

LSVG.PaintTo(ACanvas.Handle, TRectF.Create(ARect), AProportional);
end;
{$ELSE}
procedure TSVGIconImageCollection.Change;
begin
FSVGItems.BeginUpdate;
FSVGItems.EndUpdate;
end;
{$ENDIF}

end.
6 changes: 5 additions & 1 deletion Source/SVGIconItems.pas
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ implementation

uses
System.SysUtils,
VCL.Themes,
{$IFDEF D10_3+}
BaseImageCollection,
{$ENDIF}
Expand Down Expand Up @@ -169,7 +170,10 @@ function TSVGIconItem.GetBitmap(const AWidth, AHeight: Integer;

Result := TBitmap.Create;
Result.PixelFormat := pf32bit;
Result.Canvas.Brush.Color := $00FFFFFF;
if TStyleManager.IsCustomStyleActive then
Result.Canvas.Brush.Color := StyleServices.GetSystemColor(clWindow)
else
Result.Canvas.Brush.Color := clWindow;
Result.SetSize(AWidth, AHeight);

FSVG.PaintTo(Result.Canvas.Handle, TRectF.Create(0, 0, AWidth, AHeight));
Expand Down

0 comments on commit bfedc67

Please sign in to comment.