|
@@ -6,7 +6,7 @@ interface
|
|
|
|
|
|
uses
|
|
uses
|
|
Classes, SysUtils, LCLType, BGRABitmap, BGRABitmapTypes,
|
|
Classes, SysUtils, LCLType, BGRABitmap, BGRABitmapTypes,
|
|
- BGRALayerOriginal, BGRAGraphics, LCVectorOriginal,
|
|
|
|
|
|
+ BGRALayerOriginal, BGRAGraphics, LCVectorOriginal, LCVectorialFill,
|
|
UTool, UImageType, ULayerAction, LCVectorRectShapes,
|
|
UTool, UImageType, ULayerAction, LCVectorRectShapes,
|
|
BGRAGradientOriginal, UStateType;
|
|
BGRAGradientOriginal, UStateType;
|
|
|
|
|
|
@@ -41,7 +41,7 @@ type
|
|
function UseOriginal: boolean; virtual;
|
|
function UseOriginal: boolean; virtual;
|
|
function GetCustomShapeBounds(ADestBounds: TRect; AMatrix: TAffineMatrix; {%H-}ADraft: boolean): TRect; virtual;
|
|
function GetCustomShapeBounds(ADestBounds: TRect; AMatrix: TAffineMatrix; {%H-}ADraft: boolean): TRect; virtual;
|
|
procedure DrawCustomShape(ADest: TBGRABitmap; AMatrix: TAffineMatrix; ADraft: boolean); virtual;
|
|
procedure DrawCustomShape(ADest: TBGRABitmap; AMatrix: TAffineMatrix; ADraft: boolean); virtual;
|
|
- procedure AssignShapeStyle(AMatrix: TAffineMatrix); virtual;
|
|
|
|
|
|
+ procedure AssignShapeStyle(AMatrix: TAffineMatrix; AAlwaysFit: boolean); virtual;
|
|
procedure QuickDefineShape(AStart,AEnd: TPointF); virtual;
|
|
procedure QuickDefineShape(AStart,AEnd: TPointF); virtual;
|
|
function RoundCoordinate(ptF: TPointF): TPointF; virtual;
|
|
function RoundCoordinate(ptF: TPointF): TPointF; virtual;
|
|
function GetIsSelectingTool: boolean; override;
|
|
function GetIsSelectingTool: boolean; override;
|
|
@@ -140,9 +140,11 @@ type
|
|
property CurrentSplineMode: TToolSplineMode read GetCurrentSplineMode write SetCurrentSplineMode;
|
|
property CurrentSplineMode: TToolSplineMode read GetCurrentSplineMode write SetCurrentSplineMode;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure AssignFill(ATarget, ASource: TVectorialFill; const ABox: TAffineBox; AAlwaysFit: boolean);
|
|
|
|
+
|
|
implementation
|
|
implementation
|
|
|
|
|
|
-uses LazPaintType, LCVectorPolyShapes, LCVectorTextShapes, LCVectorialFill, BGRASVGOriginal,
|
|
|
|
|
|
+uses LazPaintType, LCVectorPolyShapes, LCVectorTextShapes, BGRASVGOriginal,
|
|
ULoading, BGRATransform, math, UImageDiff, Controls, BGRAPen, UResourceStrings, ugraph,
|
|
ULoading, BGRATransform, math, UImageDiff, Controls, BGRAPen, UResourceStrings, ugraph,
|
|
LCScaleDPI, LCVectorClipboard, BGRAGradientScanner, UClipboard;
|
|
LCScaleDPI, LCVectorClipboard, BGRAGradientScanner, UClipboard;
|
|
|
|
|
|
@@ -201,12 +203,12 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure AssignFill(ATarget, ASource: TVectorialFill; const ABox: TAffineBox);
|
|
|
|
|
|
+procedure AssignFill(ATarget, ASource: TVectorialFill; const ABox: TAffineBox; AAlwaysFit: boolean);
|
|
var
|
|
var
|
|
temp: TVectorialFill;
|
|
temp: TVectorialFill;
|
|
begin
|
|
begin
|
|
if ASource.IsFullyTransparent then ATarget.Clear
|
|
if ASource.IsFullyTransparent then ATarget.Clear
|
|
- else if ATarget.FillType <> ASource.FillType then
|
|
|
|
|
|
+ else if (ATarget.FillType <> ASource.FillType) or AAlwaysFit then
|
|
begin
|
|
begin
|
|
temp := ATarget.Duplicate;
|
|
temp := ATarget.Duplicate;
|
|
temp.AssignExceptGeometry(ASource);
|
|
temp.AssignExceptGeometry(ASource);
|
|
@@ -511,10 +513,10 @@ begin
|
|
doDraw := vsfPenFill in SelectedShape.Fields;
|
|
doDraw := vsfPenFill in SelectedShape.Fields;
|
|
doFill := vsfBackFill in SelectedShape.Fields;
|
|
doFill := vsfBackFill in SelectedShape.Fields;
|
|
end;
|
|
end;
|
|
- if doFill then AssignFill(SelectedShape.BackFill, Manager.BackFill, gradBox)
|
|
|
|
|
|
+ if doFill then AssignFill(SelectedShape.BackFill, Manager.BackFill, gradBox, false)
|
|
else if vsfBackFill in SelectedShape.Fields then
|
|
else if vsfBackFill in SelectedShape.Fields then
|
|
SelectedShape.BackFill.Clear;
|
|
SelectedShape.BackFill.Clear;
|
|
- if doDraw then AssignFill(SelectedShape.PenFill, Manager.ForeFill, gradBox);
|
|
|
|
|
|
+ if doDraw then AssignFill(SelectedShape.PenFill, Manager.ForeFill, gradBox, false);
|
|
|
|
|
|
if SelectedShape is TTextShape then
|
|
if SelectedShape is TTextShape then
|
|
with TTextShape(SelectedShape) do
|
|
with TTextShape(SelectedShape) do
|
|
@@ -529,7 +531,7 @@ begin
|
|
if Manager.TextOutline then
|
|
if Manager.TextOutline then
|
|
begin
|
|
begin
|
|
OutlineWidth := Manager.TextOutlineWidth;
|
|
OutlineWidth := Manager.TextOutlineWidth;
|
|
- AssignFill(OutLineFill, Manager.BackFill, gradBox);
|
|
|
|
|
|
+ AssignFill(OutLineFill, Manager.BackFill, gradBox, false);
|
|
end else
|
|
end else
|
|
OutlineFill.Clear;
|
|
OutlineFill.Clear;
|
|
end;
|
|
end;
|
|
@@ -1551,7 +1553,7 @@ begin
|
|
FShape.Render(ADest,AMatrix,ADraft);
|
|
FShape.Render(ADest,AMatrix,ADraft);
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TVectorialTool.AssignShapeStyle(AMatrix: TAffineMatrix);
|
|
|
|
|
|
+procedure TVectorialTool.AssignShapeStyle(AMatrix: TAffineMatrix; AAlwaysFit: boolean);
|
|
var
|
|
var
|
|
f: TVectorShapeFields;
|
|
f: TVectorShapeFields;
|
|
zoom: Single;
|
|
zoom: Single;
|
|
@@ -1565,9 +1567,9 @@ begin
|
|
if Manager.ShapeOptionDraw then
|
|
if Manager.ShapeOptionDraw then
|
|
begin
|
|
begin
|
|
if FSwapColor then
|
|
if FSwapColor then
|
|
- AssignFill(FShape.PenFill, Manager.BackFill, gradBox)
|
|
|
|
|
|
+ AssignFill(FShape.PenFill, Manager.BackFill, gradBox, AAlwaysFit)
|
|
else
|
|
else
|
|
- AssignFill(FShape.PenFill, Manager.ForeFill, gradBox);
|
|
|
|
|
|
+ AssignFill(FShape.PenFill, Manager.ForeFill, gradBox, AAlwaysFit);
|
|
end else
|
|
end else
|
|
FShape.PenFill.Clear;
|
|
FShape.PenFill.Clear;
|
|
end;
|
|
end;
|
|
@@ -1579,9 +1581,9 @@ begin
|
|
if Manager.ShapeOptionFill then
|
|
if Manager.ShapeOptionFill then
|
|
begin
|
|
begin
|
|
if FSwapColor then
|
|
if FSwapColor then
|
|
- AssignFill(FShape.BackFill, Manager.ForeFill, gradBox)
|
|
|
|
|
|
+ AssignFill(FShape.BackFill, Manager.ForeFill, gradBox, AAlwaysFit)
|
|
else
|
|
else
|
|
- AssignFill(FShape.BackFill, Manager.BackFill, gradBox);
|
|
|
|
|
|
+ AssignFill(FShape.BackFill, Manager.BackFill, gradBox, AAlwaysFit);
|
|
end else
|
|
end else
|
|
FShape.BackFill.Clear;
|
|
FShape.BackFill.Clear;
|
|
end;
|
|
end;
|
|
@@ -1704,7 +1706,7 @@ begin
|
|
shapePt := AffineMatrixInverse(VectorTransform(true))*FLastPos;
|
|
shapePt := AffineMatrixInverse(VectorTransform(true))*FLastPos;
|
|
handled := false;
|
|
handled := false;
|
|
FShape.MouseMove(FShiftState, shapePt.X,shapePt.Y, cur, handled);
|
|
FShape.MouseMove(FShiftState, shapePt.X,shapePt.Y, cur, handled);
|
|
- AssignShapeStyle(FLastShapeTransform);
|
|
|
|
|
|
+ AssignShapeStyle(FLastShapeTransform, true);
|
|
FShape.EndUpdate;
|
|
FShape.EndUpdate;
|
|
FShape.OnChange:= @ShapeChange;
|
|
FShape.OnChange:= @ShapeChange;
|
|
FShape.OnEditingChange:=@ShapeEditingChange;
|
|
FShape.OnEditingChange:=@ShapeEditingChange;
|
|
@@ -1741,7 +1743,7 @@ begin
|
|
QuickDefineShape(FQuickDefineStartPoint, FQuickDefineEndPoint);
|
|
QuickDefineShape(FQuickDefineStartPoint, FQuickDefineEndPoint);
|
|
FLastShapeTransform := AffineMatrixInverse(VectorTransform(false));
|
|
FLastShapeTransform := AffineMatrixInverse(VectorTransform(false));
|
|
FShape.Transform(FLastShapeTransform);
|
|
FShape.Transform(FLastShapeTransform);
|
|
- AssignShapeStyle(FLastShapeTransform);
|
|
|
|
|
|
+ AssignShapeStyle(FLastShapeTransform, true);
|
|
FShape.EndUpdate;
|
|
FShape.EndUpdate;
|
|
result := OnlyRenderChange;
|
|
result := OnlyRenderChange;
|
|
end else
|
|
end else
|
|
@@ -1764,7 +1766,7 @@ begin
|
|
if Assigned(FShape) then
|
|
if Assigned(FShape) then
|
|
begin
|
|
begin
|
|
FShape.BeginUpdate;
|
|
FShape.BeginUpdate;
|
|
- AssignShapeStyle(FLastShapeTransform);
|
|
|
|
|
|
+ AssignShapeStyle(FLastShapeTransform, false);
|
|
FShape.EndUpdate;
|
|
FShape.EndUpdate;
|
|
end;
|
|
end;
|
|
result := EmptyRect;
|
|
result := EmptyRect;
|