Browse Source

Merge pull request #213 from melchiorrecaruso/dev-bgracontrols

Fix for issues "TBCLeaSelector ring alignment" and "TBCFluentProgressRing doesn't display well ..."
Leandro Oscar Ezequiel Diaz 11 months ago
parent
commit
ca32218da0
7 changed files with 110 additions and 71 deletions
  1. 2 0
      bccombobox.pas
  2. 1 1
      bcfluentprogressring.pas
  3. 40 27
      bclealed.pas
  4. 41 33
      bcleaqled.pas
  5. 9 2
      bclearingslider.pas
  6. 16 8
      bcleaselector.pas
  7. 1 0
      bgraflashprogressbar.pas

+ 2 - 0
bccombobox.pas

@@ -109,7 +109,9 @@ type
     property ListBox: TListBox read GetListBox;
     property Text: string read GetItemText;
   published
+    property Align;
     property Anchors;
+    property BorderSpacing;
     property Canvas: TCanvas read GetComboCanvas;
     property CanvasScaleMode: TBCCanvasScaleMode read FCanvasScaleMode write SetCanvasScaleMode default csmAuto;
     property Items: TStrings read GetItems write SetItems;

+ 1 - 1
bcfluentprogressring.pas

@@ -178,7 +178,7 @@ begin
 
   if EffectiveSize<2 then exit;
 
-
+  Bitmap.FillTransparent;
   Bitmap.Canvas2D.resetTransform;
   Bitmap.Canvas2D.translate(Bitmap.Width/2, Bitmap.Height/2);
   Bitmap.Canvas2D.rotate(pi15);

+ 40 - 27
bclealed.pas

@@ -70,6 +70,7 @@ type
     procedure SetEnabled(Value: boolean); override;
     procedure SetVisible(Value: boolean); override;
     procedure Paint; override;
+    procedure Resize; override;
     procedure Redraw;
     procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
     procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
@@ -115,7 +116,7 @@ type
     property ColorOn: TColor read FColorOn write SetColorOn default TColor($00FF9C15);
     property ColorOff: TColor read FColorOff write SetColorOff default TColor($009E5A00);
     property BackgroundColor: TColor read FBkgColor write SetBkgColor default clBtnFace;
-    property Size: integer read FSize write SetSize default 15;
+    property Size: integer read FSize write SetSize default 30;
     property OnChangeValue: TNotifyEvent read FOnChangeValue write FOnChangeValue;
     property Style: TZStyle read FStyle write SetStyle default zsRaised;
     property Clickable: boolean read FClickable write SetClickable default False;
@@ -139,9 +140,9 @@ begin
   with GetControlClassDefaultSize do
     SetInitialBounds(0, 0, 50, 50);
   FValue := False;
+  ApplyDefaultTheme;
   FBitmap := TBGRABitmap.Create(Width, Height, FBkgColor);
   FClickable := False;
-  ApplyDefaultTheme;
 end;
 
 destructor TBCLeaLED.Destroy;
@@ -168,6 +169,12 @@ begin
   Redraw;
 end;
 
+procedure TBCLeaLED.Resize;
+begin
+  inherited Resize;
+  {$IFDEF LCLgtk2} Invalidate; {$ENDIF}
+end;
+
 procedure TBCLeaLED.SetStyle(AValue: TZStyle);
 begin
   if FStyle = AValue then
@@ -306,7 +313,7 @@ begin
   FColorOff := TColor($009E5A00);
   FBkgColor := clBtnFace;
   FStyle := zsRaised;
-  FSize := 15;
+  FSize := 30;
   FAltitude := 2;
   FAmbientFactor := 0.3;
   FSpecularIndex := 10;
@@ -351,28 +358,36 @@ var
   Blur: TBGRABitmap;
   Mask, Mask2: TBGRABitmap;
   Phong: TPhongShading;
-  ScaledPhongSize, ScaledSize: integer;
+  ScaledPhongSize, ScaledBlurSize, ScaledRadius: integer;
+  imgSize: integer;
+  img: TBGRABitmap;
+  Margin: integer;
 begin
   FBitmap.SetSize(Width, Height);
   FBitmap.Fill(FBkgColor);
 
   if (Width < 2) or (Height < 2) then exit;
-  ScaledSize := Scale96ToForm(FSize);
+  ScaledRadius := Scale96ToForm(FSize div 2);
   ScaledPhongSize := Scale96ToForm(5);
+  ScaledBlurSize := Scale96ToForm(10);
+  Margin := ScaledBlurSize;
+
+  imgSize := 2*(ScaledRadius + Margin);
+  img := TBGRABitmap.Create(imgSize, imgSize, ColorToBGRA(ColorToRGB(FBkgColor)));
 
   if Enabled then
   begin
     if FValue then
-      FBitmap.FillEllipseAntialias((Width-1)/2, (Height-1)/2, ScaledSize, ScaledSize, FColorOn)
+      img.FillEllipseAntialias((imgSize-1)/2, (imgSize-1)/2, ScaledRadius, ScaledRadius, FColorOn)
     else
-      FBitmap.FillEllipseAntialias((Width-1)/2, (Height-1)/2, ScaledSize, ScaledSize, FColorOff);
+      img.FillEllipseAntialias((imgSize-1)/2, (imgSize-1)/2, ScaledRadius, ScaledRadius, FColorOff);
   end
   else
-    FBitmap.FillEllipseAntialias((Width-1)/2, (Height-1)/2, ScaledSize, ScaledSize, clGray);
+    img.FillEllipseAntialias((imgSize-1)/2, (imgSize-1)/2, ScaledRadius, ScaledRadius, clGray);
 
   if (FStyle = zsRaised) or (FStyle = zsLowered) then
   begin
-    Mask := FBitmap.FilterGrayscale as TBGRABitmap;
+    Mask := img.FilterGrayscale as TBGRABitmap;
     if (FStyle = zsRaised) then
       Mask.Negative;
     Blur := Mask.FilterBlurRadial(ScaledPhongSize, ScaledPhongSize, rbFast) as TBGRABitmap;
@@ -380,7 +395,6 @@ begin
     Mask.Free;
 
     Phong := TPhongShading.Create;
-    if assigned(FTheme) then
     begin
       Phong.AmbientFactor := FAmbientFactor;
       Phong.SpecularIndex := FSpecularIndex;
@@ -396,39 +410,38 @@ begin
       Phong.DiffuseSaturation := FDiffuseSaturation;
       Phong.LightColor := FLightColor;
     end;
-    Phong.Draw(FBitmap, Blur, FAltitude, 0, 0, FBitmap);
+    Phong.Draw(img, Blur, FAltitude, 0, 0, img);
     Phong.Free;
     Blur.Free;
 
-    Mask := TBGRABitmap.Create(Width, Height, BGRABlack);
-    Mask.FillEllipseAntialias((Width-1)/2, (Height-1)/2, ScaledSize, ScaledSize, BGRAWhite);
-    Mask2 := TBGRABitmap.Create(Width, Height, ColorToBGRA(ColorToRGB(FBkgColor)));
-    Mask2.PutImage(0, 0, FBitmap, dmSet);
+    Mask := TBGRABitmap.Create(imgSize, imgSize, BGRABlack);
+    Mask.FillEllipseAntialias((imgSize-1)/2, (imgSize-1)/2, ScaledRadius, ScaledRadius, BGRAWhite);
+    Mask2 := TBGRABitmap.Create(imgSize, imgSize, ColorToBGRA(ColorToRGB(FBkgColor)));
+    Mask2.PutImage(0, 0, img, dmSet);
     Mask2.ApplyMask(Mask);
     Mask.Free;
-    FBitmap.Fill(FBkgColor);
-    FBitmap.PutImage(0, 0, Mask2, dmDrawWithTransparency);
+    FBitmap.PutImage((FBitmap.Width-imgSize) div 2, (FBitmap.Height-imgSize) div 2, Mask2, dmDrawWithTransparency);
     Mask2.Free;
   end
   else
   begin
-    Mask := TBGRABitmap.Create(Width, Height, BGRABlack);
-    Mask.FillEllipseAntialias((Width-1)/2, (Height-1)/2, ScaledSize, ScaledSize, BGRAWhite);
-    Mask2 := TBGRABitmap.Create(Width, Height, ColorToBGRA(ColorToRGB(FBkgColor)));
-    Mask2.PutImage(0, 0, FBitmap, dmSet);
+    Mask := TBGRABitmap.Create(imgSize, imgSize, BGRABlack);
+    Mask.FillEllipseAntialias((imgSize-1)/2, (imgSize-1)/2, ScaledRadius, ScaledRadius, BGRAWhite);
+    Mask2 := TBGRABitmap.Create(imgSize, imgSize, ColorToBGRA(ColorToRGB(FBkgColor)));
+    Mask2.PutImage(0, 0, img, dmSet);
     Mask2.ApplyMask(Mask);
     Mask.Free;
-    FBitmap.Fill(FBkgColor);
-    FBitmap.PutImage(0, 0, Mask2, dmDrawWithTransparency);
+    FBitmap.PutImage((FBitmap.Width-imgSize) div 2, (FBitmap.Height-imgSize) div 2, Mask2, dmDrawWithTransparency);
     Mask2.Free;
   end;
+  img.Free;
 
   if FValue then
   begin
-    Mask := TBGRABitmap.Create(Width, Height);
-    Mask.FillEllipseAntialias((Width-1)/2, (Height-1)/2, ScaledSize, ScaledSize, FColorOn);
-    Mask := Mask.FilterBlurRadial(ScaledPhongSize * 2, ScaledPhongSize * 2, rbFast);
-    FBitmap.BlendImageOver(0, 0, Mask, boGlow);
+    Mask := TBGRABitmap.Create(imgSize, imgSize);
+    Mask.FillEllipseAntialias((imgSize-1)/2, (imgSize-1)/2, ScaledRadius, ScaledRadius, FColorOn);
+    Mask := Mask.FilterBlurRadial(ScaledBlurSize, ScaledBlurSize, rbFast);
+    FBitmap.BlendImageOver((FBitmap.Width-imgSize) div 2, (FBitmap.Height-imgSize) div 2, Mask, boGlow);
     Mask.Free;
   end;
 

+ 41 - 33
bcleaqled.pas

@@ -72,6 +72,7 @@ type
     procedure SetEnabled(Value: boolean); override;
     procedure SetVisible(Value: boolean); override;
     procedure Paint; override;
+    procedure Resize; override;
     procedure Redraw;
     procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
     procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
@@ -86,6 +87,7 @@ type
     procedure ApplyDefaultTheme;
   published
     property Align;
+    property BorderSpacing;
     property Cursor;
     property Enabled;
     property Font;
@@ -117,7 +119,7 @@ type
     property ColorOn: TColor read FColorOn write SetColorOn default TColor($00FF9C15);
     property ColorOff: TColor read FColorOff write SetColorOff default TColor($009E5A00);
     property BackgroundColor: TColor read FBkgColor write SetBkgColor default clBtnFace;
-    property Size: integer read FSize write SetSize default 20;
+    property Size: integer read FSize write SetSize default 30;
     property OnChangeValue: TNotifyEvent read FOnChangeValue write FOnChangeValue;
     property Style: TZStyle read FStyle write SetStyle default zsRaised;
     property Clickable: boolean read FClickable write SetClickable default False;
@@ -171,6 +173,12 @@ begin
   Redraw;
 end;
 
+procedure TBCLeaQLED.Resize;
+begin
+  inherited Resize;
+  {$IFDEF LCLgtk2} Invalidate; {$ENDIF}
+end;
+
 procedure TBCLeaQLED.SetStyle(AValue: TZStyle);
 begin
   if FStyle = AValue then
@@ -319,7 +327,7 @@ begin
   FColorOff := TColor($009E5A00);
   FBkgColor := clBtnFace;
   FStyle := zsRaised;
-  FSize := 20;
+  FSize := 30;
   FAltitude := 2;
   FRounding := 3;
   FAmbientFactor := 0.3;
@@ -362,36 +370,38 @@ end;
 
 procedure TBCLeaQLED.Redraw;
 var
-  EffectiveSize: integer;
   Blur: TBGRABitmap;
   Mask, Mask2: TBGRABitmap;
   Phong: TPhongShading;
-  ScaledPhongSize, ScaledSize: integer;
+  ScaledPhongSize, ScaledBlurSize, ScaledSize: integer;
+  img: TBGRABitmap;
+  imgSize: integer;
+  Margin: integer;
 begin
   FBitmap.SetSize(Width, Height);
   FBitmap.Fill(FBkgColor);
 
-  if Width < Height then
-    EffectiveSize := Width
-  else
-    EffectiveSize := Height;
-  if EffectiveSize < 2 then exit;
+  if (Width < 2) or (Height < 2) then Exit;
   ScaledSize := Scale96ToForm(FSize);
   ScaledPhongSize := Scale96ToForm(5);
+  ScaledBlurSize := Scale96ToForm(10);
+  Margin := ScaledBlurSize;
+
+  imgSize := ScaledSize + 2*Margin;
+  img := TBGRABitmap.Create(imgSize, imgSize, ColorToBGRA(ColorToRGB(FBkgColor)));
 
   if Enabled then
   begin
     if FValue then
-      FBitmap.FillRoundRectAntialias((EffectiveSize / 2) - ScaledSize, (EffectiveSize / 2) - ScaledSize, (EffectiveSize / 2) + ScaledSize, (EffectiveSize / 2) + ScaledSize, FRounding, FRounding, FColorOn)
+      img.FillRoundRectAntialias(Margin, Margin, Margin+ScaledSize, Margin+ScaledSize, FRounding, FRounding, FColorOn)
     else
-      FBitmap.FillRoundRectAntialias((EffectiveSize / 2) - ScaledSize, (EffectiveSize / 2) - ScaledSize, (EffectiveSize / 2) + ScaledSize, (EffectiveSize / 2) + ScaledSize, FRounding, FRounding, FColorOff);
-  end
-  else
-    FBitmap.FillRoundRectAntialias((EffectiveSize / 2) - ScaledSize, (EffectiveSize / 2) - ScaledSize, (EffectiveSize / 2) + ScaledSize, (EffectiveSize / 2) + ScaledSize, FRounding, FRounding, clGray);
+      img.FillRoundRectAntialias(Margin, Margin, Margin+ScaledSize, Margin+ScaledSize, FRounding, FRounding, FColorOff);
+  end else
+    img.FillRoundRectAntialias(Margin, Margin, Margin+ScaledSize, Margin+ScaledSize, FRounding, FRounding, clGray);
 
   if (FStyle = zsRaised) or (FStyle = zsLowered) then
   begin
-    Mask := FBitmap.FilterGrayscale as TBGRABitmap;
+    Mask := img.FilterGrayscale as TBGRABitmap;
     if (FStyle = zsRaised) then
       Mask.Negative;
     Blur := Mask.FilterBlurRadial(ScaledPhongSize, ScaledPhongSize, rbFast) as TBGRABitmap;
@@ -399,7 +409,6 @@ begin
     Mask.Free;
 
     Phong := TPhongShading.Create;
-    if assigned(FTheme) then
     begin
       Phong.AmbientFactor := FAmbientFactor;
       Phong.SpecularIndex := FSpecularIndex;
@@ -415,39 +424,38 @@ begin
       Phong.DiffuseSaturation := FDiffuseSaturation;
       Phong.LightColor := FLightColor;
     end;
-    Phong.Draw(FBitmap, Blur, FAltitude, 0, 0, FBitmap);
+    Phong.Draw(img, Blur, FAltitude, 0, 0, img);
     Phong.Free;
     Blur.Free;
 
-    Mask := TBGRABitmap.Create(EffectiveSize, EffectiveSize, BGRABlack);
-    Mask.FillRoundRectAntialias((EffectiveSize / 2) - ScaledSize, (EffectiveSize / 2) - ScaledSize, (EffectiveSize / 2) + ScaledSize, (EffectiveSize / 2) + ScaledSize, FRounding, FRounding, BGRAWhite);
-    Mask2 := TBGRABitmap.Create(EffectiveSize, EffectiveSize, ColorToBGRA(ColorToRGB(FBkgColor)));
-    Mask2.PutImage(0, 0, FBitmap, dmSet);
+    Mask := TBGRABitmap.Create(imgSize, imgSize, BGRABlack);
+    Mask.FillRoundRectAntialias(Margin, Margin, Margin+ScaledSize, Margin+ScaledSize, FRounding, FRounding, BGRAWhite);
+    Mask2 := TBGRABitmap.Create(imgSize, imgSize, ColorToBGRA(ColorToRGB(FBkgColor)));
+    Mask2.PutImage(0, 0, img, dmSet);
     Mask2.ApplyMask(Mask);
     Mask.Free;
-    FBitmap.Fill(FBkgColor);
-    FBitmap.PutImage(0, 0, Mask2, dmDrawWithTransparency);
+    FBitmap.PutImage((FBitmap.Width - imgSize) div 2, (FBitmap.Height - imgSize) div 2, Mask2, dmDrawWithTransparency);
     Mask2.Free;
   end
   else
   begin
-    Mask := TBGRABitmap.Create(EffectiveSize, EffectiveSize, BGRABlack);
-    Mask.FillRoundRectAntialias((EffectiveSize / 2) - ScaledSize, (EffectiveSize / 2) - ScaledSize, (EffectiveSize / 2) + ScaledSize, (EffectiveSize / 2) + ScaledSize, FRounding, FRounding, BGRAWhite);
-    Mask2 := TBGRABitmap.Create(EffectiveSize, EffectiveSize, ColorToBGRA(ColorToRGB(FBkgColor)));
-    Mask2.PutImage(0, 0, FBitmap, dmSet);
+    Mask := TBGRABitmap.Create(imgSize, imgSize, BGRABlack);
+    Mask.FillRoundRectAntialias(Margin, Margin, Margin+ScaledSize, Margin+ScaledSize, FRounding, FRounding, BGRAWhite);
+    Mask2 := TBGRABitmap.Create(imgSize, imgSize, ColorToBGRA(ColorToRGB(FBkgColor)));
+    Mask2.PutImage(0, 0, img, dmSet);
     Mask2.ApplyMask(Mask);
     Mask.Free;
-    FBitmap.Fill(FBkgColor);
-    FBitmap.PutImage(0, 0, Mask2, dmDrawWithTransparency);
+    FBitmap.PutImage((FBitmap.Width-imgSize) div 2, (FBitmap.Height-imgSize) div 2, Mask2, dmDrawWithTransparency);
     Mask2.Free;
   end;
+  img.Free;
 
   if FValue then
   begin
-    Mask := TBGRABitmap.Create(EffectiveSize, EffectiveSize);
-    Mask.FillRoundRectAntialias((EffectiveSize / 2) - ScaledSize, (EffectiveSize / 2) - ScaledSize, (EffectiveSize / 2) + ScaledSize, (EffectiveSize / 2) + ScaledSize, FRounding, FRounding, FColorOn);
-    Mask := Mask.FilterBlurRadial(ScaledPhongSize * 2, ScaledPhongSize * 2, rbFast);
-    FBitmap.BlendImageOver(0, 0, Mask, boGlow);
+    Mask := TBGRABitmap.Create(imgSize, imgSize);
+    Mask.FillRoundRectAntialias(Margin, Margin, Margin+ScaledSize, Margin+ScaledSize, FRounding, FRounding, FColorOn);
+    Mask := Mask.FilterBlurRadial(ScaledBlurSize, ScaledBlurSize, rbFast);
+    FBitmap.BlendImageOver((FBitmap.Width-imgSize) div 2, (FBitmap.Height-imgSize) div 2, Mask, boGlow);
     Mask.Free;
   end;
 

+ 9 - 2
bclearingslider.pas

@@ -119,6 +119,7 @@ type
     procedure SetEnabled(Value: boolean); override;
     procedure SetVisible(Value: boolean); override;
     procedure Paint; override;
+    procedure Resize; override;
     procedure Redraw;
     procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
     procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
@@ -346,6 +347,12 @@ begin
   Redraw;
 end;
 
+procedure TBCLeaRingSlider.Resize;
+begin
+  inherited Resize;
+  {$IFDEF LCLgtk2} Invalidate; {$ENDIF}
+end;
+
 procedure TBCLeaRingSlider.Redraw;
 const
   pi15 = pi * 1.5;
@@ -485,12 +492,12 @@ begin
     Mask.Free;
 
     Phong := TPhongShading.Create;
-    if Assigned(FTheme) then
     begin
       Phong.AmbientFactor := FAmbientFactor;
       Phong.SpecularIndex := FSpecularIndex;
       Phong.LightDestFactor := FLightDestFactor;
-      Phong.LightPosition := Point(FLightPositionX, FLightPositionY);
+      Phong.LightPosition := Point(FLightPositionX + (FBitmap.Width  - EffectiveSize) div 2,
+                                   FLightPositionY + (FBitmap.Height - EffectiveSize) div 2);
       Phong.LightPositionZ := FLightPositionZ;
       Phong.LightSourceIntensity := FLightSourceIntensity;
       Phong.LightSourceDistanceTerm := FLightSourceDistanceTerm;

+ 16 - 8
bcleaselector.pas

@@ -111,6 +111,7 @@ type
     procedure SetEnabled(Value: boolean); override;
     procedure SetVisible(Value: boolean); override;
     procedure Paint; override;
+    procedure Resize; override;
     procedure Redraw;
     procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
     procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
@@ -125,6 +126,7 @@ type
     procedure ApplyDefaultTheme;
   published
     property Align;
+    property BorderSpacing;
     property Cursor;
     property Enabled;
     property Font;
@@ -337,6 +339,12 @@ begin
   Redraw;
 end;
 
+procedure TBCLeaSelector.Resize;
+begin
+  inherited Resize;
+  {$IFDEF LCLgtk2} Invalidate; {$ENDIF}
+end;
+
 procedure TBCLeaSelector.Redraw;
 const
   pi15 = pi * 1.5;
@@ -385,7 +393,7 @@ begin
 
 
   FBitmap.Canvas2D.resetTransform;
-  FBitmap.Canvas2D.translate(FBitmap.Width / 2, FBitmap.Height / 2);
+  FBitmap.Canvas2D.translate((FBitmap.Width-1)/2, (FBitmap.Height-1)/2);
   FBitmap.Canvas2D.rotate(pi15);
 
   if FLineWidth = 0 then
@@ -431,7 +439,7 @@ begin
       TextStr := FItems[FValue]
     else
       TextStr := 'NaN';
-    TextBmp := TextShadow(EffectiveSize, EffectiveSize, TextStr, Font.Height,
+    TextBmp := TextShadow(FBitmap.Width, FBitmap.Height, TextStr, Font.Height,
       Font.Color, FontShadowColor, FontShadowOFfsetX,
       FontShadowOffsetY, FontShadowRadius, Font.Style, Font.Name) as TBGRABitmap;
     TextSize:= TextBmp.TextSize(TextStr);
@@ -459,12 +467,12 @@ begin
     Mask.Free;
 
     Phong := TPhongShading.Create;
-    if Assigned(FTheme) then
     begin
       Phong.AmbientFactor := FAmbientFactor;
       Phong.SpecularIndex := FSpecularIndex;
       Phong.LightDestFactor := FLightDestFactor;
-      Phong.LightPosition := Point(FLightPositionX, FLightPositionY);
+      Phong.LightPosition := Point(FLightPositionX + (FBitmap.Width  - EffectiveSize) div 2,
+                                   FLightPositionY + (FBitmap.Height - EffectiveSize) div 2);
       Phong.LightPositionZ := FLightPositionZ;
       Phong.LightSourceIntensity := FLightSourceIntensity;
       Phong.LightSourceDistanceTerm := FLightSourceDistanceTerm;
@@ -480,9 +488,9 @@ begin
     Blur.Free;
 
     //cut out phong-affected area outside the ring and fill with background color
-    Mask := TBGRABitmap.Create(EffectiveSize, EffectiveSize, BGRABlack);
-    Mask.FillEllipseAntialias(EffectiveSize div 2, EffectiveSize div 2, EffectiveSize div 2, EffectiveSize div 2, BGRAWhite);
-    Mask2 := TBGRABitmap.Create(EffectiveSize, EffectiveSize, ColorToBGRA(ColorToRGB(FBkgColor)));
+    Mask := TBGRABitmap.Create(FBitmap.Width, FBitmap.Height, BGRABlack);
+    Mask.FillEllipseAntialias((FBitmap.Width-1)/2, (FBitmap.Height-1)/2, EffectiveSize div 2, EffectiveSize div 2, BGRAWhite);
+    Mask2 := TBGRABitmap.Create(FBitmap.Width, FBitmap.Height, ColorToBGRA(ColorToRGB(FBkgColor)));
     Mask2.PutImage(0, 0, FBitmap, dmSet);
     Mask2.ApplyMask(Mask);
     Mask.Free;
@@ -497,7 +505,7 @@ begin
       TextStr := FItems[FValue]
     else
       TextStr := 'NaN';
-    TextBmp := TextShadow(EffectiveSize, EffectiveSize, TextStr, Font.Height,
+    TextBmp := TextShadow(FBitmap.Width, FBitmap.Height, TextStr, Font.Height,
       Font.Color, FontShadowColor, FontShadowOFfsetX,
       FontShadowOffsetY, FontShadowRadius, Font.Style, Font.Name) as TBGRABitmap;
     TextSize:= TextBmp.TextSize(TextStr);

+ 1 - 0
bgraflashprogressbar.pas

@@ -184,6 +184,7 @@ type
 
   published
     property Align;
+    property BorderSpacing;
     property Anchors;
     property Caption;
     property CaptionShowPercent: Boolean read FCaptionShowPercent write SetCaptionShowPercent default False;