|
|
@@ -13,6 +13,10 @@ For BGRAControls by: Lainz
|
|
|
|
|
|
- Using BGRABitmap antialiased drawing (2020-09-09)
|
|
|
|
|
|
+2025 - Massimo Magnano
|
|
|
+ Fixed gtk draw outside area (Use Width/Height instead of Canvas.Width/Height)
|
|
|
+ Added Color Property; Comments in English
|
|
|
+
|
|
|
Lazarus: 1.6+}
|
|
|
|
|
|
unit atshapelinebgra;
|
|
|
@@ -58,6 +62,7 @@ type
|
|
|
destructor Destroy; override;
|
|
|
published
|
|
|
{ Published declarations }
|
|
|
+ property Color;
|
|
|
property DragCursor;
|
|
|
property DragKind;
|
|
|
property DragMode;
|
|
|
@@ -77,6 +82,7 @@ type
|
|
|
property Arrow1: Boolean read FArrow1 write SetArrow1 default False;
|
|
|
property Arrow2: Boolean read FArrow2 write SetArrow2 default False;
|
|
|
property ArrowFactor: Integer read FArrowFactor write SetArrowFactor default 8;
|
|
|
+
|
|
|
property OnDragDrop;
|
|
|
property OnDragOver;
|
|
|
property OnEndDrag;
|
|
|
@@ -201,7 +207,11 @@ var
|
|
|
begin
|
|
|
inherited;
|
|
|
|
|
|
- bgra := TBGRABitmap.Create(Canvas.Width, Canvas.Height, BGRAPixelTransparent);
|
|
|
+ try
|
|
|
+ if (Color=Parent.Color) or (Color=clNone)
|
|
|
+ then bgra := TBGRABitmap.Create(Width, Height, BGRAPixelTransparent)
|
|
|
+ else bgra := TBGRABitmap.Create(Width, Height, ColorToBGRA(Color));
|
|
|
+
|
|
|
bgra.CanvasBGRA.Pen.Color:= FLineColor;
|
|
|
bgra.CanvasBGRA.Brush.Color:=FArrowColor;
|
|
|
bgra.CanvasBGRA.Pen.Width:=FLineWidth;
|
|
|
@@ -217,7 +227,7 @@ begin
|
|
|
bgra.CanvasBGRA.Pen.Width:= 1;
|
|
|
|
|
|
if FArrow1 then begin
|
|
|
- //Flecha hacia izquierda
|
|
|
+ //Left Arrow
|
|
|
p1:=Point(0,start);
|
|
|
p2:=Point(FArrowFactor,Start-FArrowFactor);
|
|
|
p3:=Point(FArrowFactor,Start+FArrowFactor);
|
|
|
@@ -225,7 +235,7 @@ begin
|
|
|
end;
|
|
|
|
|
|
if FArrow2 then begin
|
|
|
- //Flecha hacia derecha
|
|
|
+ //Right Arrow
|
|
|
p1:=Point(Width-1, Start);
|
|
|
p2:=Point(Width-(FArrowFactor+1),Start-FArrowFactor);
|
|
|
p3:=Point(Width-(FArrowFactor+1),Start+FArrowFactor);
|
|
|
@@ -242,7 +252,7 @@ begin
|
|
|
bgra.CanvasBGRA.Pen.Width:= 1;
|
|
|
|
|
|
if FArrow1 then begin
|
|
|
- //Flecha hacia arriba
|
|
|
+ //Up Arrow
|
|
|
p1:=Point(start,0);
|
|
|
p2:=Point(Start-FArrowFactor,FArrowFactor);
|
|
|
p3:=Point(Start+FArrowFactor,FArrowFactor);
|
|
|
@@ -250,7 +260,7 @@ begin
|
|
|
end;
|
|
|
|
|
|
if FArrow2 then begin
|
|
|
- //Flecha hacia abajo
|
|
|
+ //Down Arrow
|
|
|
p1:=Point(start,Height-1);
|
|
|
p2:=Point(Start-FArrowFactor,Height-(FArrowFactor+1));
|
|
|
p3:=Point(Start+FArrowFactor,Height-(FArrowFactor+1));
|
|
|
@@ -273,7 +283,7 @@ begin
|
|
|
bgra.CanvasBGRA.Pen.Width:= 1;
|
|
|
|
|
|
if FArrow1 and(Width>0)then begin
|
|
|
- //Flecha hacia arriba
|
|
|
+ //Up Arrow
|
|
|
H0:=Round((FArrowFactor+1)*Sin(Alfa));
|
|
|
W0:=Round((FArrowFactor+1)*Cos(Alfa));
|
|
|
|
|
|
@@ -299,7 +309,7 @@ begin
|
|
|
|
|
|
|
|
|
if FArrow2 and(Width>0)then begin
|
|
|
- //Flecha hacia abajo
|
|
|
+ //Down Arrow
|
|
|
H0:=Round((FArrowFactor+1)*Sin(Alfa));
|
|
|
W0:=Round((FArrowFactor+1)*Cos(Alfa));
|
|
|
|
|
|
@@ -407,7 +417,10 @@ begin
|
|
|
end;
|
|
|
|
|
|
bgra.Draw(Canvas, 0, 0, False);
|
|
|
- bgra.Free;
|
|
|
+
|
|
|
+ finally
|
|
|
+ bgra.Free;
|
|
|
+ end;
|
|
|
end;
|
|
|
|
|
|
end.
|