You've already forked lazarus-ccr
ScanLine likes Delphi's with one line code added to update it.
Multiple images of ICO is back. Color can be filled in the tools. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1570 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -64,7 +64,7 @@ type
|
|||||||
|
|
||||||
{ TRGBBitmapCore }
|
{ TRGBBitmapCore }
|
||||||
|
|
||||||
TRGBBitmapCore = class(TCustomRGBBitmapCore)
|
TRGBBitmapCore = class(TDLBitmap)
|
||||||
private
|
private
|
||||||
FSizeOfPixel: integer;
|
FSizeOfPixel: integer;
|
||||||
FRowPixelStride: integer;
|
FRowPixelStride: integer;
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
<PackageName Value="LCL"/>
|
<PackageName Value="LCL"/>
|
||||||
</Item3>
|
</Item3>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="33">
|
<Units Count="35">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="lazimageeditor.pas"/>
|
<Filename Value="lazimageeditor.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
@ -49,7 +49,7 @@
|
|||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="2"/>
|
<TopLine Value="2"/>
|
||||||
<CursorPos X="11" Y="26"/>
|
<CursorPos X="11" Y="26"/>
|
||||||
<UsageCount Value="59"/>
|
<UsageCount Value="61"/>
|
||||||
</Unit0>
|
</Unit0>
|
||||||
<Unit1>
|
<Unit1>
|
||||||
<Filename Value="main.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
@ -58,23 +58,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="1030"/>
|
<TopLine Value="1030"/>
|
||||||
<CursorPos X="5" Y="1046"/>
|
<CursorPos X="15" Y="1051"/>
|
||||||
<UsageCount Value="59"/>
|
<UsageCount Value="61"/>
|
||||||
<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="2"/>
|
<EditorIndex Value="2"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="1157"/>
|
<TopLine Value="896"/>
|
||||||
<CursorPos X="15" Y="1170"/>
|
<CursorPos X="46" Y="886"/>
|
||||||
<UsageCount Value="26"/>
|
<UsageCount Value="27"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit2>
|
</Unit2>
|
||||||
<Unit3>
|
<Unit3>
|
||||||
@ -169,21 +169,19 @@
|
|||||||
<Unit12>
|
<Unit12>
|
||||||
<Filename Value="T:\fpclaz\laz\lcl\graphics.pp"/>
|
<Filename Value="T:\fpclaz\laz\lcl\graphics.pp"/>
|
||||||
<UnitName Value="Graphics"/>
|
<UnitName Value="Graphics"/>
|
||||||
<EditorIndex Value="4"/>
|
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="1404"/>
|
<TopLine Value="2580"/>
|
||||||
<CursorPos X="27" Y="1404"/>
|
<CursorPos X="9" Y="2592"/>
|
||||||
<UsageCount Value="10"/>
|
<UsageCount Value="10"/>
|
||||||
<Loaded Value="True"/>
|
|
||||||
</Unit12>
|
</Unit12>
|
||||||
<Unit13>
|
<Unit13>
|
||||||
<Filename Value="picturemanager.pas"/>
|
<Filename Value="picturemanager.pas"/>
|
||||||
<UnitName Value="PictureManager"/>
|
<UnitName Value="PictureManager"/>
|
||||||
<EditorIndex Value="1"/>
|
<EditorIndex Value="1"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="233"/>
|
<TopLine Value="1"/>
|
||||||
<CursorPos X="40" Y="250"/>
|
<CursorPos X="21" Y="268"/>
|
||||||
<UsageCount Value="27"/>
|
<UsageCount Value="28"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit13>
|
</Unit13>
|
||||||
<Unit14>
|
<Unit14>
|
||||||
@ -245,10 +243,12 @@
|
|||||||
<Unit21>
|
<Unit21>
|
||||||
<Filename Value="bmprgbtypes.pas"/>
|
<Filename Value="bmprgbtypes.pas"/>
|
||||||
<UnitName Value="BmpRGBTypes"/>
|
<UnitName Value="BmpRGBTypes"/>
|
||||||
|
<EditorIndex Value="5"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="259"/>
|
<TopLine Value="559"/>
|
||||||
<CursorPos X="20" Y="268"/>
|
<CursorPos X="40" Y="567"/>
|
||||||
<UsageCount Value="25"/>
|
<UsageCount Value="25"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
</Unit21>
|
</Unit21>
|
||||||
<Unit22>
|
<Unit22>
|
||||||
<Filename Value="T:\fpclaz\laz\lcl\include\winapih.inc"/>
|
<Filename Value="T:\fpclaz\laz\lcl\include\winapih.inc"/>
|
||||||
@ -276,11 +276,11 @@
|
|||||||
<Unit25>
|
<Unit25>
|
||||||
<Filename Value="bmprgbutils.pas"/>
|
<Filename Value="bmprgbutils.pas"/>
|
||||||
<UnitName Value="BmpRGBUtils"/>
|
<UnitName Value="BmpRGBUtils"/>
|
||||||
<EditorIndex Value="5"/>
|
<EditorIndex Value="4"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="34"/>
|
<TopLine Value="34"/>
|
||||||
<CursorPos X="72" Y="5"/>
|
<CursorPos X="72" Y="5"/>
|
||||||
<UsageCount Value="22"/>
|
<UsageCount Value="23"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit25>
|
</Unit25>
|
||||||
<Unit26>
|
<Unit26>
|
||||||
@ -304,9 +304,9 @@
|
|||||||
<UnitName Value="BmpRGBGraph"/>
|
<UnitName Value="BmpRGBGraph"/>
|
||||||
<EditorIndex Value="6"/>
|
<EditorIndex Value="6"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="100"/>
|
<TopLine Value="47"/>
|
||||||
<CursorPos X="15" Y="122"/>
|
<CursorPos X="59" Y="66"/>
|
||||||
<UsageCount Value="18"/>
|
<UsageCount Value="19"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit28>
|
</Unit28>
|
||||||
<Unit29>
|
<Unit29>
|
||||||
@ -314,9 +314,9 @@
|
|||||||
<UnitName Value="RGBDrawUtils"/>
|
<UnitName Value="RGBDrawUtils"/>
|
||||||
<EditorIndex Value="3"/>
|
<EditorIndex Value="3"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="636"/>
|
||||||
<CursorPos X="36" Y="15"/>
|
<CursorPos X="20" Y="669"/>
|
||||||
<UsageCount Value="17"/>
|
<UsageCount Value="18"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit29>
|
</Unit29>
|
||||||
<Unit30>
|
<Unit30>
|
||||||
@ -346,127 +346,142 @@
|
|||||||
<CursorPos X="14" Y="607"/>
|
<CursorPos X="14" Y="607"/>
|
||||||
<UsageCount Value="10"/>
|
<UsageCount Value="10"/>
|
||||||
</Unit32>
|
</Unit32>
|
||||||
|
<Unit33>
|
||||||
|
<Filename Value="T:\fpclaz\laz\lcl\include\graphic.inc"/>
|
||||||
|
<WindowIndex Value="0"/>
|
||||||
|
<TopLine Value="116"/>
|
||||||
|
<CursorPos X="30" Y="130"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
</Unit33>
|
||||||
|
<Unit34>
|
||||||
|
<Filename Value="D:\我的文档\桌面\imgedit\picturemanager.pas"/>
|
||||||
|
<UnitName Value="PictureManager"/>
|
||||||
|
<WindowIndex Value="0"/>
|
||||||
|
<TopLine Value="230"/>
|
||||||
|
<CursorPos X="28" Y="237"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
</Unit34>
|
||||||
</Units>
|
</Units>
|
||||||
<JumpHistory Count="30" HistoryIndex="29">
|
<JumpHistory Count="30" HistoryIndex="29">
|
||||||
<Position1>
|
<Position1>
|
||||||
<Filename Value="picturemanager.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="108" Column="65" TopLine="82"/>
|
<Caret Line="3" Column="98" TopLine="1"/>
|
||||||
</Position1>
|
</Position1>
|
||||||
<Position2>
|
<Position2>
|
||||||
<Filename Value="picturemanager.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="191" Column="31" TopLine="177"/>
|
<Caret Line="111" Column="62" TopLine="79"/>
|
||||||
</Position2>
|
</Position2>
|
||||||
<Position3>
|
<Position3>
|
||||||
<Filename Value="picturemanager.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="193" Column="38" TopLine="177"/>
|
<Caret Line="117" Column="51" TopLine="85"/>
|
||||||
</Position3>
|
</Position3>
|
||||||
<Position4>
|
<Position4>
|
||||||
<Filename Value="picturemanager.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="277" Column="31" TopLine="263"/>
|
<Caret Line="124" Column="10" TopLine="92"/>
|
||||||
</Position4>
|
</Position4>
|
||||||
<Position5>
|
<Position5>
|
||||||
<Filename Value="picturemanager.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="279" Column="58" TopLine="263"/>
|
<Caret Line="125" Column="10" TopLine="93"/>
|
||||||
</Position5>
|
</Position5>
|
||||||
<Position6>
|
<Position6>
|
||||||
<Filename Value="picturemanager.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="282" Column="31" TopLine="263"/>
|
<Caret Line="126" Column="10" TopLine="94"/>
|
||||||
</Position6>
|
</Position6>
|
||||||
<Position7>
|
<Position7>
|
||||||
<Filename Value="picturemanager.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="287" Column="9" TopLine="263"/>
|
<Caret Line="127" Column="15" TopLine="95"/>
|
||||||
</Position7>
|
</Position7>
|
||||||
<Position8>
|
<Position8>
|
||||||
<Filename Value="picturemanager.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="391" Column="46" TopLine="371"/>
|
<Caret Line="143" Column="22" TopLine="111"/>
|
||||||
</Position8>
|
</Position8>
|
||||||
<Position9>
|
<Position9>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="163" Column="26" TopLine="147"/>
|
<Caret Line="166" Column="24" TopLine="134"/>
|
||||||
</Position9>
|
</Position9>
|
||||||
<Position10>
|
<Position10>
|
||||||
<Filename Value="main.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="1044" Column="14" TopLine="1032"/>
|
<Caret Line="167" Column="28" TopLine="135"/>
|
||||||
</Position10>
|
</Position10>
|
||||||
<Position11>
|
<Position11>
|
||||||
<Filename Value="picturemanager.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="88" Column="19" TopLine="72"/>
|
<Caret Line="205" Column="61" TopLine="173"/>
|
||||||
</Position11>
|
</Position11>
|
||||||
<Position12>
|
<Position12>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="521" Column="33" TopLine="506"/>
|
<Caret Line="209" Column="72" TopLine="177"/>
|
||||||
</Position12>
|
</Position12>
|
||||||
<Position13>
|
<Position13>
|
||||||
<Filename Value="main.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="1044" Column="14" TopLine="1032"/>
|
<Caret Line="213" Column="82" TopLine="181"/>
|
||||||
</Position13>
|
</Position13>
|
||||||
<Position14>
|
<Position14>
|
||||||
<Filename Value="main.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="1038" Column="14" TopLine="1030"/>
|
<Caret Line="216" Column="60" TopLine="184"/>
|
||||||
</Position14>
|
</Position14>
|
||||||
<Position15>
|
<Position15>
|
||||||
<Filename Value="main.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="295" Column="28" TopLine="279"/>
|
<Caret Line="408" Column="9" TopLine="376"/>
|
||||||
</Position15>
|
</Position15>
|
||||||
<Position16>
|
<Position16>
|
||||||
<Filename Value="main.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="1038" Column="20" TopLine="1012"/>
|
<Caret Line="557" Column="37" TopLine="525"/>
|
||||||
</Position16>
|
</Position16>
|
||||||
<Position17>
|
<Position17>
|
||||||
<Filename Value="main.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="1046" Column="1" TopLine="1016"/>
|
<Caret Line="559" Column="20" TopLine="527"/>
|
||||||
</Position17>
|
</Position17>
|
||||||
<Position18>
|
<Position18>
|
||||||
<Filename Value="main.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="1229" Column="1" TopLine="1198"/>
|
<Caret Line="560" Column="8" TopLine="528"/>
|
||||||
</Position18>
|
</Position18>
|
||||||
<Position19>
|
<Position19>
|
||||||
<Filename Value="main.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="1" Column="1" TopLine="1"/>
|
<Caret Line="596" Column="20" TopLine="573"/>
|
||||||
</Position19>
|
</Position19>
|
||||||
<Position20>
|
<Position20>
|
||||||
<Filename Value="main.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="295" Column="28" TopLine="269"/>
|
<Caret Line="166" Column="24" TopLine="146"/>
|
||||||
</Position20>
|
</Position20>
|
||||||
<Position21>
|
<Position21>
|
||||||
<Filename Value="main.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="1038" Column="20" TopLine="1012"/>
|
<Caret Line="167" Column="28" TopLine="146"/>
|
||||||
</Position21>
|
</Position21>
|
||||||
<Position22>
|
<Position22>
|
||||||
<Filename Value="main.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="1046" Column="27" TopLine="1016"/>
|
<Caret Line="213" Column="82" TopLine="181"/>
|
||||||
</Position22>
|
</Position22>
|
||||||
<Position23>
|
<Position23>
|
||||||
<Filename Value="main.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="1044" Column="11" TopLine="1028"/>
|
<Caret Line="596" Column="25" TopLine="564"/>
|
||||||
</Position23>
|
</Position23>
|
||||||
<Position24>
|
<Position24>
|
||||||
<Filename Value="main.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="23" Column="77" TopLine="20"/>
|
<Caret Line="597" Column="55" TopLine="565"/>
|
||||||
</Position24>
|
</Position24>
|
||||||
<Position25>
|
<Position25>
|
||||||
<Filename Value="main.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="295" Column="28" TopLine="269"/>
|
<Caret Line="641" Column="37" TopLine="609"/>
|
||||||
</Position25>
|
</Position25>
|
||||||
<Position26>
|
<Position26>
|
||||||
<Filename Value="main.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="1038" Column="20" TopLine="1024"/>
|
<Caret Line="658" Column="18" TopLine="626"/>
|
||||||
</Position26>
|
</Position26>
|
||||||
<Position27>
|
<Position27>
|
||||||
<Filename Value="main.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="1046" Column="23" TopLine="1024"/>
|
<Caret Line="703" Column="12" TopLine="671"/>
|
||||||
</Position27>
|
</Position27>
|
||||||
<Position28>
|
<Position28>
|
||||||
<Filename Value="main.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="1044" Column="24" TopLine="1030"/>
|
<Caret Line="766" Column="41" TopLine="743"/>
|
||||||
</Position28>
|
</Position28>
|
||||||
<Position29>
|
<Position29>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="picturectrls.pas"/>
|
||||||
<Caret Line="198" Column="22" TopLine="182"/>
|
<Caret Line="862" Column="23" TopLine="842"/>
|
||||||
</Position29>
|
</Position29>
|
||||||
<Position30>
|
<Position30>
|
||||||
<Filename Value="picturectrls.pas"/>
|
<Filename Value="bmprgbtypes.pas"/>
|
||||||
<Caret Line="1170" Column="15" TopLine="1157"/>
|
<Caret Line="128" Column="29" TopLine="108"/>
|
||||||
</Position30>
|
</Position30>
|
||||||
</JumpHistory>
|
</JumpHistory>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
|
@ -521,14 +521,17 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomPictureView.SavePicture(const FileName: String);
|
procedure TCustomPictureView.SavePicture(const FileName: String);
|
||||||
var Pic: TPicture;
|
var Pic: TPicture; ExtName: string;
|
||||||
begin
|
begin
|
||||||
Pic := TPicture.Create;
|
Pic := TPicture.Create;
|
||||||
//Picture.SaveToFile(UTF8Decode(FileName));
|
//Picture.SaveToFile(UTF8Decode(FileName));
|
||||||
Pic.Bitmap.Width := Picture.Width;
|
Pic.Bitmap.Width := Picture.Width;
|
||||||
Pic.Bitmap.Height := Picture.Height;
|
Pic.Bitmap.Height := Picture.Height;
|
||||||
Pic.Bitmap.Canvas.Draw(0,0,Picture);
|
Pic.Bitmap.Canvas.Draw(0,0,Picture);
|
||||||
Pic.SaveToFile(FileName);
|
ExtName := ExtractFileExt(FileName);
|
||||||
|
// if ExtName = 'PNG' then
|
||||||
|
// Pic.Graphic.;
|
||||||
|
Pic.SaveToFile(FileName, ExtName);
|
||||||
Pic.Free;
|
Pic.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -760,7 +763,7 @@ begin
|
|||||||
BeginDraw;
|
BeginDraw;
|
||||||
if not (ssLeft in Shift) then Picture.EraseMode := ermErase;
|
if not (ssLeft in Shift) then Picture.EraseMode := ermErase;
|
||||||
try
|
try
|
||||||
Picture.Canvas.FloodFill(X, Y, Picture.Canvas.Brush.Color, fsSurface);
|
Picture.Canvas.FloodFill(X, Y, FFillColor, fsSurface); //Picture.Canvas.Brush.Color, fsSurface);
|
||||||
finally
|
finally
|
||||||
Picture.EraseMode := ermNone;
|
Picture.EraseMode := ermNone;
|
||||||
EndDraw;
|
EndDraw;
|
||||||
@ -791,12 +794,14 @@ var
|
|||||||
R: TRect;
|
R: TRect;
|
||||||
begin
|
begin
|
||||||
if Picture = nil then Exit;
|
if Picture = nil then Exit;
|
||||||
|
|
||||||
BeginDraw;
|
BeginDraw;
|
||||||
if ssLeft in Shift then Picture.EraseMode := ermErase;
|
if ssLeft in Shift then Picture.EraseMode := ermErase;
|
||||||
if ssRight in Shift then Picture.EraseMode := ermReplace;
|
if ssRight in Shift then Picture.EraseMode := ermReplace;
|
||||||
try
|
try
|
||||||
R := Bounds(X - FSize div 2, Y - FSize div 2, FSize, FSize);
|
R := Bounds(X - FSize div 2, Y - FSize div 2, FSize, FSize);
|
||||||
|
Picture.Canvas.Pen.Color:=FPaperColor;
|
||||||
|
Picture.Canvas.Brush.Color:=FpaperColor;
|
||||||
case Shape of
|
case Shape of
|
||||||
psRect: Picture.Canvas.FillRect(R.Left, R.Top, R.Right, R.Bottom);
|
psRect: Picture.Canvas.FillRect(R.Left, R.Top, R.Right, R.Bottom);
|
||||||
psCircle: Picture.FillEllipse(R.Left, R.Top, R.Right, R.Bottom);
|
psCircle: Picture.FillEllipse(R.Left, R.Top, R.Right, R.Bottom);
|
||||||
@ -818,6 +823,8 @@ begin
|
|||||||
if not (ssLeft in Shift) then Picture.EraseMode := ermErase;
|
if not (ssLeft in Shift) then Picture.EraseMode := ermErase;
|
||||||
Picture.RandomEnabled := True;
|
Picture.RandomEnabled := True;
|
||||||
try
|
try
|
||||||
|
Picture.Canvas.Pen.Color:=FFillColor;
|
||||||
|
Picture.Canvas.Brush.Color:=FFillColor;
|
||||||
R := Bounds(X - FSize div 2, Y - FSize div 2, FSize, FSize);
|
R := Bounds(X - FSize div 2, Y - FSize div 2, FSize, FSize);
|
||||||
case Shape of
|
case Shape of
|
||||||
psRect: Picture.Canvas.FillRect(R.Left, R.Top, R.Right, R.Bottom);
|
psRect: Picture.Canvas.FillRect(R.Left, R.Top, R.Right, R.Bottom);
|
||||||
@ -834,7 +841,8 @@ end;
|
|||||||
procedure TCustomPictureEdit.Line(X1, Y1, X2, Y2: Integer; Shift: TShiftState);
|
procedure TCustomPictureEdit.Line(X1, Y1, X2, Y2: Integer; Shift: TShiftState);
|
||||||
begin
|
begin
|
||||||
if Picture = nil then Exit;
|
if Picture = nil then Exit;
|
||||||
|
|
||||||
|
Picture.Canvas.Pen.Color:=FOutLineColor;
|
||||||
BeginDraw;
|
BeginDraw;
|
||||||
if not (ssLeft in Shift) then Picture.EraseMode := ermErase;
|
if not (ssLeft in Shift) then Picture.EraseMode := ermErase;
|
||||||
try
|
try
|
||||||
@ -854,6 +862,8 @@ begin
|
|||||||
BeginDraw;
|
BeginDraw;
|
||||||
if not (ssLeft in Shift) then Picture.EraseMode := ermErase;
|
if not (ssLeft in Shift) then Picture.EraseMode := ermErase;
|
||||||
try
|
try
|
||||||
|
Picture.Canvas.Brush.Color:=FFillColor;
|
||||||
|
Picture.Canvas.Pen.Color:=FOutlineColor;
|
||||||
if FFuzzy then
|
if FFuzzy then
|
||||||
begin
|
begin
|
||||||
Picture.FuzzyRectangle(X1, Y1, X2, Y2);
|
Picture.FuzzyRectangle(X1, Y1, X2, Y2);
|
||||||
@ -879,7 +889,8 @@ begin
|
|||||||
BeginDraw;
|
BeginDraw;
|
||||||
if not (ssLeft in Shift) then Picture.EraseMode := ermErase;
|
if not (ssLeft in Shift) then Picture.EraseMode := ermErase;
|
||||||
try
|
try
|
||||||
|
Picture.Canvas.Brush.Color:=FFillColor;
|
||||||
|
Picture.Canvas.Pen.Color:=FOutlineColor;
|
||||||
Picture.Canvas.Ellipse(X1, Y1, X2, Y2);
|
Picture.Canvas.Ellipse(X1, Y1, X2, Y2);
|
||||||
finally
|
finally
|
||||||
Picture.EraseMode := ermNone;
|
Picture.EraseMode := ermNone;
|
||||||
|
@ -235,25 +235,24 @@ end;
|
|||||||
procedure TPictureManager.Load(const FileName: String);
|
procedure TPictureManager.Load(const FileName: String);
|
||||||
var
|
var
|
||||||
NewPage: TPicturePage;
|
NewPage: TPicturePage;
|
||||||
Icon: TCustomRGBBitmapCore;
|
Icon: TIcon;
|
||||||
|
Bmp: TDLBitmap;
|
||||||
I: Integer;
|
I: Integer;
|
||||||
Pic: TPicture;
|
Pic: TPicture;
|
||||||
begin
|
begin
|
||||||
//if SameText(ExtractFileExt(FileName), '.ico') then
|
//if SameText(ExtractFileExt(FileName), '.ico') then
|
||||||
//begin
|
//begin
|
||||||
Icon := TCustomRGBBitmapCore.Create;
|
if SameText(ExtractFileExt(FileName), '.ico') then
|
||||||
|
begin
|
||||||
|
Icon := TIcon.Create;
|
||||||
try
|
try
|
||||||
// First image in std bitmap
|
// First image in std bitmap
|
||||||
// Icon.LoadFromFile(FileName);
|
Icon.LoadFromFile(FileName);
|
||||||
Pic := TPicture.Create;
|
|
||||||
Pic.LoadFromFile(FileName);
|
|
||||||
Icon.Width:=Pic.Width;
|
|
||||||
Icon.Height:=Pic.Height;
|
|
||||||
Icon.Canvas.Draw(0,0,Pic.Graphic);
|
|
||||||
// other images
|
// other images
|
||||||
//for I := 0 to Pred(Icon.Count) do
|
for I := 0 to Pred(Icon.Count) do
|
||||||
begin
|
begin
|
||||||
// Icon.Current := I;
|
Icon.Current := I;
|
||||||
NewPage := CreatePage(Icon);
|
NewPage := CreatePage(Icon);
|
||||||
NewPage.Parent := Self;
|
NewPage.Parent := Self;
|
||||||
ActivePage := NewPage;
|
ActivePage := NewPage;
|
||||||
@ -262,8 +261,34 @@ begin
|
|||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
Icon.Free;
|
Icon.Free;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
Bmp := TDLBitmap.Create;
|
||||||
|
try
|
||||||
|
// First image in std bitmap
|
||||||
|
// Icon.LoadFromFile(FileName);
|
||||||
|
Pic := TPicture.Create;
|
||||||
|
Pic.LoadFromFile(FileName);
|
||||||
|
Bmp.Width:=Pic.Width;
|
||||||
|
Bmp.Height:=Pic.Height;
|
||||||
|
Bmp.Canvas.Draw(0,0,Pic.Graphic);
|
||||||
|
// other images
|
||||||
|
//for I := 0 to Pred(Icon.Count) do
|
||||||
|
begin
|
||||||
|
// Icon.Current := I;
|
||||||
|
NewPage := CreatePage(Bmp);
|
||||||
|
NewPage.Parent := Self;
|
||||||
|
ActivePage := NewPage;
|
||||||
|
NewPage.Caption := FindNewUniqueName;
|
||||||
|
Change;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
Bmp.Free;
|
||||||
Pic.Free;
|
Pic.Free;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
{end
|
{end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
@ -10,15 +10,15 @@ uses
|
|||||||
|
|
||||||
type
|
type
|
||||||
PRGBTripleArray = ^TRGBTripleArray;
|
PRGBTripleArray = ^TRGBTripleArray;
|
||||||
TRGBTripleArray = array[0..32767] of TRGBTriple;
|
TRGBTripleArray = array[word] of TRGBTriple;
|
||||||
|
|
||||||
TCustomRGBBitmapCore = class(TBitmap)
|
TDLBitmap = class(TBitmap)
|
||||||
private
|
private
|
||||||
FIntfImgA: TLazIntfImage;
|
FIntfImgA: TLazIntfImage;
|
||||||
FFillColor: TColor;
|
FFillColor: TColor;
|
||||||
FOutlineColor: TColor;
|
FOutlineColor: TColor;
|
||||||
FPaperColor: TColor;
|
FPaperColor: TColor;
|
||||||
function GetScanline(Row: integer): Pointer;
|
function GetScanline(Row: integer): pRGBTriple;
|
||||||
function GetFillColor: TColor;
|
function GetFillColor: TColor;
|
||||||
function GetOutlineColor: TColor;
|
function GetOutlineColor: TColor;
|
||||||
function GetPaperColor: TColor;
|
function GetPaperColor: TColor;
|
||||||
@ -28,11 +28,12 @@ type
|
|||||||
protected
|
protected
|
||||||
procedure SetWidth(Value: integer); override;
|
procedure SetWidth(Value: integer); override;
|
||||||
procedure SetHeight(Value: integer); override;
|
procedure SetHeight(Value: integer); override;
|
||||||
|
procedure Changed(Sender: TObject); override;
|
||||||
public
|
public
|
||||||
constructor Create; override;
|
constructor Create; override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure OpenScanLine;
|
procedure ResetScanLine;
|
||||||
procedure CloseScanLine;
|
procedure InvalidateScanLine;
|
||||||
procedure Assign(Source: TPersistent); override;
|
procedure Assign(Source: TPersistent); override;
|
||||||
procedure Clear; virtual;
|
procedure Clear; virtual;
|
||||||
procedure ClearWhite; virtual;
|
procedure ClearWhite; virtual;
|
||||||
@ -43,7 +44,7 @@ type
|
|||||||
procedure Rotate90; virtual;
|
procedure Rotate90; virtual;
|
||||||
procedure Rotate180; virtual;
|
procedure Rotate180; virtual;
|
||||||
procedure Rotate270; virtual;
|
procedure Rotate270; virtual;
|
||||||
property ScanLine[Row: integer]: Pointer read GetScanLine;
|
property ScanLine[Row: integer]: pRGBTriple read GetScanLine;
|
||||||
procedure FillEllipse(X1, Y1, X2, Y2: integer); virtual;
|
procedure FillEllipse(X1, Y1, X2, Y2: integer); virtual;
|
||||||
procedure CutToClipboard; virtual;
|
procedure CutToClipboard; virtual;
|
||||||
procedure CopyToClipboard; virtual;
|
procedure CopyToClipboard; virtual;
|
||||||
@ -54,29 +55,29 @@ type
|
|||||||
property PaperColor: TColor read GetPaperColor write SetPaperColor;
|
property PaperColor: TColor read GetPaperColor write SetPaperColor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure LazBMPRotate90(const aBitmap: TCustomRGBBitmapCore; IsTurnRight: boolean);
|
procedure LazBMPRotate90(const aBitmap: TDLBitmap; IsTurnRight: boolean);
|
||||||
procedure BMPRotate90(const Bitmap: TCustomRGBBitmapCore);
|
procedure BMPRotate90(const Bitmap: TDLBitmap);
|
||||||
procedure DrawSamePixel(ABitmap: TCustomRGBBitmapCore; Value: integer);
|
procedure DrawSamePixel(ABitmap: TDLBitmap; Value: integer);
|
||||||
procedure BMPRotate180(const Bitmap: TCustomRGBBitmapCore);
|
procedure BMPRotate180(const Bitmap: TDLBitmap);
|
||||||
procedure BMPRotate270(const Bitmap: TCustomRGBBitmapCore);
|
procedure BMPRotate270(const Bitmap: TDLBitmap);
|
||||||
function RotateBitmap(Bitmap: TCustomRGBBitmapCore; Angle: integer;
|
function RotateBitmap(Bitmap: TDLBitmap; Angle: integer;
|
||||||
BackColor: TColor): TCustomRGBBitmapCore;
|
BackColor: TColor): TDLBitmap;
|
||||||
function BitmapFlip(const Vertical: boolean; const Horizontal: boolean;
|
function BitmapFlip(const Vertical: boolean; const Horizontal: boolean;
|
||||||
var BitmapIn: TCustomRGBBitmapCore; out BitmapOut: TCustomRGBBitmapCore): boolean;
|
var BitmapIn: TDLBitmap; out BitmapOut: TDLBitmap): boolean;
|
||||||
procedure InvertBitmap(aBitmap: TCustomRGBBitmapCore);
|
procedure InvertBitmap(aBitmap: TDLBitmap);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
procedure LazBMPRotate90(const aBitmap: TCustomRGBBitmapCore; IsTurnRight: boolean);
|
procedure LazBMPRotate90(const aBitmap: TDLBitmap; IsTurnRight: boolean);
|
||||||
var
|
var
|
||||||
i, j: integer;
|
i, j: integer;
|
||||||
rowIn, rowOut: PRGBTripleArray;
|
rowIn, rowOut: PRGBTripleArray;
|
||||||
Bmp: TCustomRGBBitmapCore;
|
Bmp: TDLBitmap;
|
||||||
Width, Height: integer;
|
Width, Height: integer;
|
||||||
IntfImg1, IntfImg2: TLazIntfImage;
|
IntfImg1, IntfImg2: TLazIntfImage;
|
||||||
ImgHandle, ImgMaskHandle: HBitmap;
|
ImgHandle, ImgMaskHandle: HBitmap;
|
||||||
begin
|
begin
|
||||||
Bmp := TCustomRGBBitmapCore.Create;
|
Bmp := TDLBitmap.Create;
|
||||||
Bmp.Width := aBitmap.Height;
|
Bmp.Width := aBitmap.Height;
|
||||||
Bmp.Height := aBitmap.Width;
|
Bmp.Height := aBitmap.Width;
|
||||||
Bmp.PixelFormat := pf24bit;
|
Bmp.PixelFormat := pf24bit;
|
||||||
@ -107,18 +108,16 @@ begin
|
|||||||
Bmp.Free;
|
Bmp.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure BMPRotate90(const Bitmap: TCustomRGBBitmapCore);
|
procedure BMPRotate90(const Bitmap: TDLBitmap);
|
||||||
var
|
var
|
||||||
i, j: integer;
|
i, j: integer;
|
||||||
rowIn, rowOut: PRGBTripleArray;
|
rowIn, rowOut: pRGBTriple;
|
||||||
Bmp: TCustomRGBBitmapCore;
|
Bmp: TDLBitmap;
|
||||||
Width, Height: integer;
|
Width, Height: integer;
|
||||||
begin
|
begin
|
||||||
Bmp := TCustomRGBBitmapCore.Create;
|
Bmp := TDLBitmap.Create;
|
||||||
Bmp.Width := Bitmap.Height;
|
Bmp.Width := Bitmap.Height;
|
||||||
Bmp.Height := Bitmap.Width;
|
Bmp.Height := Bitmap.Width;
|
||||||
Bmp.OpenScanLine;
|
|
||||||
Bitmap.OpenScanLine;
|
|
||||||
Width := Bitmap.Width - 1;
|
Width := Bitmap.Width - 1;
|
||||||
Height := Bitmap.Height - 1;
|
Height := Bitmap.Height - 1;
|
||||||
for j := 0 to Height do
|
for j := 0 to Height do
|
||||||
@ -127,29 +126,26 @@ begin
|
|||||||
for i := 0 to Width do
|
for i := 0 to Width do
|
||||||
begin
|
begin
|
||||||
rowOut := Bmp.ScanLine[i];
|
rowOut := Bmp.ScanLine[i];
|
||||||
rowOut^[Height - j] := rowIn^[i];
|
rowOut[Height - j] := rowIn[i];
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
Bmp.CloseScanLine;
|
Bmp.InvalidateScanLine;
|
||||||
Bitmap.CloseScanLine;
|
|
||||||
Bitmap.Assign(Bmp);
|
Bitmap.Assign(Bmp);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure BMPRotate180(const Bitmap: TCustomRGBBitmapCore);
|
procedure BMPRotate180(const Bitmap: TDLBitmap);
|
||||||
var
|
var
|
||||||
i, j: integer;
|
i, j: integer;
|
||||||
rowIn, rowOut: pRGBTriple;
|
rowIn, rowOut: pRGBTriple;
|
||||||
Bmp: TCustomRGBBitmapCore;
|
Bmp: TDLBitmap;
|
||||||
Width, Height: integer;
|
Width, Height: integer;
|
||||||
begin
|
begin
|
||||||
Bmp := TCustomRGBBitmapCore.Create;
|
Bmp := TDLBitmap.Create;
|
||||||
Bmp.Width := Bitmap.Width;
|
Bmp.Width := Bitmap.Width;
|
||||||
Bmp.Height := Bitmap.Height;
|
Bmp.Height := Bitmap.Height;
|
||||||
Bmp.PixelFormat := pf24bit;
|
Bmp.PixelFormat := pf24bit;
|
||||||
Width := Bitmap.Width - 1;
|
Width := Bitmap.Width - 1;
|
||||||
Height := Bitmap.Height - 1;
|
Height := Bitmap.Height - 1;
|
||||||
Bmp.OpenScanLine;
|
|
||||||
Bitmap.OpenScanLine;
|
|
||||||
for j := 0 to Height do
|
for j := 0 to Height do
|
||||||
begin
|
begin
|
||||||
rowIn := Bitmap.ScanLine[j];
|
rowIn := Bitmap.ScanLine[j];
|
||||||
@ -161,26 +157,24 @@ begin
|
|||||||
Inc(rowIn);
|
Inc(rowIn);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
Bmp.CloseScanLine;
|
Bmp.InvalidateScanLine;
|
||||||
Bitmap.CloseScanLine;
|
Bitmap.InvalidateScanLine;
|
||||||
Bitmap.Assign(Bmp);
|
Bitmap.Assign(Bmp);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure BMPRotate270(const Bitmap: TCustomRGBBitmapCore);
|
procedure BMPRotate270(const Bitmap: TDLBitmap);
|
||||||
var
|
var
|
||||||
i, j: integer;
|
i, j: integer;
|
||||||
rowIn, rowOut: pRGBTriple;
|
rowIn, rowOut: pRGBTriple;
|
||||||
Bmp: TCustomRGBBitmapCore;
|
Bmp: TDLBitmap;
|
||||||
Width, Height: integer;
|
Width, Height: integer;
|
||||||
begin
|
begin
|
||||||
Bmp := TCustomRGBBitmapCore.Create;
|
Bmp := TDLBitmap.Create;
|
||||||
Bmp.Width := Bitmap.Height;
|
Bmp.Width := Bitmap.Height;
|
||||||
Bmp.Height := Bitmap.Width;
|
Bmp.Height := Bitmap.Width;
|
||||||
Bmp.PixelFormat := pf24bit;
|
Bmp.PixelFormat := pf24bit;
|
||||||
Width := Bitmap.Width - 1;
|
Width := Bitmap.Width - 1;
|
||||||
Height := Bitmap.Height - 1;
|
Height := Bitmap.Height - 1;
|
||||||
Bmp.OpenScanLine;
|
|
||||||
Bitmap.OpenScanLine;
|
|
||||||
for j := 0 to Height do
|
for j := 0 to Height do
|
||||||
begin
|
begin
|
||||||
rowIn := Bitmap.ScanLine[j];
|
rowIn := Bitmap.ScanLine[j];
|
||||||
@ -192,24 +186,21 @@ begin
|
|||||||
Inc(rowIn);
|
Inc(rowIn);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
Bmp.CloseScanLine;
|
Bmp.InvalidateScanLine;
|
||||||
Bitmap.CloseScanLine;
|
|
||||||
Bitmap.Assign(Bmp);
|
Bitmap.Assign(Bmp);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function RotateBitmap(Bitmap: TCustomRGBBitmapCore; Angle: integer;
|
function RotateBitmap(Bitmap: TDLBitmap; Angle: integer;
|
||||||
BackColor: TColor): TCustomRGBBitmapCore;
|
BackColor: TColor): TDLBitmap;
|
||||||
var
|
var
|
||||||
i, j, iOriginal, jOriginal, CosPoint, SinPoint: integer;
|
i, j, iOriginal, jOriginal, CosPoint, SinPoint: integer;
|
||||||
RowOriginal, RowRotated: pRGBTriple;
|
RowOriginal, RowRotated: pRGBTriple;
|
||||||
SinTheta, CosTheta: extended;
|
SinTheta, CosTheta: extended;
|
||||||
AngleAdd: integer;
|
AngleAdd: integer;
|
||||||
begin
|
begin
|
||||||
Result := TCustomRGBBitmapCore.Create;
|
Result := TDLBitmap.Create;
|
||||||
Result.PixelFormat := pf24bit;
|
Result.PixelFormat := pf24bit;
|
||||||
Result.Canvas.Brush.Color := BackColor;
|
Result.Canvas.Brush.Color := BackColor;
|
||||||
Result.OpenScanLine;
|
|
||||||
Bitmap.OpenScanLine;
|
|
||||||
Angle := Angle mod 360;
|
Angle := Angle mod 360;
|
||||||
if Angle < 0 then
|
if Angle < 0 then
|
||||||
Angle := 360 - Abs(Angle);
|
Angle := 360 - Abs(Angle);
|
||||||
@ -318,45 +309,42 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
Result.CloseScanLine;
|
Result.InvalidateScanLine;
|
||||||
Bitmap.CloseScanLine;
|
Bitmap.InvalidateScanLine;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure DrawSamePixel(ABitmap: TCustomRGBBitmapCore; Value: integer);
|
procedure DrawSamePixel(ABitmap: TDLBitmap; Value: integer);
|
||||||
var
|
var
|
||||||
LNew: TRGBTriple;
|
LNew: TRGBTriple;
|
||||||
LMinusRatio: real;
|
LMinusRatio: real;
|
||||||
LScan: PRGBTripleArray;
|
LScan: pRGBTriple;
|
||||||
i, j: integer;
|
i, j: integer;
|
||||||
begin
|
begin
|
||||||
aBitmap.OpenScanLine;
|
|
||||||
for i := 0 to ABitmap.Height - 1 do
|
for i := 0 to ABitmap.Height - 1 do
|
||||||
begin
|
begin
|
||||||
LScan := ABitmap.Scanline[i];
|
LScan := ABitmap.Scanline[i];
|
||||||
for j := 0 to ABitmap.Width - 1 do
|
for j := 0 to ABitmap.Width - 1 do
|
||||||
begin
|
begin
|
||||||
LNew := LScan^[j];
|
LNew := LScan[j];
|
||||||
LScan^[j].rgbtBlue := LScan^[j].rgbtBlue * Value div 100; //Value; //LNew.rgbtBlue;
|
LScan[j].rgbtBlue := LScan[j].rgbtBlue * Value div 100; //Value; //LNew.rgbtBlue;
|
||||||
LScan^[j].rgbtGreen := LScan^[j].rgbtGreen * Value div 100; //LNew.rgbtGreen;
|
LScan[j].rgbtGreen := LScan[j].rgbtGreen * Value div 100; //LNew.rgbtGreen;
|
||||||
LScan^[j].rgbtRed := LScan^[j].rgbtRed * Value div 100; //LNew.rgbtRed;
|
LScan[j].rgbtRed := LScan[j].rgbtRed * Value div 100; //LNew.rgbtRed;
|
||||||
//LScan^[j] := LNew;
|
//LScan[j] := LNew;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
ABitmap.CloseScanLine;
|
ABitmap.InvalidateScanLine;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function BitmapFlip(const Vertical: boolean; const Horizontal: boolean;
|
function BitmapFlip(const Vertical: boolean; const Horizontal: boolean;
|
||||||
var BitmapIn: TCustomRGBBitmapCore; out BitmapOut: TCustomRGBBitmapCore): boolean;
|
var BitmapIn: TDLBitmap; out BitmapOut: TDLBitmap): boolean;
|
||||||
var
|
var
|
||||||
DataIn: PRGBTripleArray;
|
DataIn: pRGBTriple;
|
||||||
DataOut: PRGBTripleArray;
|
DataOut: pRGBTriple;
|
||||||
inRow: integer;
|
inRow: integer;
|
||||||
inCol: integer;
|
inCol: integer;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
try
|
try
|
||||||
BitmapIn.OpenScanLine;
|
|
||||||
BitmapOut.OpenScanLine;
|
|
||||||
if BitmapIn.PixelFormat <> pf24bit then
|
if BitmapIn.PixelFormat <> pf24bit then
|
||||||
Exit;
|
Exit;
|
||||||
with BitmapOut do
|
with BitmapOut do
|
||||||
@ -379,90 +367,88 @@ begin
|
|||||||
if Horizontal then
|
if Horizontal then
|
||||||
begin
|
begin
|
||||||
for inCol := 0 to BitmapIn.Width - 1 do
|
for inCol := 0 to BitmapIn.Width - 1 do
|
||||||
DataOut^[inCol] := DataIn^[BitmapIn.Width - 1 - inCol];
|
DataOut[inCol] := DataIn[BitmapIn.Width - 1 - inCol];
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
for inCol := 0 to BitmapIn.Width - 1 do
|
for inCol := 0 to BitmapIn.Width - 1 do
|
||||||
DataOut^[inCol] := DataIn^[inCol];
|
DataOut[inCol] := DataIn[inCol];
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
Result := True;
|
Result := True;
|
||||||
BitmapIn.CloseScanLine;
|
BitmapOut.InvalidateScanLine;
|
||||||
BitmapOut.CloseScanLine;
|
|
||||||
except
|
except
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure InvertBitmap(aBitmap: TCustomRGBBitmapCore);
|
procedure InvertBitmap(aBitmap: TDLBitmap);
|
||||||
var
|
var
|
||||||
LNew: TRGBTriple;
|
LNew: TRGBTriple;
|
||||||
LMinusRatio: real;
|
LMinusRatio: real;
|
||||||
LScan: PRGBTripleArray;
|
LScan: pRGBTriple;
|
||||||
i, j: integer;
|
i, j: integer;
|
||||||
begin
|
begin
|
||||||
aBitmap.OpenScanLine;
|
|
||||||
for i := 0 to ABitmap.Height - 1 do
|
for i := 0 to ABitmap.Height - 1 do
|
||||||
begin
|
begin
|
||||||
LScan := ABitmap.Scanline[i];
|
LScan := ABitmap.Scanline[i];
|
||||||
for j := 0 to ABitmap.Width - 1 do
|
for j := 0 to ABitmap.Width - 1 do
|
||||||
begin
|
begin
|
||||||
LNew := LScan^[j];
|
LNew := LScan[j];
|
||||||
LScan^[j].rgbtBlue := not LScan^[j].rgbtBlue;
|
LScan[j].rgbtBlue := not LScan[j].rgbtBlue;
|
||||||
LScan^[j].rgbtGreen := not LScan^[j].rgbtGreen;
|
LScan[j].rgbtGreen := not LScan[j].rgbtGreen;
|
||||||
LScan^[j].rgbtRed := not LScan^[j].rgbtRed;
|
LScan[j].rgbtRed := not LScan[j].rgbtRed;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
ABitmap.CloseScanLine;
|
ABitmap.InvalidateScanLine;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ConvertBitmapToGrayScale(const Bitmap: TCustomRGBBitmapCore);
|
procedure ConvertBitmapToGrayScale(const Bitmap: TDLBitmap);
|
||||||
var
|
var
|
||||||
X: integer;
|
X: integer;
|
||||||
Y: integer;
|
Y: integer;
|
||||||
P: PRGBTripleArray;
|
P: pRGBTriple;
|
||||||
Gray: byte;
|
Gray: byte;
|
||||||
begin
|
begin
|
||||||
Bitmap.OpenScanLine;
|
|
||||||
for Y := 0 to (Bitmap.Height - 1) do
|
for Y := 0 to (Bitmap.Height - 1) do
|
||||||
begin
|
begin
|
||||||
P := Bitmap.ScanLine[Y];
|
P := Bitmap.ScanLine[Y];
|
||||||
for X := 0 to (Bitmap.Width - 1) do
|
for X := 0 to (Bitmap.Width - 1) do
|
||||||
begin
|
begin
|
||||||
Gray := Round(0.30 * P^[X].rgbtBlue + 0.59 * P^[X].rgbtGreen +
|
Gray := Round(0.30 * P[X].rgbtBlue + 0.59 * P[X].rgbtGreen +
|
||||||
0.11 * P^[X].rgbtRed);
|
0.11 * P[X].rgbtRed);
|
||||||
P^[X].rgbtRed := Gray;
|
P[X].rgbtRed := Gray;
|
||||||
P^[X].rgbtGreen := Gray;
|
P[X].rgbtGreen := Gray;
|
||||||
P^[X].rgbtBlue := Gray;
|
P[X].rgbtBlue := Gray;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
Bitmap.CloseScanLine;
|
Bitmap.InvalidateScanLine;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TCustomRGBBitmapCore.Create;
|
constructor TDLBitmap.Create;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
PixelFormat := pf24bit;
|
PixelFormat := pf24bit;
|
||||||
|
FIntfImgA := TLazIntfImage.Create(0, 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TCustomRGBBitmapCore.Destroy;
|
destructor TDLBitmap.Destroy;
|
||||||
begin
|
begin
|
||||||
|
FIntfImgA.Free;
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomRGBBitmapCore.GetScanLine(Row: integer): Pointer;
|
function TDLBitmap.GetScanLine(Row: integer): pRGBTriple;
|
||||||
begin
|
begin
|
||||||
if FIntfImgA <> nil then
|
if FIntfImgA <> nil then
|
||||||
Result := FIntfImgA.GetDataLineStart(Row);
|
Result := FIntfImgA.GetDataLineStart(Row);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRGBBitmapCore.OpenScanLine;
|
procedure TDLBitmap.ResetScanLine;
|
||||||
begin
|
begin
|
||||||
FIntfImgA := TLazIntfImage.Create(0, 0);
|
|
||||||
FIntfImgA.LoadFromBitmap(Handle, MaskHandle);
|
FIntfImgA.LoadFromBitmap(Handle, MaskHandle);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRGBBitmapCore.CloseScanLine;
|
procedure TDLBitmap.InvalidateScanLine;
|
||||||
var
|
var
|
||||||
TmpBmp: TBitmap;
|
TmpBmp: TBitmap;
|
||||||
ImgHandle, ImgMaskHandle: HBitmap;
|
ImgHandle, ImgMaskHandle: HBitmap;
|
||||||
@ -477,104 +463,105 @@ begin
|
|||||||
Height := TmpBmp.Height;
|
Height := TmpBmp.Height;
|
||||||
Canvas.Draw(0, 0, TmpBmp);
|
Canvas.Draw(0, 0, TmpBmp);
|
||||||
TmpBmp.Free;
|
TmpBmp.Free;
|
||||||
FIntfImgA.Free;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRGBBitmapCore.CutToClipboard;
|
procedure TDLBitmap.CutToClipboard;
|
||||||
begin
|
begin
|
||||||
CopyToClipboard;
|
CopyToClipboard;
|
||||||
Delete;
|
Delete;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRGBBitmapCore.CopyToClipboard;
|
procedure TDLBitmap.CopyToClipboard;
|
||||||
begin
|
begin
|
||||||
ClipBoard.Assign(Self);
|
ClipBoard.Assign(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRGBBitmapCore.PasteFromClipboard;
|
procedure TDLBitmap.PasteFromClipboard;
|
||||||
var
|
var
|
||||||
oBmp: TBitmap;
|
oBmp: TBitmap;
|
||||||
begin
|
begin
|
||||||
oBmp := TBitmap.Create;
|
oBmp := TBitmap.Create;
|
||||||
try
|
try
|
||||||
oBmp.LoadFromClipboardFormat(PredefinedClipboardFormat(pcfDelphiBitmap));
|
oBmp.LoadFromClipboardFormat(PredefinedClipboardFormat(pcfDelphiBitmap));
|
||||||
//Width := oBmp.Width;
|
|
||||||
//Height := oBmp.Height;
|
|
||||||
Canvas.Draw(0, 0, oBmp);
|
Canvas.Draw(0, 0, oBmp);
|
||||||
finally
|
finally
|
||||||
oBmp.Free;
|
oBmp.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRGBBitmapCore.Delete;
|
procedure TDLBitmap.Delete;
|
||||||
begin
|
begin
|
||||||
Canvas.Brush.Style := bsSolid;
|
Canvas.Brush.Style := bsSolid;
|
||||||
Canvas.Brush.Color := PaperColor;
|
Canvas.Brush.Color := PaperColor;
|
||||||
Canvas.FillRect(0, 0, Width, Height);
|
Canvas.FillRect(0, 0, Width, Height);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRGBBitmapCore.Assign(Source: TPersistent);
|
procedure TDLBitmap.Assign(Source: TPersistent);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomRGBBitmapCore.GetFillColor: TColor;
|
function TDLBitmap.GetFillColor: TColor;
|
||||||
begin
|
begin
|
||||||
Result := FFillColor;
|
Result := FFillColor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomRGBBitmapCore.GetOutlineColor: TColor;
|
function TDLBitmap.GetOutlineColor: TColor;
|
||||||
begin
|
begin
|
||||||
Result := FOutlineColor;
|
Result := FOutlineColor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomRGBBitmapCore.GetPaperColor: TColor;
|
function TDLBitmap.GetPaperColor: TColor;
|
||||||
begin
|
begin
|
||||||
Result := FPaperColor;
|
Result := FPaperColor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRGBBitmapCore.SetFillColor(const AValue: TColor);
|
procedure TDLBitmap.SetFillColor(const AValue: TColor);
|
||||||
begin
|
begin
|
||||||
FFillColor := AValue;
|
FFillColor := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRGBBitmapCore.SetOutlineColor(const AValue: TColor);
|
procedure TDLBitmap.SetOutlineColor(const AValue: TColor);
|
||||||
begin
|
begin
|
||||||
FOutlineColor := AValue;
|
FOutlineColor := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRGBBitmapCore.SetPaperColor(const AValue: TColor);
|
procedure TDLBitmap.SetPaperColor(const AValue: TColor);
|
||||||
begin
|
begin
|
||||||
FPaperColor := AValue;
|
FPaperColor := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRGBBitmapCore.SetWidth(Value: integer);
|
procedure TDLBitmap.SetWidth(Value: integer);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRGBBitmapCore.SetHeight(Value: integer);
|
procedure TDLBitmap.SetHeight(Value: integer);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRGBBitmapCore.Clear;
|
procedure TDLBitmap.Changed(Sender: TObject);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
ResetScanLine;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TDLBitmap.Clear;
|
||||||
begin
|
begin
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRGBBitmapCore.ClearWhite;
|
procedure TDLBitmap.ClearWhite;
|
||||||
begin
|
begin
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRGBBitmapCore.Invert;
|
procedure TDLBitmap.Invert;
|
||||||
var
|
var
|
||||||
tmp: TCustomRGBBitmapCore;
|
tmp: TDLBitmap;
|
||||||
begin
|
begin
|
||||||
tmp := TCustomRGBBitmapCore.Create;
|
tmp := TDLBitmap.Create;
|
||||||
tmp.Width := Width;
|
tmp.Width := Width;
|
||||||
tmp.Height := Height;
|
tmp.Height := Height;
|
||||||
tmp.Canvas.Draw(0, 0, Self);
|
tmp.Canvas.Draw(0, 0, Self);
|
||||||
@ -583,12 +570,11 @@ begin
|
|||||||
tmp.Free;
|
tmp.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TDLBitmap.Grayscale;
|
||||||
procedure TCustomRGBBitmapCore.Grayscale;
|
|
||||||
var
|
var
|
||||||
tmp: TCustomRGBBitmapCore;
|
tmp: TDLBitmap;
|
||||||
begin
|
begin
|
||||||
tmp := TCustomRGBBitmapCore.Create;
|
tmp := TDLBitmap.Create;
|
||||||
tmp.Width := Width;
|
tmp.Width := Width;
|
||||||
tmp.Height := Height;
|
tmp.Height := Height;
|
||||||
tmp.Canvas.Draw(0, 0, Self);
|
tmp.Canvas.Draw(0, 0, Self);
|
||||||
@ -597,14 +583,14 @@ begin
|
|||||||
tmp.Free;
|
tmp.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRGBBitmapCore.FlipHorz;
|
procedure TDLBitmap.FlipHorz;
|
||||||
var
|
var
|
||||||
tmp, tmp2: TCustomRGBBitmapCore;
|
tmp, tmp2: TDLBitmap;
|
||||||
begin
|
begin
|
||||||
tmp := TCustomRGBBitmapCore.Create;
|
tmp := TDLBitmap.Create;
|
||||||
tmp.Width := Width;
|
tmp.Width := Width;
|
||||||
tmp.Height := Height;
|
tmp.Height := Height;
|
||||||
tmp2 := TCustomRGBBitmapCore.Create;
|
tmp2 := TDLBitmap.Create;
|
||||||
tmp2.Width := Width;
|
tmp2.Width := Width;
|
||||||
tmp2.Height := Height;
|
tmp2.Height := Height;
|
||||||
tmp.PixelFormat := pf24bit;
|
tmp.PixelFormat := pf24bit;
|
||||||
@ -616,14 +602,14 @@ begin
|
|||||||
tmp2.Free;
|
tmp2.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRGBBitmapCore.FlipVert;
|
procedure TDLBitmap.FlipVert;
|
||||||
var
|
var
|
||||||
tmp, tmp2: TCustomRGBBitmapCore;
|
tmp, tmp2: TDLBitmap;
|
||||||
begin
|
begin
|
||||||
tmp := TCustomRGBBitmapCore.Create;
|
tmp := TDLBitmap.Create;
|
||||||
tmp.Width := Width;
|
tmp.Width := Width;
|
||||||
tmp.Height := Height;
|
tmp.Height := Height;
|
||||||
tmp2 := TCustomRGBBitmapCore.Create;
|
tmp2 := TDLBitmap.Create;
|
||||||
tmp2.Width := Width;
|
tmp2.Width := Width;
|
||||||
tmp2.Height := Height;
|
tmp2.Height := Height;
|
||||||
tmp.PixelFormat := pf24bit;
|
tmp.PixelFormat := pf24bit;
|
||||||
@ -635,11 +621,11 @@ begin
|
|||||||
tmp2.Free;
|
tmp2.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRGBBitmapCore.Rotate90;
|
procedure TDLBitmap.Rotate90;
|
||||||
var
|
var
|
||||||
tmp: TCustomRGBBitmapCore;
|
tmp: TDLBitmap;
|
||||||
begin
|
begin
|
||||||
tmp := TCustomRGBBitmapCore.Create;
|
tmp := TDLBitmap.Create;
|
||||||
tmp.Width := Width;
|
tmp.Width := Width;
|
||||||
tmp.Height := Height;
|
tmp.Height := Height;
|
||||||
tmp.Canvas.Draw(0, 0, Self);
|
tmp.Canvas.Draw(0, 0, Self);
|
||||||
@ -650,11 +636,11 @@ begin
|
|||||||
tmp.Free;
|
tmp.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRGBBitmapCore.Rotate180;
|
procedure TDLBitmap.Rotate180;
|
||||||
var
|
var
|
||||||
tmp: TCustomRGBBitmapCore;
|
tmp: TDLBitmap;
|
||||||
begin
|
begin
|
||||||
tmp := TCustomRGBBitmapCore.Create;
|
tmp := TDLBitmap.Create;
|
||||||
tmp.Width := Width;
|
tmp.Width := Width;
|
||||||
tmp.Height := Height;
|
tmp.Height := Height;
|
||||||
tmp.Canvas.Draw(0, 0, Self);
|
tmp.Canvas.Draw(0, 0, Self);
|
||||||
@ -665,11 +651,11 @@ begin
|
|||||||
tmp.Free;
|
tmp.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRGBBitmapCore.Rotate270;
|
procedure TDLBitmap.Rotate270;
|
||||||
var
|
var
|
||||||
tmp: TCustomRGBBitmapCore;
|
tmp: TDLBitmap;
|
||||||
begin
|
begin
|
||||||
tmp := TCustomRGBBitmapCore.Create;
|
tmp := TDLBitmap.Create;
|
||||||
tmp.Width := Width;
|
tmp.Width := Width;
|
||||||
tmp.Height := Height;
|
tmp.Height := Height;
|
||||||
tmp.Canvas.Draw(0, 0, Self);
|
tmp.Canvas.Draw(0, 0, Self);
|
||||||
@ -680,7 +666,7 @@ begin
|
|||||||
tmp.Free;
|
tmp.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRGBBitmapCore.FillEllipse(X1, Y1, X2, Y2: integer);
|
procedure TDLBitmap.FillEllipse(X1, Y1, X2, Y2: integer);
|
||||||
begin
|
begin
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
Reference in New Issue
Block a user