|
@@ -37,6 +37,7 @@ type
|
|
TForm1 = class(TForm)
|
|
TForm1 = class(TForm)
|
|
BackImage: TImage;
|
|
BackImage: TImage;
|
|
BGRAFillImageList16: TBGRAImageList;
|
|
BGRAFillImageList16: TBGRAImageList;
|
|
|
|
+ PenStyleImageList: TBGRAImageList;
|
|
CurveImageList: TBGRAImageList;
|
|
CurveImageList: TBGRAImageList;
|
|
ButtonBackGradInterp: TBCButton;
|
|
ButtonBackGradInterp: TBCButton;
|
|
ButtonBackLoadTex: TBCButton;
|
|
ButtonBackLoadTex: TBCButton;
|
|
@@ -64,7 +65,11 @@ type
|
|
ShapeBackStartColor: TShape;
|
|
ShapeBackStartColor: TShape;
|
|
ToolBar2: TToolBar;
|
|
ToolBar2: TToolBar;
|
|
ButtonMoveBackFillPoints: TToolButton;
|
|
ButtonMoveBackFillPoints: TToolButton;
|
|
|
|
+ ToolBarJoinStyle: TToolBar;
|
|
|
|
+ ToolButtonJoinRound: TToolButton;
|
|
ToolButton2: TToolButton;
|
|
ToolButton2: TToolButton;
|
|
|
|
+ ToolButtonJoinBevel: TToolButton;
|
|
|
|
+ ToolButtonJoinMiter: TToolButton;
|
|
ToolButtonBackFillNone: TToolButton;
|
|
ToolButtonBackFillNone: TToolButton;
|
|
ToolButtonBackFillSolid: TToolButton;
|
|
ToolButtonBackFillSolid: TToolButton;
|
|
ToolButtonBackFillLinear: TToolButton;
|
|
ToolButtonBackFillLinear: TToolButton;
|
|
@@ -120,6 +125,7 @@ type
|
|
procedure ButtonShapeSendToBackClick(Sender: TObject);
|
|
procedure ButtonShapeSendToBackClick(Sender: TObject);
|
|
procedure ShapeBackGradColorMouseUp(Sender: TObject; Button: TMouseButton;
|
|
procedure ShapeBackGradColorMouseUp(Sender: TObject; Button: TMouseButton;
|
|
Shift: TShiftState; X, Y: Integer);
|
|
Shift: TShiftState; X, Y: Integer);
|
|
|
|
+ procedure ToolButtonJoinClick(Sender: TObject);
|
|
procedure UpDownBackGradAlphaChange(Sender: TObject; AByUser: boolean);
|
|
procedure UpDownBackGradAlphaChange(Sender: TObject; AByUser: boolean);
|
|
procedure UpDownBackTexAlphaChange(Sender: TObject; AByUser: boolean);
|
|
procedure UpDownBackTexAlphaChange(Sender: TObject; AByUser: boolean);
|
|
procedure UpDownPenWidthChange(Sender: TObject; AByUser: boolean);
|
|
procedure UpDownPenWidthChange(Sender: TObject; AByUser: boolean);
|
|
@@ -161,6 +167,7 @@ type
|
|
FBackTexture: TBGRABitmap;
|
|
FBackTexture: TBGRABitmap;
|
|
FPenWidth: single;
|
|
FPenWidth: single;
|
|
FPenStyle: TBGRAPenStyle;
|
|
FPenStyle: TBGRAPenStyle;
|
|
|
|
+ FPenJoinStyle: TPenJoinStyle;
|
|
FFlattened: TBGRABitmap;
|
|
FFlattened: TBGRABitmap;
|
|
FLastEditorBounds: TRect;
|
|
FLastEditorBounds: TRect;
|
|
FUpdatingFromShape: boolean;
|
|
FUpdatingFromShape: boolean;
|
|
@@ -196,6 +203,7 @@ type
|
|
procedure SetBackTexture(AValue: TBGRABitmap);
|
|
procedure SetBackTexture(AValue: TBGRABitmap);
|
|
procedure SetCurrentTool(AValue: TPaintTool);
|
|
procedure SetCurrentTool(AValue: TPaintTool);
|
|
procedure SetPenColor(AValue: TBGRAPixel);
|
|
procedure SetPenColor(AValue: TBGRAPixel);
|
|
|
|
+ procedure SetPenJoinStyle(AValue: TPenJoinStyle);
|
|
procedure SetPenStyle(AValue: TBGRAPenStyle);
|
|
procedure SetPenStyle(AValue: TBGRAPenStyle);
|
|
procedure SetPenWidth(AValue: single);
|
|
procedure SetPenWidth(AValue: single);
|
|
procedure SetSplineStyle(AValue: TSplineStyle);
|
|
procedure SetSplineStyle(AValue: TSplineStyle);
|
|
@@ -248,6 +256,7 @@ type
|
|
property penStyle: TBGRAPenStyle read GetPenStyle write SetPenStyle;
|
|
property penStyle: TBGRAPenStyle read GetPenStyle write SetPenStyle;
|
|
property splineStyle: TSplineStyle read GetSplineStyle write SetSplineStyle;
|
|
property splineStyle: TSplineStyle read GetSplineStyle write SetSplineStyle;
|
|
property currentTool: TPaintTool read FCurrentTool write SetCurrentTool;
|
|
property currentTool: TPaintTool read FCurrentTool write SetCurrentTool;
|
|
|
|
+ property joinStyle: TPenJoinStyle read FPenJoinStyle write SetPenJoinStyle;
|
|
end;
|
|
end;
|
|
|
|
|
|
var
|
|
var
|
|
@@ -273,6 +282,14 @@ begin
|
|
btn.Parent := AToolbar;
|
|
btn.Parent := AToolbar;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure EnableDisableToolButtons(AButtons: array of TToolButton; AEnabled: boolean);
|
|
|
|
+var
|
|
|
|
+ i: Integer;
|
|
|
|
+begin
|
|
|
|
+ for i := 0 to high(AButtons) do
|
|
|
|
+ AButtons[i].Enabled:= AEnabled;
|
|
|
|
+end;
|
|
|
|
+
|
|
function LCLKeyToSpecialKey(Key: Word): TSpecialKey;
|
|
function LCLKeyToSpecialKey(Key: Word): TSpecialKey;
|
|
var
|
|
var
|
|
sk: TSpecialKey;
|
|
sk: TSpecialKey;
|
|
@@ -370,6 +387,7 @@ begin
|
|
backGradEndColor := CSSYellow;
|
|
backGradEndColor := CSSYellow;
|
|
penWidth := 5;
|
|
penWidth := 5;
|
|
penStyle := SolidPenStyle;
|
|
penStyle := SolidPenStyle;
|
|
|
|
+ joinStyle:= pjsBevel;
|
|
currentTool:= ptHand;
|
|
currentTool:= ptHand;
|
|
splineStyle:= ssEasyBezier;
|
|
splineStyle:= ssEasyBezier;
|
|
FBackGradRepetition:= grPad;
|
|
FBackGradRepetition:= grPad;
|
|
@@ -528,6 +546,16 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TForm1.ToolButtonJoinClick(Sender: TObject);
|
|
|
|
+begin
|
|
|
|
+ if (Sender as TToolButton).Down then
|
|
|
|
+ begin
|
|
|
|
+ if Sender = ToolButtonJoinRound then joinStyle := pjsRound else
|
|
|
|
+ if Sender = ToolButtonJoinBevel then joinStyle := pjsBevel else
|
|
|
|
+ if Sender = ToolButtonJoinMiter then joinStyle := pjsMiter;
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TForm1.ButtonBackSwapGradColorClick(Sender: TObject);
|
|
procedure TForm1.ButtonBackSwapGradColorClick(Sender: TObject);
|
|
var
|
|
var
|
|
temp, c: TBGRAPixel;
|
|
temp, c: TBGRAPixel;
|
|
@@ -1167,6 +1195,20 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TForm1.SetPenJoinStyle(AValue: TPenJoinStyle);
|
|
|
|
+begin
|
|
|
|
+ if FPenJoinStyle=AValue then Exit;
|
|
|
|
+ FPenJoinStyle:=AValue;
|
|
|
|
+ ToolButtonJoinRound.Down:= FPenJoinStyle = pjsRound;
|
|
|
|
+ ToolButtonJoinBevel.Down:= FPenJoinStyle = pjsBevel;
|
|
|
|
+ ToolButtonJoinMiter.Down:= FPenJoinStyle = pjsMiter;
|
|
|
|
+ if not FUpdatingFromShape and Assigned(vectorOriginal) then
|
|
|
|
+ begin
|
|
|
|
+ if Assigned(vectorOriginal.SelectedShape) then
|
|
|
|
+ vectorOriginal.SelectedShape.JoinStyle := FPenJoinStyle;
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TForm1.SetPenStyle(AValue: TBGRAPenStyle);
|
|
procedure TForm1.SetPenStyle(AValue: TBGRAPenStyle);
|
|
begin
|
|
begin
|
|
FPenStyle := AValue;
|
|
FPenStyle := AValue;
|
|
@@ -1339,6 +1381,7 @@ begin
|
|
if vsfPenColor in f then penColor := AShape.PenColor;
|
|
if vsfPenColor in f then penColor := AShape.PenColor;
|
|
if vsfPenWidth in f then penWidth:= AShape.PenWidth;
|
|
if vsfPenWidth in f then penWidth:= AShape.PenWidth;
|
|
if vsfPenStyle in f then penStyle:= AShape.PenStyle;
|
|
if vsfPenStyle in f then penStyle:= AShape.PenStyle;
|
|
|
|
+ if vsfJoinStyle in f then joinStyle:= AShape.JoinStyle;
|
|
|
|
|
|
if vsfBackFill in f then
|
|
if vsfBackFill in f then
|
|
begin
|
|
begin
|
|
@@ -1396,6 +1439,7 @@ begin
|
|
UpdateBackComponentsVisibility;
|
|
UpdateBackComponentsVisibility;
|
|
UpDownPenWidth.Enabled := vsfPenWidth in f;
|
|
UpDownPenWidth.Enabled := vsfPenWidth in f;
|
|
ButtonPenStyle.Enabled:= vsfPenStyle in f;
|
|
ButtonPenStyle.Enabled:= vsfPenStyle in f;
|
|
|
|
+ EnableDisableToolButtons([ToolButtonJoinRound,ToolButtonJoinBevel,ToolButtonJoinMiter], vsfJoinStyle in f);
|
|
|
|
|
|
nextControlPos := Point(ControlMargin,4);
|
|
nextControlPos := Point(ControlMargin,4);
|
|
if showSplineStyle then
|
|
if showSplineStyle then
|
|
@@ -1459,6 +1503,7 @@ begin
|
|
result.PenColor := penColor;
|
|
result.PenColor := penColor;
|
|
result.PenWidth := penWidth;
|
|
result.PenWidth := penWidth;
|
|
result.PenStyle := penStyle;
|
|
result.PenStyle := penStyle;
|
|
|
|
+ if vsfJoinStyle in result.Fields then result.JoinStyle := joinStyle;
|
|
if currentTool in[ptClosedCurve,ptPolygon] then
|
|
if currentTool in[ptClosedCurve,ptPolygon] then
|
|
TCustomPolypointShape(result).Closed := true;
|
|
TCustomPolypointShape(result).Closed := true;
|
|
if result is TCurveShape then TCurveShape(result).SplineStyle:= splineStyle;
|
|
if result is TCurveShape then TCurveShape(result).SplineStyle:= splineStyle;
|