You've already forked lazarus-ccr
Adds support for fuzzy effect in the icon editor
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1308 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1207,14 +1207,55 @@ object MainForm: TMainForm
|
|||||||
Layout = tlCenter
|
Layout = tlCenter
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object spinFillAlpha: TSpinEdit
|
object PanelTolerance1: TPanel
|
||||||
Left = 504
|
Left = 494
|
||||||
Height = 21
|
Height = 34
|
||||||
Top = 5
|
Top = 0
|
||||||
Width = 51
|
Width = 68
|
||||||
OnChange = spinFillAlphaChange
|
Align = alLeft
|
||||||
|
BevelOuter = bvNone
|
||||||
|
ClientHeight = 34
|
||||||
|
ClientWidth = 68
|
||||||
TabOrder = 4
|
TabOrder = 4
|
||||||
Value = 100
|
object spinFillAlpha: TSpinEdit
|
||||||
|
Left = 10
|
||||||
|
Height = 21
|
||||||
|
Top = 5
|
||||||
|
Width = 51
|
||||||
|
OnChange = spinFillAlphaChange
|
||||||
|
TabOrder = 0
|
||||||
|
Value = 100
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object LabelTolerance2: TLabel
|
||||||
|
Left = 562
|
||||||
|
Height = 34
|
||||||
|
Top = 0
|
||||||
|
Width = 34
|
||||||
|
Align = alLeft
|
||||||
|
Caption = 'Fuzzy?'
|
||||||
|
Constraints.MinHeight = 32
|
||||||
|
Layout = tlCenter
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
object PanelTolerance2: TPanel
|
||||||
|
Left = 596
|
||||||
|
Height = 34
|
||||||
|
Top = 0
|
||||||
|
Width = 30
|
||||||
|
Align = alLeft
|
||||||
|
BevelOuter = bvNone
|
||||||
|
ClientHeight = 34
|
||||||
|
ClientWidth = 30
|
||||||
|
TabOrder = 5
|
||||||
|
object checkFuzzy: TCheckBox
|
||||||
|
Left = 4
|
||||||
|
Height = 17
|
||||||
|
Top = 9
|
||||||
|
Width = 18
|
||||||
|
OnChange = checkFuzzyChange
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -41,10 +41,14 @@ type
|
|||||||
{ TMainForm }
|
{ TMainForm }
|
||||||
|
|
||||||
TMainForm = class(TForm)
|
TMainForm = class(TForm)
|
||||||
|
checkFuzzy: TCheckBox;
|
||||||
LabelTolerance1: TLabel;
|
LabelTolerance1: TLabel;
|
||||||
|
LabelTolerance2: TLabel;
|
||||||
Palette: TColorPalette;
|
Palette: TColorPalette;
|
||||||
MenuItemShowGrid: TMenuItem;
|
MenuItemShowGrid: TMenuItem;
|
||||||
MenuItemShowPreview: TMenuItem;
|
MenuItemShowPreview: TMenuItem;
|
||||||
|
PanelTolerance1: TPanel;
|
||||||
|
PanelTolerance2: TPanel;
|
||||||
spinFillAlpha: TSpinEdit;
|
spinFillAlpha: TSpinEdit;
|
||||||
ViewShowPreview: TAction;
|
ViewShowPreview: TAction;
|
||||||
ViewShowMask: TAction;
|
ViewShowMask: TAction;
|
||||||
@ -206,6 +210,7 @@ type
|
|||||||
UpDownSize: TUpDown;
|
UpDownSize: TUpDown;
|
||||||
UpDownSize1: TUpDown;
|
UpDownSize1: TUpDown;
|
||||||
UpDownTolerance: TUpDown;
|
UpDownTolerance: TUpDown;
|
||||||
|
procedure checkFuzzyChange(Sender: TObject);
|
||||||
procedure ColorsDisableExecute(Sender: TObject);
|
procedure ColorsDisableExecute(Sender: TObject);
|
||||||
procedure ColorsGrayscaleExecute(Sender: TObject);
|
procedure ColorsGrayscaleExecute(Sender: TObject);
|
||||||
procedure ColorsInvertExecute(Sender: TObject);
|
procedure ColorsInvertExecute(Sender: TObject);
|
||||||
@ -1137,6 +1142,12 @@ begin
|
|||||||
ActivePictureEdit.Disable;
|
ActivePictureEdit.Disable;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.checkFuzzyChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if not Pictures.CanEdit then Exit;
|
||||||
|
ActivePictureEdit.Fuzzy := checkFuzzy.Checked;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMainForm.EditSizeChange(Sender: TObject);
|
procedure TMainForm.EditSizeChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if not Pictures.CanEdit then Exit;
|
if not Pictures.CanEdit then Exit;
|
||||||
|
@ -125,6 +125,7 @@ type
|
|||||||
FFillAndOutline: TDrawMode;
|
FFillAndOutline: TDrawMode;
|
||||||
FFillColor: TColor;
|
FFillColor: TColor;
|
||||||
FFloodFillTolerance: Single;
|
FFloodFillTolerance: Single;
|
||||||
|
FFuzzy: Boolean;
|
||||||
FMaskTool: TMaskTool;
|
FMaskTool: TMaskTool;
|
||||||
FModified: Boolean;
|
FModified: Boolean;
|
||||||
FOnChange: TNotifyEvent;
|
FOnChange: TNotifyEvent;
|
||||||
@ -213,7 +214,8 @@ type
|
|||||||
property Size: Integer read FSize write FSize;
|
property Size: Integer read FSize write FSize;
|
||||||
property Tool: TPictureEditTool read FTool write SetTool;
|
property Tool: TPictureEditTool read FTool write SetTool;
|
||||||
property FillAlpha: Integer read FFillAlpha write FFillAlpha;
|
property FillAlpha: Integer read FFillAlpha write FFillAlpha;
|
||||||
|
property Fuzzy: Boolean read FFuzzy write FFuzzy;
|
||||||
|
|
||||||
property Modified: Boolean read FModified;
|
property Modified: Boolean read FModified;
|
||||||
property OnChange: TNotifyEvent read FOnChange write FOnChange;
|
property OnChange: TNotifyEvent read FOnChange write FOnChange;
|
||||||
property OnColorChange: TNotifyEvent read FOnColorChange write FOnColorChange;
|
property OnColorChange: TNotifyEvent read FOnColorChange write FOnColorChange;
|
||||||
@ -845,7 +847,17 @@ begin
|
|||||||
BeginDraw;
|
BeginDraw;
|
||||||
if not (ssLeft in Shift) then Picture.Canvas.EraseMode := ermErase;
|
if not (ssLeft in Shift) then Picture.Canvas.EraseMode := ermErase;
|
||||||
try
|
try
|
||||||
Picture.Canvas.AlphaRectangle(X1, Y1, X2, Y2, FFillAlpha);
|
if FFuzzy then
|
||||||
|
begin
|
||||||
|
Picture.Canvas.FuzzyRectangle(X1, Y1, X2, Y2);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
if FFillAlpha = 100 then
|
||||||
|
Picture.Canvas.Rectangle(X1, Y1, X2, Y2)
|
||||||
|
else
|
||||||
|
Picture.Canvas.AlphaRectangle(X1, Y1, X2, Y2, FFillAlpha);
|
||||||
|
end;
|
||||||
finally
|
finally
|
||||||
Picture.Canvas.EraseMode := ermNone;
|
Picture.Canvas.EraseMode := ermNone;
|
||||||
EndDraw;
|
EndDraw;
|
||||||
|
@ -154,6 +154,8 @@ type
|
|||||||
procedure MaskFloodFill(X, Y: Integer);
|
procedure MaskFloodFill(X, Y: Integer);
|
||||||
// Alpha drawing methods
|
// Alpha drawing methods
|
||||||
procedure AlphaRectangle(X1, Y1, X2, Y2, AAlpha: Integer);
|
procedure AlphaRectangle(X1, Y1, X2, Y2, AAlpha: Integer);
|
||||||
|
// Effect drawing methods
|
||||||
|
procedure FuzzyRectangle(X1, Y1, X2, Y2: Integer);
|
||||||
public
|
public
|
||||||
procedure DrawTo(ACanvas: TCanvas; X, Y: Integer);
|
procedure DrawTo(ACanvas: TCanvas; X, Y: Integer);
|
||||||
procedure StretchDrawTo(ACanvas: TCanvas; DstX, DstY, DstWidth, DstHeight: Integer);
|
procedure StretchDrawTo(ACanvas: TCanvas; DstX, DstY, DstWidth, DstHeight: Integer);
|
||||||
@ -805,6 +807,19 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TRGB32Canvas.FuzzyRectangle(X1, Y1, X2, Y2: Integer);
|
||||||
|
var
|
||||||
|
X, Y: LongInt;
|
||||||
|
delta: Integer;
|
||||||
|
begin
|
||||||
|
for Y := Y1 + 5 to Y2 - 5 do
|
||||||
|
for X := X1 + 5 to X2 - 5 do
|
||||||
|
begin
|
||||||
|
delta := X mod 5;
|
||||||
|
SetColor(X, Y, GetColor(X - delta, Y - delta));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TRGB32Canvas.DrawTo(ACanvas: TCanvas; X, Y: Integer);
|
procedure TRGB32Canvas.DrawTo(ACanvas: TCanvas; X, Y: Integer);
|
||||||
begin
|
begin
|
||||||
if ACanvas <> nil then
|
if ACanvas <> nil then
|
||||||
|
Reference in New Issue
Block a user