|
@@ -146,6 +146,7 @@ type
|
|
|
|
|
|
|
|
{ TCropArea }
|
|
{ TCropArea }
|
|
|
BoolParent = (bFalse=0, bTrue=1, bParent=2);
|
|
BoolParent = (bFalse=0, bTrue=1, bParent=2);
|
|
|
|
|
+ TCropAreaIcons = set of (cIcoIndex, cIcoLockSize, cIcoLockMove);
|
|
|
|
|
|
|
|
TCropArea = class(TObject)
|
|
TCropArea = class(TObject)
|
|
|
protected
|
|
protected
|
|
@@ -163,6 +164,7 @@ type
|
|
|
rName: String;
|
|
rName: String;
|
|
|
rKeepAspectRatio: BoolParent;
|
|
rKeepAspectRatio: BoolParent;
|
|
|
Loading :Boolean;
|
|
Loading :Boolean;
|
|
|
|
|
+ rIcons: TCropAreaIcons;
|
|
|
|
|
|
|
|
procedure CopyAspectFromParent;
|
|
procedure CopyAspectFromParent;
|
|
|
procedure setAspectRatio(AValue: string);
|
|
procedure setAspectRatio(AValue: string);
|
|
@@ -185,6 +187,7 @@ type
|
|
|
procedure setArea(AValue: TRectF);
|
|
procedure setArea(AValue: TRectF);
|
|
|
procedure setAreaUnit(AValue: TResolutionUnit);
|
|
procedure setAreaUnit(AValue: TResolutionUnit);
|
|
|
procedure setName(AValue: String);
|
|
procedure setName(AValue: String);
|
|
|
|
|
+ procedure setIcons(AValue: TCropAreaIcons);
|
|
|
|
|
|
|
|
procedure Render_Refresh;
|
|
procedure Render_Refresh;
|
|
|
|
|
|
|
@@ -241,6 +244,7 @@ type
|
|
|
property Index:Longint read getIndex;
|
|
property Index:Longint read getIndex;
|
|
|
property Name:String read rName write setName;
|
|
property Name:String read rName write setName;
|
|
|
property isNullSize: Boolean read getIsNullSize;
|
|
property isNullSize: Boolean read getIsNullSize;
|
|
|
|
|
+ property Icons:TCropAreaIcons read rIcons write setIcons;
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
{ TCropAreaList }
|
|
{ TCropAreaList }
|
|
@@ -657,6 +661,13 @@ begin
|
|
|
then fOwner.rOnCropAreaChanged(fOwner, Self);
|
|
then fOwner.rOnCropAreaChanged(fOwner, Self);
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
+procedure TCropArea.setIcons(AValue: TCropAreaIcons);
|
|
|
|
|
+begin
|
|
|
|
|
+ if rIcons=AValue then Exit;
|
|
|
|
|
+ rIcons:=AValue;
|
|
|
|
|
+ Render_Refresh;
|
|
|
|
|
+end;
|
|
|
|
|
+
|
|
|
function TCropArea.getTop: Single;
|
|
function TCropArea.getTop: Single;
|
|
|
begin
|
|
begin
|
|
|
Result :=rArea.Top;
|
|
Result :=rArea.Top;
|
|
@@ -2895,11 +2906,12 @@ procedure TBGRAImageManipulation.Render;
|
|
|
var
|
|
var
|
|
|
WorkRect, emptyRect: TRect;
|
|
WorkRect, emptyRect: TRect;
|
|
|
Mask: TBGRABitmap;
|
|
Mask: TBGRABitmap;
|
|
|
- BorderColor, SelectColor, FillColor: TBGRAPixel;
|
|
|
|
|
|
|
+ BorderColor, SelectColor,
|
|
|
|
|
+ FillColor, IcoColor: TBGRAPixel;
|
|
|
curCropArea :TCropArea;
|
|
curCropArea :TCropArea;
|
|
|
curCropAreaRect :TRect;
|
|
curCropAreaRect :TRect;
|
|
|
i: Integer;
|
|
i: Integer;
|
|
|
- emptyImg: Boolean;
|
|
|
|
|
|
|
+ TextS:TTextStyle;
|
|
|
|
|
|
|
|
begin
|
|
begin
|
|
|
// This procedure render main feature of engine
|
|
// This procedure render main feature of engine
|
|
@@ -2932,11 +2944,22 @@ begin
|
|
|
curCropArea :=rCropAreas[i];
|
|
curCropArea :=rCropAreas[i];
|
|
|
curCropAreaRect :=curCropArea.ScaledArea;
|
|
curCropAreaRect :=curCropArea.ScaledArea;
|
|
|
|
|
|
|
|
|
|
+ //Colors
|
|
|
|
|
+ SelectColor := BGRA(255, 255, 0, 255);
|
|
|
|
|
+ FillColor := BGRA(255, 255, 0, 128);
|
|
|
|
|
+
|
|
|
if (curCropArea = SelectedCropArea)
|
|
if (curCropArea = SelectedCropArea)
|
|
|
- then BorderColor := BGRA(255, 0, 0, 255)
|
|
|
|
|
- else if (curCropArea = rNewCropArea)
|
|
|
|
|
- then BorderColor := BGRA(255, 0, 255, 255)
|
|
|
|
|
- else BorderColor := curCropArea.BorderColor;
|
|
|
|
|
|
|
+ then begin
|
|
|
|
|
+ BorderColor := BGRA(255, 0, 0, 255);
|
|
|
|
|
+ IcoColor :=BorderColor;
|
|
|
|
|
+ end
|
|
|
|
|
+ else begin
|
|
|
|
|
+ if (curCropArea = rNewCropArea)
|
|
|
|
|
+ then BorderColor := BGRA(255, 0, 255, 255)
|
|
|
|
|
+ else BorderColor := curCropArea.BorderColor;
|
|
|
|
|
+
|
|
|
|
|
+ IcoColor :=SelectColor;
|
|
|
|
|
+ end;
|
|
|
|
|
|
|
|
Mask.EraseRectAntialias(curCropAreaRect.Left, curCropAreaRect.Top, curCropAreaRect.Right-1,
|
|
Mask.EraseRectAntialias(curCropAreaRect.Left, curCropAreaRect.Top, curCropAreaRect.Right-1,
|
|
|
curCropAreaRect.Bottom-1, 255);
|
|
curCropAreaRect.Bottom-1, 255);
|
|
@@ -2946,10 +2969,23 @@ begin
|
|
|
Mask.DrawPolyLineAntialias([Point(Left, Top), Point(Right, Top), Point(Right, Bottom), Point(Left, Bottom), Point(Left, Top)],
|
|
Mask.DrawPolyLineAntialias([Point(Left, Top), Point(Right, Top), Point(Right, Bottom), Point(Left, Bottom), Point(Left, Top)],
|
|
|
BorderColor, BGRAPixelTransparent, 1, False);
|
|
BorderColor, BGRAPixelTransparent, 1, False);
|
|
|
|
|
|
|
|
|
|
+ //Draw Icons
|
|
|
|
|
+ if (cIcoIndex in curCropArea.Icons) then
|
|
|
|
|
+ begin
|
|
|
|
|
+ TextS.Alignment:=taCenter;
|
|
|
|
|
+ TextS.SystemFont:=True;
|
|
|
|
|
+ TextS.Layout:=tlCenter;
|
|
|
|
|
+ TextS.SingleLine:=True;
|
|
|
|
|
+ Mask.FontHeight:=12;
|
|
|
|
|
+ Mask.FontStyle:=[fsBold];
|
|
|
|
|
+ Mask.EllipseAntialias(curCropAreaRect.Right-12, curCropAreaRect.Top+12, 4,4, IcoColor, 8);
|
|
|
|
|
+ Mask.TextRect(Rect(curCropAreaRect.Right-18, curCropAreaRect.Top+2, curCropAreaRect.Right-4, curCropAreaRect.Top+24),
|
|
|
|
|
+ curCropAreaRect.Right-12, curCropAreaRect.Top+12,
|
|
|
|
|
+ IntToStr(curCropArea.getIndex), TextS, BGRAWhite);
|
|
|
|
|
+ end;
|
|
|
|
|
+
|
|
|
// Draw anchors
|
|
// Draw anchors
|
|
|
BorderColor := BGRABlack;
|
|
BorderColor := BGRABlack;
|
|
|
- SelectColor := BGRA(255, 255, 0, 255);
|
|
|
|
|
- FillColor := BGRA(255, 255, 0, 128);
|
|
|
|
|
|
|
|
|
|
// NW
|
|
// NW
|
|
|
Mask.Rectangle(curCropAreaRect.Left-fAnchorSize, curCropAreaRect.Top-fAnchorSize,
|
|
Mask.Rectangle(curCropAreaRect.Left-fAnchorSize, curCropAreaRect.Top-fAnchorSize,
|