Unknown 6 éve
szülő
commit
778f225656
3 módosított fájl, 200 hozzáadás és 5 törlés
  1. 150 4
      vectoredit/umain.lfm
  2. 45 0
      vectoredit/umain.pas
  3. 5 1
      vectoredit/uvectororiginal.pas

+ 150 - 4
vectoredit/umain.lfm

@@ -1,7 +1,7 @@
 object Form1: TForm1
-  Left = 375
+  Left = 374
   Height = 475
-  Top = 25
+  Top = 0
   Width = 981
   Caption = 'Vector Edit'
   ClientHeight = 475
@@ -726,6 +726,49 @@ object Form1: TForm1
         DropDownStyle = bdsCommon
         MemoryUsage = bmuHigh
       end
+      object ToolBarJoinStyle: TToolBar
+        Left = 140
+        Height = 26
+        Top = 1
+        Width = 74
+        Align = alNone
+        EdgeBorders = [ebLeft, ebBottom]
+        Images = PenStyleImageList
+        ParentShowHint = False
+        ShowHint = True
+        TabOrder = 2
+        object ToolButtonJoinRound: TToolButton
+          Left = 3
+          Hint = 'Round join'
+          Top = 0
+          Caption = 'ToolButtonJoinRound'
+          Grouped = True
+          ImageIndex = 0
+          OnClick = ToolButtonJoinClick
+          Style = tbsCheck
+        end
+        object ToolButtonJoinBevel: TToolButton
+          Left = 26
+          Hint = 'Bevel join'
+          Top = 0
+          Caption = 'ToolButtonJoinBevel'
+          Down = True
+          Grouped = True
+          ImageIndex = 1
+          OnClick = ToolButtonJoinClick
+          Style = tbsCheck
+        end
+        object ToolButtonJoinMiter: TToolButton
+          Left = 49
+          Hint = 'Miter join'
+          Top = 0
+          Caption = 'ToolButtonJoinMiter'
+          Grouped = True
+          ImageIndex = 2
+          OnClick = ToolButtonJoinClick
+          Style = tbsCheck
+        end
+      end
     end
     object PanelFile: TBCPanel
       Left = 0
@@ -41295,8 +41338,8 @@ object Form1: TForm1
     top = 96
   end
   object BGRAFillImageList16: TBGRAImageList
-    left = 380
-    top = 250
+    left = 536
+    top = 96
     Bitmap = {
       4C691700000010000000100000000000000052521F0097970000333349092E2E
       44052F2F4F000000000000000000000000000000000000008000000077050000
@@ -42172,4 +42215,107 @@ object Form1: TForm1
       0000000000000000F11700000000
     }
   end
+  object PenStyleImageList: TBGRAImageList
+    left = 320
+    top = 160
+    Bitmap = {
+      4C69030000001000000010000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      000000000000F4933104DD852E92C27427F7AF6923FFA06020FF985B1EFF985B
+      1EFF985B1EFF985B1EFFA66321FF000000000000000000000000000000000000
+      0000E78B2E76B26A23FFB06A23FFD8812BFFED8E2FFFF99532FFFF9933FFFF99
+      33FFFF9933FFFF9933FFFF9933FF00000000000000000000000000000000E086
+      2D7DA36120FFDB832CFFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF99
+      33FFFF9933FFFF9933FFFF9933FF000000000000000000000000C576270BA362
+      20FFE88B2EFFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF99
+      33FFFF9933FFFF9933FFFF9933FF000000000000000000000000C97A2B9EC677
+      27FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF99
+      33FFFF9933FFFF9933FFFF9933FF000000000000000000000000B96F25F9E288
+      2DFFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF99
+      33FFFF9933FFFF9933FFFF9933FF000000000000000000000000A96521FFF291
+      30FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF99
+      33FFFF9933FFFF9933FFFF9933FF000000000000000000000000A16120FFF895
+      32FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF99
+      33FFFF9933FFFF9933FFFF9933FF0000000000000000000000009C5D1FFFFD98
+      33FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFA16120FF985B
+      1EFF985B1EFF985B1EFF9B5D1FFF0000000000000000000000009A5C1EFFFE98
+      33FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FF985B1EFF0000
+      0000000000000000000000000000000000000000000000000000995C1EFFFE99
+      33FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FF985B1EFF0000
+      0000000000000000000000000000000000000000000000000000995C1EFFFF99
+      33FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FF985B1EFF0000
+      0000000000000000000000000000000000000000000000000000A96522FFFF99
+      33FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFA96522FF0000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      00000000000000000000985B1E3F9C5D1FF8985B1EFF985B1EFF985B1EFF985B
+      1EFF985B1EFF985B1EFFA96522FF000000000000000000000000000000000000
+      000000000000985B1E409E5E1FF4E88B2EFFFF9933FFFF9933FFFF9933FFFF99
+      33FFFF9933FFFF9933FFFF9933FF000000000000000000000000000000000000
+      0000985B1E409E5E1FF4E88B2EFFFF9933FFFF9933FFFF9933FFFF9933FFFF99
+      33FFFF9933FFFF9933FFFF9933FF00000000000000000000000000000000985B
+      1E409E5E1FF4E88B2EFFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF99
+      33FFFF9933FFFF9933FFFF9933FF000000000000000000000000985B1E409E5E
+      1FF4E88B2EFFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF99
+      33FFFF9933FFFF9933FFFF9933FF0000000000000000000000009C5D1FF8E98C
+      2EFFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF99
+      33FFFF9933FFFF9933FFFF9933FF000000000000000000000000985B1EFFFF99
+      33FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF99
+      33FFFF9933FFFF9933FFFF9933FF000000000000000000000000985B1EFFFF99
+      33FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF99
+      33FFFF9933FFFF9933FFFF9933FF000000000000000000000000985B1EFFFF99
+      33FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFA16120FF985B
+      1EFF985B1EFF985B1EFFA96522FF000000000000000000000000985B1EFFFF99
+      33FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FF985B1EFF0000
+      0000000000000000000000000000000000000000000000000000985B1EFFFF99
+      33FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FF985B1EFF0000
+      0000000000000000000000000000000000000000000000000000985B1EFFFF99
+      33FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FF985B1EFF0000
+      0000000000000000000000000000000000000000000000000000A96522FFFF99
+      33FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFA96522FF0000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000A16120FF985B
+      1EFF985B1EFF985B1EFF985B1EFF985B1EFF985B1EFF985B1EFF985B1EFF985B
+      1EFF985B1EFF985B1EFFA96522FF000000000000000000000000985B1EFFFF99
+      33FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF99
+      33FFFF9933FFFF9933FFFF9933FF000000000000000000000000985B1EFFFF99
+      33FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF99
+      33FFFF9933FFFF9933FFFF9933FF000000000000000000000000985B1EFFFF99
+      33FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF99
+      33FFFF9933FFFF9933FFFF9933FF000000000000000000000000985B1EFFFF99
+      33FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF99
+      33FFFF9933FFFF9933FFFF9933FF000000000000000000000000985B1EFFFF99
+      33FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF99
+      33FFFF9933FFFF9933FFFF9933FF000000000000000000000000985B1EFFFF99
+      33FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF99
+      33FFFF9933FFFF9933FFFF9933FF000000000000000000000000985B1EFFFF99
+      33FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF99
+      33FFFF9933FFFF9933FFFF9933FF000000000000000000000000985B1EFFFF99
+      33FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFA16120FF985B
+      1EFF985B1EFF985B1EFFA96522FF000000000000000000000000985B1EFFFF99
+      33FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FF985B1EFF0000
+      0000000000000000000000000000000000000000000000000000985B1EFFFF99
+      33FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FF985B1EFF0000
+      0000000000000000000000000000000000000000000000000000985B1EFFFF99
+      33FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FF985B1EFF0000
+      0000000000000000000000000000000000000000000000000000A96522FFFF99
+      33FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFFF9933FFA96522FF0000
+      0000000000000000000000000000
+    }
+  end
 end

+ 45 - 0
vectoredit/umain.pas

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

+ 5 - 1
vectoredit/uvectororiginal.pas

@@ -539,7 +539,11 @@ end;
 
 function TVectorShape.GetStroker: TBGRAPenStroker;
 begin
-  if FStroker = nil then FStroker := TBGRAPenStroker.Create;
+  if FStroker = nil then
+  begin
+    FStroker := TBGRAPenStroker.Create;
+    FStroker.MiterLimit:= sqrt(2);
+  end;
   result := FStroker;
 end;