You've already forked lazarus-ccr
Add text to image.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1598 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -6,7 +6,8 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, LCLType, LCLIntf, LMessages, LCLProc, Controls, Graphics,
|
Classes, SysUtils, LCLType, LCLIntf, LMessages, LCLProc, Controls, Graphics,
|
||||||
Forms, Types, IntfGraphics, FPImage, Math, FPImgCanv, FPCanvas, ClipBrd;
|
Forms, Types, IntfGraphics, FPImage, Math, FPImgCanv, FPCanvas, StdCtrls,
|
||||||
|
ClipBrd, ExtCtrls;
|
||||||
|
|
||||||
type
|
type
|
||||||
tagRGBATRIPLE = record
|
tagRGBATRIPLE = record
|
||||||
@@ -72,6 +73,41 @@ type
|
|||||||
property PaperColor: TColor read GetPaperColor write SetPaperColor;
|
property PaperColor: TColor read GetPaperColor write SetPaperColor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TTextEditor = class;
|
||||||
|
|
||||||
|
TTextEdit = class(TCustomEdit)
|
||||||
|
private
|
||||||
|
FCanvas: TCanvas;
|
||||||
|
protected
|
||||||
|
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
|
||||||
|
public
|
||||||
|
Editor: TTextEditor;
|
||||||
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
destructor Destroy; override;
|
||||||
|
procedure EraseBackground(DC: HDC); override;
|
||||||
|
property Canvas: TCanvas read FCanvas write FCanvas;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TTextEditor = class(TCustomControl)
|
||||||
|
private
|
||||||
|
FEdit: TTextEdit;
|
||||||
|
FTimer: TIdleTimer;
|
||||||
|
flashnum: integer;
|
||||||
|
protected
|
||||||
|
procedure Paint; override;
|
||||||
|
procedure DrawFlashLine(Sender: TObject);
|
||||||
|
procedure Changing(Sender: TObject);
|
||||||
|
public
|
||||||
|
IMGCanvas: TCanvas;
|
||||||
|
PositionIndex, StartX, StartY, TextX, TextY: integer;
|
||||||
|
procedure StartEdit(ContainerX, ContainerY, IMGX, IMGY: integer);
|
||||||
|
procedure StopEdit;
|
||||||
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
destructor Destroy; override;
|
||||||
|
procedure EraseBackground(DC: HDC); override;
|
||||||
|
property Editor: TTextEdit read FEdit write FEdit;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure LazBMPRotate90(const aBitmap: TDLBitmap; IsTurnRight: boolean);
|
procedure LazBMPRotate90(const aBitmap: TDLBitmap; IsTurnRight: boolean);
|
||||||
procedure BMPRotate90(const Bitmap: TDLBitmap);
|
procedure BMPRotate90(const Bitmap: TDLBitmap);
|
||||||
procedure DrawSamePixel(ABitmap: TDLBitmap; Value: integer);
|
procedure DrawSamePixel(ABitmap: TDLBitmap; Value: integer);
|
||||||
@@ -85,10 +121,10 @@ procedure ChangeRGB(SrcBmp: TDLBitmap; RedChange, GreenChange, BlueChange: integ
|
|||||||
procedure ChangeBrightness(SrcBmp: TDLBitmap; ValueChange: integer);
|
procedure ChangeBrightness(SrcBmp: TDLBitmap; ValueChange: integer);
|
||||||
procedure ChangeContrast(SrcBmp: TDLBitmap; ValueChange: integer);
|
procedure ChangeContrast(SrcBmp: TDLBitmap; ValueChange: integer);
|
||||||
procedure SprayPoints(DLBmp: TDLBitmap; X, Y: integer; Radians: integer; PColor: TColor);
|
procedure SprayPoints(DLBmp: TDLBitmap; X, Y: integer; Radians: integer; PColor: TColor);
|
||||||
function GetRColor(const Color: TColor): Byte;
|
function GetRColor(const Color: TColor): byte;
|
||||||
function GetGColor(const Color: TColor): Byte;
|
function GetGColor(const Color: TColor): byte;
|
||||||
function GetBColor(const Color: TColor): Byte;
|
function GetBColor(const Color: TColor): byte;
|
||||||
procedure SprayPoints(aCanvas: TCanvas; X, Y: integer; Radians: Integer; PColor: TColor);
|
procedure SprayPoints(aCanvas: TCanvas; X, Y: integer; Radians: integer; PColor: TColor);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@@ -386,5 +422,132 @@ begin
|
|||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
constructor TTextEdit.Create(AOwner: TComponent);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
BorderStyle := bsNone;
|
||||||
|
Width := 1;
|
||||||
|
Parent := TWinControl(AOwner);
|
||||||
|
FCanvas := TCanvas.Create;
|
||||||
|
FCanvas.Handle := GetDC(Self.Handle);
|
||||||
|
FCanvas.Brush.Style := bsClear;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TTextEdit.Destroy;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
FCanvas.Free;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TTextEdit.EraseBackground(DC: HDC);
|
||||||
|
begin
|
||||||
|
inherited EraseBackground(DC);
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TTextEdit.KeyDown(var Key: Word; Shift: TShiftState);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
if Editor.PositionIndex <> SelStart then
|
||||||
|
begin
|
||||||
|
Editor.PositionIndex := Length(Text); //SelStart;
|
||||||
|
Editor.DrawFlashLine(nil);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TTextEditor.Create(AOwner: TComponent);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
BorderStyle := bsNone;
|
||||||
|
Width := 1;
|
||||||
|
Height := 16;
|
||||||
|
Parent := TWinControl(AOwner);
|
||||||
|
FEdit := TTextEdit.Create(AOwner);
|
||||||
|
FEdit.Parent := Self;
|
||||||
|
FEdit.Left := 3;
|
||||||
|
FEdit.Top := 0;
|
||||||
|
FEdit.Editor := Self;
|
||||||
|
FEdit.Show;
|
||||||
|
FTimer := TIdleTimer.Create(AOwner);
|
||||||
|
FTimer.OnTimer := @DrawFlashLine;
|
||||||
|
FTimer.Interval := 500;
|
||||||
|
FTimer.Enabled := False;
|
||||||
|
FEdit.OnChange := @Changing;
|
||||||
|
Visible := False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TTextEditor.Destroy;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
FEdit.Free;
|
||||||
|
FTimer.Free;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TTextEditor.EraseBackground(DC: HDC);
|
||||||
|
begin
|
||||||
|
inherited EraseBackground(DC);
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TTextEditor.Paint;
|
||||||
|
begin
|
||||||
|
inherited Paint;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TTextEditor.DrawFlashLine(Sender: TObject);
|
||||||
|
var FlashLeft: integer; LeftText: string;
|
||||||
|
begin
|
||||||
|
FEdit.SetFocus;
|
||||||
|
flashnum := flashnum + 1;
|
||||||
|
if flashnum > 1000 then
|
||||||
|
flashnum := 0;
|
||||||
|
if flashnum mod 2 = 0 then
|
||||||
|
Canvas.Pen.Color := clWhite
|
||||||
|
else
|
||||||
|
Canvas.Pen.Color := clBlack;
|
||||||
|
LeftText := Copy(FEdit.Text, 1, PositionIndex);
|
||||||
|
FlashLeft := StartX + Canvas.TextWidth(LeftText);
|
||||||
|
Left := FlashLeft;
|
||||||
|
Top := StartY;
|
||||||
|
Canvas.Line(0, 0, 0, Height);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TTextEditor.StartEdit(ContainerX, ContainerY, IMGX, IMGY: integer);
|
||||||
|
begin
|
||||||
|
if IMGCanvas = nil then
|
||||||
|
Exit;
|
||||||
|
Left := ContainerX;
|
||||||
|
Top := ContainerY;
|
||||||
|
StartX := ContainerX;
|
||||||
|
StartY := ContainerY;
|
||||||
|
TextX := IMGX;
|
||||||
|
TextY := IMGY;
|
||||||
|
FEdit.Text := '';
|
||||||
|
Show;
|
||||||
|
FTimer.Enabled := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TTextEditor.StopEdit;
|
||||||
|
begin
|
||||||
|
FTimer.Enabled := False;
|
||||||
|
Hide;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TTextEditor.Changing(Sender: TObject);
|
||||||
|
var TextLeft: integer; LeftText, RightText: string;
|
||||||
|
begin
|
||||||
|
LeftText := Copy(FEdit.Text, 1, PositionIndex);
|
||||||
|
RightText := Copy(FEdit.Text, PositionIndex + 1, Length(FEdit.text));
|
||||||
|
TextLeft := TextX + Canvas.TextWidth(LeftText);
|
||||||
|
if IMGCanvas = nil then
|
||||||
|
Exit;
|
||||||
|
//IMGCanvas.TextOut(22, 22, FEdit.Text);
|
||||||
|
IMGCanvas.Brush.Style := bsClear;
|
||||||
|
IMGCanvas.TextOut(TextLeft, TextY, RightText);
|
||||||
|
//if PositionIndex <> FEdit.SelStart then
|
||||||
|
// PositionIndex := FEdit.SelStart;
|
||||||
|
PositionIndex := Length(FEdit.Text);
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@@ -560,7 +560,7 @@ end;
|
|||||||
|
|
||||||
procedure SprayPoints(aCanvas: TCanvas; X, Y: integer; Radians: Integer; PColor: TColor);
|
procedure SprayPoints(aCanvas: TCanvas; X, Y: integer; Radians: Integer; PColor: TColor);
|
||||||
var
|
var
|
||||||
i, a, b, temp, ci, center: Integer;
|
i, a, b, temp, ci, center, Radian2, Radian3: Integer;
|
||||||
begin
|
begin
|
||||||
if aCanvas = nil then
|
if aCanvas = nil then
|
||||||
Exit;
|
Exit;
|
||||||
@@ -574,36 +574,26 @@ begin
|
|||||||
b := Random(Round(Radians * 0.65));
|
b := Random(Round(Radians * 0.65));
|
||||||
if (temp < 50) then b := 0 - b;
|
if (temp < 50) then b := 0 - b;
|
||||||
if (a * a + b * b < Sqr(Round(Radians * 0.65))) then
|
if (a * a + b * b < Sqr(Round(Radians * 0.65))) then
|
||||||
begin
|
|
||||||
aCanvas.Pixels[X + a, Y + b] := PColor;
|
aCanvas.Pixels[X + a, Y + b] := PColor;
|
||||||
end;
|
Radian2 := Radians div 3;
|
||||||
end;
|
|
||||||
for i := 0 to Radians div 3 do
|
|
||||||
begin
|
|
||||||
temp := Random(100);
|
temp := Random(100);
|
||||||
a := Random(Round(Radians * 0.65));
|
a := Random(Round(Radian2 * 0.65));
|
||||||
if (temp < 50) then a := 0 - a;
|
if (temp < 50) then a := 0 - a;
|
||||||
temp := Random(100);
|
temp := Random(100);
|
||||||
b := Random(Round(Radians * 0.65));
|
b := Random(Round(Radian2 * 0.65));
|
||||||
if (temp < 50) then b := 0 - b;
|
if (temp < 50) then b := 0 - b;
|
||||||
if (a * a + b * b < Sqr(Round(Radians * 0.65))) then
|
if (a * a + b * b < Sqr(Round(Radian2 * 0.65))) then
|
||||||
begin
|
|
||||||
aCanvas.Pixels[X + a, Y + b] := PColor;
|
aCanvas.Pixels[X + a, Y + b] := PColor;
|
||||||
end;
|
Radian3 := Radians * 2 div 3;
|
||||||
end;
|
|
||||||
for i := 0 to Radians * 2 div 3 do
|
|
||||||
begin
|
|
||||||
temp := Random(100);
|
temp := Random(100);
|
||||||
a := Random(Round(Radians * 0.65));
|
a := Random(Round(Radian3 * 0.65));
|
||||||
if (temp < 50) then a := 0 - a;
|
if (temp < 50) then a := 0 - a;
|
||||||
temp := Random(100);
|
temp := Random(100);
|
||||||
b := Random(Round(Radians * 0.65));
|
b := Random(Round(Radian3 * 0.65));
|
||||||
if (temp < 50) then b := 0 - b;
|
if (temp < 50) then b := 0 - b;
|
||||||
if (a * a + b * b < Sqr(Round(Radians * 0.65))) then
|
if (a * a + b * b < Sqr(Round(Radian3 * 0.65))) then
|
||||||
begin
|
|
||||||
aCanvas.Pixels[X + a, Y + b] := PColor;
|
aCanvas.Pixels[X + a, Y + b] := PColor;
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -50,7 +50,7 @@
|
|||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="1"/>
|
||||||
<CursorPos X="14" Y="4"/>
|
<CursorPos X="14" Y="4"/>
|
||||||
<UsageCount Value="68"/>
|
<UsageCount Value="72"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit0>
|
</Unit0>
|
||||||
<Unit1>
|
<Unit1>
|
||||||
@@ -60,23 +60,23 @@
|
|||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="Main"/>
|
<UnitName Value="Main"/>
|
||||||
|
<IsVisibleTab Value="True"/>
|
||||||
<EditorIndex Value="0"/>
|
<EditorIndex Value="0"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="224"/>
|
<TopLine Value="823"/>
|
||||||
<CursorPos X="29" Y="251"/>
|
<CursorPos X="25" Y="842"/>
|
||||||
<UsageCount Value="68"/>
|
<UsageCount Value="72"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
<LoadedDesigner Value="True"/>
|
<LoadedDesigner Value="True"/>
|
||||||
</Unit1>
|
</Unit1>
|
||||||
<Unit2>
|
<Unit2>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<UnitName Value="PictureCtrls"/>
|
<UnitName Value="PictureCtrls"/>
|
||||||
<IsVisibleTab Value="True"/>
|
|
||||||
<EditorIndex Value="5"/>
|
<EditorIndex Value="5"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="1031"/>
|
<TopLine Value="667"/>
|
||||||
<CursorPos X="39" Y="1047"/>
|
<CursorPos X="12" Y="684"/>
|
||||||
<UsageCount Value="30"/>
|
<UsageCount Value="31"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit2>
|
</Unit2>
|
||||||
<Unit3>
|
<Unit3>
|
||||||
@@ -172,8 +172,8 @@
|
|||||||
<Filename Value="T:\fpclaz\laz\lcl\graphics.pp"/>
|
<Filename Value="T:\fpclaz\laz\lcl\graphics.pp"/>
|
||||||
<UnitName Value="Graphics"/>
|
<UnitName Value="Graphics"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="1086"/>
|
<TopLine Value="1133"/>
|
||||||
<CursorPos X="15" Y="1102"/>
|
<CursorPos X="81" Y="1149"/>
|
||||||
<UsageCount Value="10"/>
|
<UsageCount Value="10"/>
|
||||||
</Unit12>
|
</Unit12>
|
||||||
<Unit13>
|
<Unit13>
|
||||||
@@ -181,9 +181,9 @@
|
|||||||
<UnitName Value="PictureManager"/>
|
<UnitName Value="PictureManager"/>
|
||||||
<EditorIndex Value="2"/>
|
<EditorIndex Value="2"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="268"/>
|
||||||
<CursorPos X="100" Y="4"/>
|
<CursorPos X="100" Y="4"/>
|
||||||
<UsageCount Value="31"/>
|
<UsageCount Value="32"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit13>
|
</Unit13>
|
||||||
<Unit14>
|
<Unit14>
|
||||||
@@ -336,8 +336,8 @@
|
|||||||
<Filename Value="T:\fpclaz\laz\lcl\forms.pp"/>
|
<Filename Value="T:\fpclaz\laz\lcl\forms.pp"/>
|
||||||
<UnitName Value="Forms"/>
|
<UnitName Value="Forms"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="597"/>
|
<TopLine Value="176"/>
|
||||||
<CursorPos X="14" Y="607"/>
|
<CursorPos X="3" Y="195"/>
|
||||||
<UsageCount Value="10"/>
|
<UsageCount Value="10"/>
|
||||||
</Unit32>
|
</Unit32>
|
||||||
<Unit33>
|
<Unit33>
|
||||||
@@ -360,9 +360,9 @@
|
|||||||
<UnitName Value="DLBitmap"/>
|
<UnitName Value="DLBitmap"/>
|
||||||
<EditorIndex Value="3"/>
|
<EditorIndex Value="3"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="351"/>
|
<TopLine Value="514"/>
|
||||||
<CursorPos X="19" Y="380"/>
|
<CursorPos X="54" Y="541"/>
|
||||||
<UsageCount Value="13"/>
|
<UsageCount Value="14"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit35>
|
</Unit35>
|
||||||
<Unit36>
|
<Unit36>
|
||||||
@@ -385,17 +385,17 @@
|
|||||||
<Filename Value="T:\fpclaz\laz\lcl\controls.pp"/>
|
<Filename Value="T:\fpclaz\laz\lcl\controls.pp"/>
|
||||||
<UnitName Value="Controls"/>
|
<UnitName Value="Controls"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="48"/>
|
<TopLine Value="956"/>
|
||||||
<CursorPos X="29" Y="64"/>
|
<CursorPos X="14" Y="975"/>
|
||||||
<UsageCount Value="10"/>
|
<UsageCount Value="10"/>
|
||||||
</Unit38>
|
</Unit38>
|
||||||
<Unit39>
|
<Unit39>
|
||||||
<Filename Value="DLBmpUtils.inc"/>
|
<Filename Value="DLBmpUtils.inc"/>
|
||||||
<EditorIndex Value="4"/>
|
<EditorIndex Value="4"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="509"/>
|
<TopLine Value="561"/>
|
||||||
<CursorPos X="28" Y="543"/>
|
<CursorPos X="32" Y="562"/>
|
||||||
<UsageCount Value="11"/>
|
<UsageCount Value="12"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit39>
|
</Unit39>
|
||||||
<Unit40>
|
<Unit40>
|
||||||
@@ -409,124 +409,124 @@
|
|||||||
</Units>
|
</Units>
|
||||||
<JumpHistory Count="30" HistoryIndex="29">
|
<JumpHistory Count="30" HistoryIndex="29">
|
||||||
<Position1>
|
<Position1>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="683" Column="54" TopLine="667"/>
|
<Caret Line="818" Column="22" TopLine="786"/>
|
||||||
</Position1>
|
</Position1>
|
||||||
<Position2>
|
<Position2>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="1015" Column="36" TopLine="994"/>
|
<Caret Line="819" Column="16" TopLine="787"/>
|
||||||
</Position2>
|
</Position2>
|
||||||
<Position3>
|
<Position3>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="1038" Column="20" TopLine="1022"/>
|
<Caret Line="820" Column="19" TopLine="788"/>
|
||||||
</Position3>
|
</Position3>
|
||||||
<Position4>
|
<Position4>
|
||||||
<Filename Value="DLBitmap.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="375" Column="24" TopLine="354"/>
|
<Caret Line="821" Column="22" TopLine="789"/>
|
||||||
</Position4>
|
</Position4>
|
||||||
<Position5>
|
<Position5>
|
||||||
<Filename Value="DLBmpUtils.inc"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="490" Column="41" TopLine="480"/>
|
<Caret Line="822" Column="18" TopLine="790"/>
|
||||||
</Position5>
|
</Position5>
|
||||||
<Position6>
|
<Position6>
|
||||||
<Filename Value="DLBmpUtils.inc"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="507" Column="29" TopLine="497"/>
|
<Caret Line="823" Column="17" TopLine="791"/>
|
||||||
</Position6>
|
</Position6>
|
||||||
<Position7>
|
<Position7>
|
||||||
<Filename Value="DLBitmap.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="87" Column="54" TopLine="65"/>
|
<Caret Line="824" Column="20" TopLine="792"/>
|
||||||
</Position7>
|
</Position7>
|
||||||
<Position8>
|
<Position8>
|
||||||
<Filename Value="DLBitmap.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="375" Column="24" TopLine="347"/>
|
<Caret Line="825" Column="22" TopLine="793"/>
|
||||||
</Position8>
|
</Position8>
|
||||||
<Position9>
|
<Position9>
|
||||||
<Filename Value="DLBmpUtils.inc"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="497" Column="22" TopLine="487"/>
|
<Caret Line="826" Column="20" TopLine="794"/>
|
||||||
</Position9>
|
</Position9>
|
||||||
<Position10>
|
<Position10>
|
||||||
<Filename Value="DLBmpUtils.inc"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="499" Column="41" TopLine="478"/>
|
<Caret Line="828" Column="18" TopLine="796"/>
|
||||||
</Position10>
|
</Position10>
|
||||||
<Position11>
|
<Position11>
|
||||||
<Filename Value="DLBitmap.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="91" Column="1" TopLine="65"/>
|
<Caret Line="831" Column="36" TopLine="799"/>
|
||||||
</Position11>
|
</Position11>
|
||||||
<Position12>
|
<Position12>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="8" Column="97" TopLine="3"/>
|
<Caret Line="833" Column="20" TopLine="857"/>
|
||||||
</Position12>
|
</Position12>
|
||||||
<Position13>
|
<Position13>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="111" Column="32" TopLine="79"/>
|
<Caret Line="1194" Column="3" TopLine="1175"/>
|
||||||
</Position13>
|
</Position13>
|
||||||
<Position14>
|
<Position14>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="114" Column="54" TopLine="85"/>
|
<Caret Line="367" Column="23" TopLine="344"/>
|
||||||
</Position14>
|
</Position14>
|
||||||
<Position15>
|
<Position15>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="178" Column="22" TopLine="146"/>
|
<Caret Line="487" Column="13" TopLine="455"/>
|
||||||
</Position15>
|
</Position15>
|
||||||
<Position16>
|
<Position16>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="668" Column="55" TopLine="822"/>
|
<Caret Line="494" Column="13" TopLine="462"/>
|
||||||
</Position16>
|
</Position16>
|
||||||
<Position17>
|
<Position17>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="680" Column="14" TopLine="661"/>
|
<Caret Line="553" Column="13" TopLine="521"/>
|
||||||
</Position17>
|
</Position17>
|
||||||
<Position18>
|
<Position18>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="684" Column="21" TopLine="661"/>
|
<Caret Line="560" Column="13" TopLine="528"/>
|
||||||
</Position18>
|
</Position18>
|
||||||
<Position19>
|
<Position19>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="699" Column="35" TopLine="682"/>
|
<Caret Line="581" Column="13" TopLine="549"/>
|
||||||
</Position19>
|
</Position19>
|
||||||
<Position20>
|
<Position20>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="737" Column="27" TopLine="708"/>
|
<Caret Line="588" Column="13" TopLine="556"/>
|
||||||
</Position20>
|
</Position20>
|
||||||
<Position21>
|
<Position21>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="738" Column="12" TopLine="708"/>
|
<Caret Line="595" Column="13" TopLine="563"/>
|
||||||
</Position21>
|
</Position21>
|
||||||
<Position22>
|
<Position22>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="3" Column="103" TopLine="1"/>
|
<Caret Line="630" Column="13" TopLine="598"/>
|
||||||
</Position22>
|
</Position22>
|
||||||
<Position23>
|
<Position23>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="111" Column="32" TopLine="79"/>
|
<Caret Line="637" Column="13" TopLine="605"/>
|
||||||
</Position23>
|
</Position23>
|
||||||
<Position24>
|
<Position24>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="114" Column="54" TopLine="82"/>
|
<Caret Line="644" Column="13" TopLine="612"/>
|
||||||
</Position24>
|
</Position24>
|
||||||
<Position25>
|
<Position25>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="178" Column="22" TopLine="146"/>
|
<Caret Line="658" Column="13" TopLine="626"/>
|
||||||
</Position25>
|
</Position25>
|
||||||
<Position26>
|
<Position26>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="690" Column="12" TopLine="657"/>
|
<Caret Line="665" Column="13" TopLine="633"/>
|
||||||
</Position26>
|
</Position26>
|
||||||
<Position27>
|
<Position27>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="689" Column="30" TopLine="665"/>
|
<Caret Line="835" Column="13" TopLine="803"/>
|
||||||
</Position27>
|
</Position27>
|
||||||
<Position28>
|
<Position28>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="684" Column="40" TopLine="665"/>
|
<Caret Line="842" Column="29" TopLine="806"/>
|
||||||
</Position28>
|
</Position28>
|
||||||
<Position29>
|
<Position29>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="686" Column="20" TopLine="667"/>
|
<Caret Line="480" Column="28" TopLine="462"/>
|
||||||
</Position29>
|
</Position29>
|
||||||
<Position30>
|
<Position30>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<Caret Line="1049" Column="31" TopLine="1029"/>
|
<Caret Line="842" Column="24" TopLine="823"/>
|
||||||
</Position30>
|
</Position30>
|
||||||
</JumpHistory>
|
</JumpHistory>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
object MainForm: TMainForm
|
object MainForm: TMainForm
|
||||||
Left = 135
|
Left = 260
|
||||||
Height = 681
|
Height = 681
|
||||||
Top = 90
|
Top = 147
|
||||||
Width = 935
|
Width = 935
|
||||||
Caption = 'Lazarus Image Editor'
|
Caption = 'Lazarus Image Editor'
|
||||||
ClientHeight = 659
|
ClientHeight = 659
|
||||||
@@ -40,6 +40,7 @@
|
|||||||
Images = ImageListTools
|
Images = ImageListTools
|
||||||
Indent = 0
|
Indent = 0
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
|
OnClick = ToolBarToolsClick
|
||||||
object ToolSpray: TToolButton
|
object ToolSpray: TToolButton
|
||||||
Left = 0
|
Left = 0
|
||||||
Hint = 'Spray'
|
Hint = 'Spray'
|
||||||
@@ -153,11 +154,22 @@
|
|||||||
end
|
end
|
||||||
object ToolBrush: TToolButton
|
object ToolBrush: TToolButton
|
||||||
Left = 0
|
Left = 0
|
||||||
|
Hint = 'Brush'
|
||||||
Top = 402
|
Top = 402
|
||||||
Caption = 'ToolBrush'
|
Caption = 'ToolBrush'
|
||||||
|
Grouped = True
|
||||||
ImageIndex = 5
|
ImageIndex = 5
|
||||||
OnClick = ToolBrushClick
|
OnClick = ToolBrushClick
|
||||||
end
|
end
|
||||||
|
object ToolText: TToolButton
|
||||||
|
Left = 0
|
||||||
|
Hint = 'Text'
|
||||||
|
Top = 442
|
||||||
|
Caption = 'ToolBrush'
|
||||||
|
Grouped = True
|
||||||
|
ImageIndex = 5
|
||||||
|
OnClick = ToolTextClick
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object StatusBar: TStatusBar
|
object StatusBar: TStatusBar
|
||||||
@@ -387,7 +399,7 @@
|
|||||||
object ComboBoxZoom: TComboBox
|
object ComboBoxZoom: TComboBox
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 27
|
Height = 27
|
||||||
Top = 2
|
Top = 3
|
||||||
Width = 76
|
Width = 76
|
||||||
Anchors = [akLeft]
|
Anchors = [akLeft]
|
||||||
ItemHeight = 19
|
ItemHeight = 19
|
||||||
@@ -422,6 +434,43 @@
|
|||||||
ImageIndex = 11
|
ImageIndex = 11
|
||||||
OnClick = ZoomOutBtnClick
|
OnClick = ZoomOutBtnClick
|
||||||
end
|
end
|
||||||
|
object ToolButton1: TToolButton
|
||||||
|
Left = 534
|
||||||
|
Top = 0
|
||||||
|
Width = 8
|
||||||
|
Caption = 'ToolButton1'
|
||||||
|
Style = tbsSeparator
|
||||||
|
end
|
||||||
|
object Panel1: TPanel
|
||||||
|
Left = 542
|
||||||
|
Height = 32
|
||||||
|
Top = 0
|
||||||
|
Width = 168
|
||||||
|
BevelOuter = bvNone
|
||||||
|
ClientHeight = 32
|
||||||
|
ClientWidth = 168
|
||||||
|
TabOrder = 1
|
||||||
|
object FontListBox: TComboBox
|
||||||
|
Left = 2
|
||||||
|
Height = 27
|
||||||
|
Top = 3
|
||||||
|
Width = 112
|
||||||
|
ItemHeight = 19
|
||||||
|
OnChange = FontListBoxChange
|
||||||
|
OnClick = FontListBoxClick
|
||||||
|
Style = csDropDownList
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object FontSize: TSpinEdit
|
||||||
|
Left = 117
|
||||||
|
Height = 27
|
||||||
|
Top = 3
|
||||||
|
Width = 50
|
||||||
|
OnChange = FontSizeChange
|
||||||
|
TabOrder = 1
|
||||||
|
Value = 10
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object PanelOptions: TPanel
|
object PanelOptions: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
@@ -1299,9 +1348,9 @@
|
|||||||
TabOrder = 5
|
TabOrder = 5
|
||||||
object checkFuzzy: TCheckBox
|
object checkFuzzy: TCheckBox
|
||||||
Left = 4
|
Left = 4
|
||||||
Height = 23
|
Height = 19
|
||||||
Top = 9
|
Top = 9
|
||||||
Width = 24
|
Width = 20
|
||||||
OnChange = checkFuzzyChange
|
OnChange = checkFuzzyChange
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -32,7 +32,7 @@ interface
|
|||||||
uses
|
uses
|
||||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Menus,
|
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Menus,
|
||||||
ExtCtrls, ComCtrls, ActnList, StdActns, ExtDlgs, Buttons, StdCtrls, Spin,
|
ExtCtrls, ComCtrls, ActnList, StdActns, ExtDlgs, Buttons, StdCtrls, Spin,
|
||||||
NewDialog, ResizeDialog, ResizePaperDialog, AboutDialog,
|
NewDialog, ResizeDialog, ResizePaperDialog, AboutDialog, DLBitmap,
|
||||||
PictureManager, PictureCtrls, ColorPalette;
|
PictureManager, PictureCtrls, ColorPalette;
|
||||||
|
|
||||||
type
|
type
|
||||||
@@ -45,6 +45,7 @@ type
|
|||||||
ColorsDisable: TAction;
|
ColorsDisable: TAction;
|
||||||
ColorsGrayscale: TAction;
|
ColorsGrayscale: TAction;
|
||||||
ColorsInvert: TAction;
|
ColorsInvert: TAction;
|
||||||
|
FontListBox: TComboBox;
|
||||||
EditCopy: TEditCopy;
|
EditCopy: TEditCopy;
|
||||||
EditCut: TEditCut;
|
EditCut: TEditCut;
|
||||||
EditDelete: TEditDelete;
|
EditDelete: TEditDelete;
|
||||||
@@ -66,6 +67,7 @@ type
|
|||||||
MaskRemove: TAction;
|
MaskRemove: TAction;
|
||||||
Palette: TColorPalette;
|
Palette: TColorPalette;
|
||||||
MenuItemShowGrid: TMenuItem;
|
MenuItemShowGrid: TMenuItem;
|
||||||
|
Panel1: TPanel;
|
||||||
PanelTolerance1: TPanel;
|
PanelTolerance1: TPanel;
|
||||||
PanelTolerance2: TPanel;
|
PanelTolerance2: TPanel;
|
||||||
PictureClipPaperToMask: TAction;
|
PictureClipPaperToMask: TAction;
|
||||||
@@ -75,6 +77,7 @@ type
|
|||||||
Rotate270: TAction;
|
Rotate270: TAction;
|
||||||
Rotate90: TAction;
|
Rotate90: TAction;
|
||||||
RotateCustom: TAction;
|
RotateCustom: TAction;
|
||||||
|
FontSize: TSpinEdit;
|
||||||
spinFillAlpha: TSpinEdit;
|
spinFillAlpha: TSpinEdit;
|
||||||
MenuItemShowMask: TMenuItem;
|
MenuItemShowMask: TMenuItem;
|
||||||
MenuItemView: TMenuItem;
|
MenuItemView: TMenuItem;
|
||||||
@@ -164,6 +167,8 @@ type
|
|||||||
ExportResourceDialog: TSaveDialog;
|
ExportResourceDialog: TSaveDialog;
|
||||||
SavePictureDialog: TSavePictureDialog;
|
SavePictureDialog: TSavePictureDialog;
|
||||||
ToolBrush: TToolButton;
|
ToolBrush: TToolButton;
|
||||||
|
ToolButton1: TToolButton;
|
||||||
|
ToolText: TToolButton;
|
||||||
ZoomInBtn: TToolButton;
|
ZoomInBtn: TToolButton;
|
||||||
ZoomOutBtn: TToolButton;
|
ZoomOutBtn: TToolButton;
|
||||||
ToolCircleShape: TSpeedButton;
|
ToolCircleShape: TSpeedButton;
|
||||||
@@ -232,6 +237,9 @@ type
|
|||||||
procedure FileSaveExecute(Sender: TObject);
|
procedure FileSaveExecute(Sender: TObject);
|
||||||
procedure FlipHorizontallyExecute(Sender: TObject);
|
procedure FlipHorizontallyExecute(Sender: TObject);
|
||||||
procedure FlipVerticallyExecute(Sender: TObject);
|
procedure FlipVerticallyExecute(Sender: TObject);
|
||||||
|
procedure FontListBoxChange(Sender: TObject);
|
||||||
|
procedure FontListBoxClick(Sender: TObject);
|
||||||
|
procedure FontSizeChange(Sender: TObject);
|
||||||
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure FormShow(Sender: TObject);
|
procedure FormShow(Sender: TObject);
|
||||||
@@ -258,7 +266,9 @@ type
|
|||||||
procedure Rotate270Execute(Sender: TObject);
|
procedure Rotate270Execute(Sender: TObject);
|
||||||
procedure Rotate90Execute(Sender: TObject);
|
procedure Rotate90Execute(Sender: TObject);
|
||||||
procedure spinFillAlphaChange(Sender: TObject);
|
procedure spinFillAlphaChange(Sender: TObject);
|
||||||
|
procedure ToolBarToolsClick(Sender: TObject);
|
||||||
procedure ToolBrushClick(Sender: TObject);
|
procedure ToolBrushClick(Sender: TObject);
|
||||||
|
procedure ToolTextClick(Sender: TObject);
|
||||||
procedure ZoomInBtnClick(Sender: TObject);
|
procedure ZoomInBtnClick(Sender: TObject);
|
||||||
procedure ZoomOutBtnClick(Sender: TObject);
|
procedure ZoomOutBtnClick(Sender: TObject);
|
||||||
procedure ToolCircleShapeClick(Sender: TObject);
|
procedure ToolCircleShapeClick(Sender: TObject);
|
||||||
@@ -298,6 +308,7 @@ type
|
|||||||
procedure UpdatePictureToolsEnabled;
|
procedure UpdatePictureToolsEnabled;
|
||||||
procedure UpdateAll;
|
procedure UpdateAll;
|
||||||
public
|
public
|
||||||
|
TextEditor: TTextEditor;
|
||||||
procedure FileNewOnStart;
|
procedure FileNewOnStart;
|
||||||
procedure OpenImageFile(FileName: string);
|
procedure OpenImageFile(FileName: string);
|
||||||
property ActivePicture: TPictureBitmap read GetActivePicture;
|
property ActivePicture: TPictureBitmap read GetActivePicture;
|
||||||
@@ -463,6 +474,12 @@ begin
|
|||||||
ActivePictureEdit.FillAlpha := spinFillAlpha.Value;
|
ActivePictureEdit.FillAlpha := spinFillAlpha.Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.ToolBarToolsClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if ActivePictureEdit.Tool <> ptText then
|
||||||
|
TextEditor.StopEdit;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMainForm.ToolBrushClick(Sender: TObject);
|
procedure TMainForm.ToolBrushClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if not Pictures.CanEdit then
|
if not Pictures.CanEdit then
|
||||||
@@ -470,6 +487,14 @@ begin
|
|||||||
ChangeTool(ptBrush);
|
ChangeTool(ptBrush);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.ToolTextClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if not Pictures.CanEdit then
|
||||||
|
Exit;
|
||||||
|
ChangeTool(ptText);
|
||||||
|
ActivePictureEdit.TextEditor := TextEditor;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMainForm.ZoomInBtnClick(Sender: TObject);
|
procedure TMainForm.ZoomInBtnClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
V, E: integer;
|
V, E: integer;
|
||||||
@@ -814,6 +839,7 @@ procedure TMainForm.ChangeTool(Tool: TPictureEditTool);
|
|||||||
begin
|
begin
|
||||||
ActivePictureEdit.Tool := Tool;
|
ActivePictureEdit.Tool := Tool;
|
||||||
UpdateToolSettings;
|
UpdateToolSettings;
|
||||||
|
ToolBarToolsClick(nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.UpdatePictureToolsEnabled;
|
procedure TMainForm.UpdatePictureToolsEnabled;
|
||||||
@@ -1046,6 +1072,10 @@ begin
|
|||||||
OpenPictureDialog.Title := lieOpenPictureDialog;
|
OpenPictureDialog.Title := lieOpenPictureDialog;
|
||||||
SavePictureDialog.Title := lieSavePictureDialog;
|
SavePictureDialog.Title := lieSavePictureDialog;
|
||||||
ExportResourceDialog.Title := lieExportResourceDialog;
|
ExportResourceDialog.Title := lieExportResourceDialog;
|
||||||
|
TextEditor := TTextEditor.Create(Self);
|
||||||
|
TextEditor.Parent := Self;
|
||||||
|
FontListBox.Items := Screen.Fonts;
|
||||||
|
FontListBox.ItemIndex := FontListBox.Items.IndexOf(UTF8Encode(Screen.MenuFont.Name));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.FormShow(Sender: TObject);
|
procedure TMainForm.FormShow(Sender: TObject);
|
||||||
@@ -1160,6 +1190,23 @@ begin
|
|||||||
ActivePictureEdit.FlipVertically;
|
ActivePictureEdit.FlipVertically;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.FontListBoxChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
ActivePictureEdit.Canvas.Font.Name := FontListBox.Text;
|
||||||
|
if ActivePictureEdit.Tool <> ptText then
|
||||||
|
TextEditor.StopEdit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.FontListBoxClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.FontSizeChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
ActivePictureEdit.Canvas.Font.Size := FontSize.Value;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||||
begin
|
begin
|
||||||
Pictures.CloseAll;
|
Pictures.CloseAll;
|
||||||
|
@@ -31,7 +31,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, LCLType, LCLIntf, Controls, Forms, ExtCtrls, Graphics, Math,
|
Classes, SysUtils, LCLType, LCLIntf, Controls, Forms, ExtCtrls, Graphics, Math,
|
||||||
BmpRGBGraph, BmpRGBUtils, BmpRGBTypes;
|
BmpRGBGraph, BmpRGBUtils, BmpRGBTypes, DLBitmap;
|
||||||
|
|
||||||
type
|
type
|
||||||
TPictureViewOption = (poShowGrid, poShowMask);
|
TPictureViewOption = (poShowGrid, poShowMask);
|
||||||
@@ -72,7 +72,7 @@ type
|
|||||||
procedure UpdatePictureRect;
|
procedure UpdatePictureRect;
|
||||||
public
|
public
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
|
destructor Destroy; override;
|
||||||
procedure Paint; override;
|
procedure Paint; override;
|
||||||
procedure Resize; override;
|
procedure Resize; override;
|
||||||
procedure EraseBackground(DC: HDC); override;
|
procedure EraseBackground(DC: HDC); override;
|
||||||
@@ -111,7 +111,7 @@ type
|
|||||||
tdRoundRectangle, tdPolygon);
|
tdRoundRectangle, tdPolygon);
|
||||||
|
|
||||||
TPictureEditTool = (ptLine, ptPen, ptRectangle, ptFloodFill, ptEllipse,
|
TPictureEditTool = (ptLine, ptPen, ptRectangle, ptFloodFill, ptEllipse,
|
||||||
ptMask, ptColorPick, ptEraser, ptSpray, ptPolygon, ptBrush);
|
ptMask, ptColorPick, ptEraser, ptSpray, ptPolygon, ptBrush, ptText);
|
||||||
|
|
||||||
TPicturePos = (ppTopLeft, ppTopCenter, ppTopRight, ppCenterLeft, ppCentered,
|
TPicturePos = (ppTopLeft, ppTopCenter, ppTopRight, ppCenterLeft, ppCentered,
|
||||||
ppCenterRight, ppBottomLeft, ppBottomCenter, ppBottomRight);
|
ppCenterRight, ppBottomLeft, ppBottomCenter, ppBottomRight);
|
||||||
@@ -176,6 +176,7 @@ type
|
|||||||
procedure Rectangle(X1, Y1, X2, Y2: integer; Shift: TShiftState = [ssLeft]);
|
procedure Rectangle(X1, Y1, X2, Y2: integer; Shift: TShiftState = [ssLeft]);
|
||||||
procedure Ellipse(X1, Y1, X2, Y2: integer; Shift: TShiftState = [ssLeft]);
|
procedure Ellipse(X1, Y1, X2, Y2: integer; Shift: TShiftState = [ssLeft]);
|
||||||
procedure Polygon(X1, Y1, X2, Y2: integer; Shift: TShiftState);
|
procedure Polygon(X1, Y1, X2, Y2: integer; Shift: TShiftState);
|
||||||
|
procedure ProcessEditorText(X1, Y1, X2, Y2: integer);
|
||||||
procedure ProcessPointAddr(X1, Y1, X2, Y2: integer; Points: array of TPoint; PCount: integer);
|
procedure ProcessPointAddr(X1, Y1, X2, Y2: integer; Points: array of TPoint; PCount: integer);
|
||||||
procedure Mask(X1, Y1, X2, Y2: integer; Shift: TShiftState = [ssLeft]);
|
procedure Mask(X1, Y1, X2, Y2: integer; Shift: TShiftState = [ssLeft]);
|
||||||
|
|
||||||
@@ -208,6 +209,7 @@ type
|
|||||||
procedure EndDraw;
|
procedure EndDraw;
|
||||||
procedure UpdatePicture;
|
procedure UpdatePicture;
|
||||||
public
|
public
|
||||||
|
TextEditor: TTextEditor;
|
||||||
property DrawMode: TDrawMode read FDrawMode write FDrawMode;
|
property DrawMode: TDrawMode read FDrawMode write FDrawMode;
|
||||||
property FillColor: TColor read FFillColor write SetFillColor;
|
property FillColor: TColor read FFillColor write SetFillColor;
|
||||||
property OutlineColor: TColor read FOutlineColor write SetOutlineColor;
|
property OutlineColor: TColor read FOutlineColor write SetOutlineColor;
|
||||||
@@ -417,6 +419,11 @@ begin
|
|||||||
FScrollStop.Parent := Self;
|
FScrollStop.Parent := Self;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
destructor TCustomPictureView.Destroy;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomPictureView.Paint;
|
procedure TCustomPictureView.Paint;
|
||||||
var
|
var
|
||||||
I: integer;
|
I: integer;
|
||||||
@@ -631,6 +638,7 @@ begin
|
|||||||
ptColorPick: ColorPick(X, Y, Shift);
|
ptColorPick: ColorPick(X, Y, Shift);
|
||||||
ptEraser: Eraser(X, Y, Shift);
|
ptEraser: Eraser(X, Y, Shift);
|
||||||
ptSpray: Spray(X, Y, Shift);
|
ptSpray: Spray(X, Y, Shift);
|
||||||
|
ptText: ProcessEditorText(X, Y, X, Y);
|
||||||
ptBrush: Brush(X, Y, Shift);
|
ptBrush: Brush(X, Y, Shift);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -1066,6 +1074,15 @@ begin
|
|||||||
InvalidatePictureRect(Rect(X1, Y1, X2, Y2));
|
InvalidatePictureRect(Rect(X1, Y1, X2, Y2));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomPictureEdit.ProcessEditorText(X1, Y1, X2, Y2: integer);
|
||||||
|
var P: TRect;
|
||||||
|
begin
|
||||||
|
TextEditor.IMGCanvas := Picture.Canvas;
|
||||||
|
TextEditor.Parent := Self;
|
||||||
|
P := PictureToClient(Rect(X1, X2, X1, X2));
|
||||||
|
TextEditor.StartEdit(FPictureRect.Left +X1, FPictureRect.Top + Y1, X1, Y1);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomPictureEdit.Mask(X1, Y1, X2, Y2: integer; Shift: TShiftState);
|
procedure TCustomPictureEdit.Mask(X1, Y1, X2, Y2: integer; Shift: TShiftState);
|
||||||
begin
|
begin
|
||||||
if Picture = nil then
|
if Picture = nil then
|
||||||
|
Reference in New Issue
Block a user