mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-28 20:12:16 -05:00
I thought I would contribute..
Just some small optimizations, is Ray's CTS2 comparison being fully implemented? If so, there are several procedures in finder.pas that need to be updated. Also, the FindColorsArea, should it be done like the other finders? I think several functions are not yet passed to PS, FindColors? Unless the function list is not complete in its actually list. Anyways, merry christmas to those who celebrate, and happy holidays to everyone else :) git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@336 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
parent
eb1f32e7b1
commit
a176b953e1
@ -10,7 +10,7 @@
|
|||||||
<TargetFileExt Value=""/>
|
<TargetFileExt Value=""/>
|
||||||
<Title Value="Mufasa Stand Alone"/>
|
<Title Value="Mufasa Stand Alone"/>
|
||||||
<UseXPManifest Value="True"/>
|
<UseXPManifest Value="True"/>
|
||||||
<ActiveEditorIndexAtStart Value="4"/>
|
<ActiveEditorIndexAtStart Value="1"/>
|
||||||
</General>
|
</General>
|
||||||
<VersionInfo>
|
<VersionInfo>
|
||||||
<ProjectVersion Value=""/>
|
<ProjectVersion Value=""/>
|
||||||
@ -139,7 +139,7 @@
|
|||||||
<UnitName Value="TestUnit"/>
|
<UnitName Value="TestUnit"/>
|
||||||
<CursorPos X="153" Y="986"/>
|
<CursorPos X="153" Y="986"/>
|
||||||
<TopLine Value="955"/>
|
<TopLine Value="955"/>
|
||||||
<EditorIndex Value="5"/>
|
<EditorIndex Value="7"/>
|
||||||
<UsageCount Value="202"/>
|
<UsageCount Value="202"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit13>
|
</Unit13>
|
||||||
@ -258,8 +258,8 @@
|
|||||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="finder"/>
|
<UnitName Value="finder"/>
|
||||||
<CursorPos X="17" Y="1826"/>
|
<CursorPos X="22" Y="863"/>
|
||||||
<TopLine Value="1807"/>
|
<TopLine Value="1464"/>
|
||||||
<UsageCount Value="201"/>
|
<UsageCount Value="201"/>
|
||||||
</Unit29>
|
</Unit29>
|
||||||
<Unit30>
|
<Unit30>
|
||||||
@ -360,8 +360,8 @@
|
|||||||
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
|
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="bitmaps"/>
|
<UnitName Value="bitmaps"/>
|
||||||
<CursorPos X="43" Y="326"/>
|
<CursorPos X="15" Y="808"/>
|
||||||
<TopLine Value="308"/>
|
<TopLine Value="789"/>
|
||||||
<EditorIndex Value="1"/>
|
<EditorIndex Value="1"/>
|
||||||
<UsageCount Value="200"/>
|
<UsageCount Value="200"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
@ -640,9 +640,11 @@
|
|||||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="dtm"/>
|
<UnitName Value="dtm"/>
|
||||||
<CursorPos X="36" Y="139"/>
|
<CursorPos X="34" Y="465"/>
|
||||||
<TopLine Value="133"/>
|
<TopLine Value="440"/>
|
||||||
|
<EditorIndex Value="5"/>
|
||||||
<UsageCount Value="200"/>
|
<UsageCount Value="200"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
</Unit86>
|
</Unit86>
|
||||||
<Unit87>
|
<Unit87>
|
||||||
<Filename Value="../../../cogat/Units/CogatUnits/comppicker.pas"/>
|
<Filename Value="../../../cogat/Units/CogatUnits/comppicker.pas"/>
|
||||||
@ -715,8 +717,10 @@
|
|||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="dtmutil"/>
|
<UnitName Value="dtmutil"/>
|
||||||
<CursorPos X="21" Y="216"/>
|
<CursorPos X="21" Y="216"/>
|
||||||
<TopLine Value="196"/>
|
<TopLine Value="28"/>
|
||||||
|
<EditorIndex Value="6"/>
|
||||||
<UsageCount Value="206"/>
|
<UsageCount Value="206"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
</Unit96>
|
</Unit96>
|
||||||
<Unit97>
|
<Unit97>
|
||||||
<Filename Value="../../../cogat/Units/CogatUnits/compmaths.pas"/>
|
<Filename Value="../../../cogat/Units/CogatUnits/compmaths.pas"/>
|
||||||
@ -1115,7 +1119,7 @@
|
|||||||
<UnitName Value="framescript"/>
|
<UnitName Value="framescript"/>
|
||||||
<CursorPos X="45" Y="165"/>
|
<CursorPos X="45" Y="165"/>
|
||||||
<TopLine Value="137"/>
|
<TopLine Value="137"/>
|
||||||
<EditorIndex Value="7"/>
|
<EditorIndex Value="8"/>
|
||||||
<UsageCount Value="200"/>
|
<UsageCount Value="200"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit151>
|
</Unit151>
|
||||||
@ -1432,7 +1436,7 @@
|
|||||||
<CursorPos X="39" Y="310"/>
|
<CursorPos X="39" Y="310"/>
|
||||||
<TopLine Value="290"/>
|
<TopLine Value="290"/>
|
||||||
<EditorIndex Value="3"/>
|
<EditorIndex Value="3"/>
|
||||||
<UsageCount Value="179"/>
|
<UsageCount Value="180"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit198>
|
</Unit198>
|
||||||
<Unit199>
|
<Unit199>
|
||||||
@ -1683,7 +1687,7 @@
|
|||||||
<UnitName Value="about"/>
|
<UnitName Value="about"/>
|
||||||
<CursorPos X="44" Y="21"/>
|
<CursorPos X="44" Y="21"/>
|
||||||
<TopLine Value="4"/>
|
<TopLine Value="4"/>
|
||||||
<UsageCount Value="142"/>
|
<UsageCount Value="143"/>
|
||||||
</Unit235>
|
</Unit235>
|
||||||
<Unit236>
|
<Unit236>
|
||||||
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/file.inc"/>
|
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/file.inc"/>
|
||||||
@ -1697,7 +1701,7 @@
|
|||||||
<UnitName Value="internets"/>
|
<UnitName Value="internets"/>
|
||||||
<CursorPos X="87" Y="3"/>
|
<CursorPos X="87" Y="3"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="1"/>
|
||||||
<UsageCount Value="136"/>
|
<UsageCount Value="137"/>
|
||||||
</Unit237>
|
</Unit237>
|
||||||
<Unit238>
|
<Unit238>
|
||||||
<Filename Value="debugimageform.pas"/>
|
<Filename Value="debugimageform.pas"/>
|
||||||
@ -1706,7 +1710,7 @@
|
|||||||
<UnitName Value="debugimageform"/>
|
<UnitName Value="debugimageform"/>
|
||||||
<CursorPos X="20" Y="1"/>
|
<CursorPos X="20" Y="1"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="1"/>
|
||||||
<UsageCount Value="123"/>
|
<UsageCount Value="124"/>
|
||||||
</Unit238>
|
</Unit238>
|
||||||
<Unit239>
|
<Unit239>
|
||||||
<Filename Value="debugimage.pas"/>
|
<Filename Value="debugimage.pas"/>
|
||||||
@ -1717,7 +1721,7 @@
|
|||||||
<CursorPos X="59" Y="23"/>
|
<CursorPos X="59" Y="23"/>
|
||||||
<TopLine Value="88"/>
|
<TopLine Value="88"/>
|
||||||
<EditorIndex Value="4"/>
|
<EditorIndex Value="4"/>
|
||||||
<UsageCount Value="122"/>
|
<UsageCount Value="123"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit239>
|
</Unit239>
|
||||||
<Unit240>
|
<Unit240>
|
||||||
@ -1840,9 +1844,7 @@
|
|||||||
<UnitName Value="framefunctionlist"/>
|
<UnitName Value="framefunctionlist"/>
|
||||||
<CursorPos X="56" Y="9"/>
|
<CursorPos X="56" Y="9"/>
|
||||||
<TopLine Value="54"/>
|
<TopLine Value="54"/>
|
||||||
<EditorIndex Value="6"/>
|
<UsageCount Value="44"/>
|
||||||
<UsageCount Value="43"/>
|
|
||||||
<Loaded Value="True"/>
|
|
||||||
</Unit257>
|
</Unit257>
|
||||||
<Unit258>
|
<Unit258>
|
||||||
<Filename Value="../../../usr/local/share/lazarus/lcl/comctrls.pp"/>
|
<Filename Value="../../../usr/local/share/lazarus/lcl/comctrls.pp"/>
|
||||||
@ -1897,8 +1899,8 @@
|
|||||||
<UnitName Value="simpleanalyzer"/>
|
<UnitName Value="simpleanalyzer"/>
|
||||||
<CursorPos X="52" Y="104"/>
|
<CursorPos X="52" Y="104"/>
|
||||||
<TopLine Value="193"/>
|
<TopLine Value="193"/>
|
||||||
<EditorIndex Value="8"/>
|
<EditorIndex Value="9"/>
|
||||||
<UsageCount Value="30"/>
|
<UsageCount Value="31"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit265>
|
</Unit265>
|
||||||
<Unit266>
|
<Unit266>
|
||||||
@ -1906,7 +1908,7 @@
|
|||||||
<UnitName Value="mPasLex"/>
|
<UnitName Value="mPasLex"/>
|
||||||
<CursorPos X="1" Y="1"/>
|
<CursorPos X="1" Y="1"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="1"/>
|
||||||
<EditorIndex Value="9"/>
|
<EditorIndex Value="10"/>
|
||||||
<UsageCount Value="15"/>
|
<UsageCount Value="15"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit266>
|
</Unit266>
|
||||||
@ -1931,107 +1933,63 @@
|
|||||||
<UsageCount Value="11"/>
|
<UsageCount Value="11"/>
|
||||||
</Unit269>
|
</Unit269>
|
||||||
</Units>
|
</Units>
|
||||||
<JumpHistory Count="25" HistoryIndex="24">
|
<JumpHistory Count="14" HistoryIndex="13">
|
||||||
<Position1>
|
<Position1>
|
||||||
<Filename Value="framefunctionlist.pas"/>
|
|
||||||
<Caret Line="142" Column="1" TopLine="111"/>
|
|
||||||
</Position1>
|
|
||||||
<Position2>
|
|
||||||
<Filename Value="framefunctionlist.pas"/>
|
|
||||||
<Caret Line="141" Column="28" TopLine="113"/>
|
|
||||||
</Position2>
|
|
||||||
<Position3>
|
|
||||||
<Filename Value="testunit.pas"/>
|
<Filename Value="testunit.pas"/>
|
||||||
<Caret Line="969" Column="37" TopLine="960"/>
|
<Caret Line="969" Column="37" TopLine="960"/>
|
||||||
</Position3>
|
</Position1>
|
||||||
<Position4>
|
<Position2>
|
||||||
<Filename Value="testunit.pas"/>
|
<Filename Value="testunit.pas"/>
|
||||||
<Caret Line="984" Column="39" TopLine="973"/>
|
<Caret Line="984" Column="39" TopLine="973"/>
|
||||||
</Position4>
|
</Position2>
|
||||||
<Position5>
|
<Position3>
|
||||||
<Filename Value="framefunctionlist.pas"/>
|
|
||||||
<Caret Line="141" Column="62" TopLine="116"/>
|
|
||||||
</Position5>
|
|
||||||
<Position6>
|
|
||||||
<Filename Value="framefunctionlist.pas"/>
|
|
||||||
<Caret Line="117" Column="101" TopLine="87"/>
|
|
||||||
</Position6>
|
|
||||||
<Position7>
|
|
||||||
<Filename Value="framefunctionlist.pas"/>
|
|
||||||
<Caret Line="140" Column="51" TopLine="113"/>
|
|
||||||
</Position7>
|
|
||||||
<Position8>
|
|
||||||
<Filename Value="framefunctionlist.pas"/>
|
|
||||||
<Caret Line="138" Column="59" TopLine="107"/>
|
|
||||||
</Position8>
|
|
||||||
<Position9>
|
|
||||||
<Filename Value="framescript.pas"/>
|
<Filename Value="framescript.pas"/>
|
||||||
<Caret Line="19" Column="46" TopLine="17"/>
|
<Caret Line="19" Column="46" TopLine="17"/>
|
||||||
</Position9>
|
</Position3>
|
||||||
<Position10>
|
<Position4>
|
||||||
<Filename Value="framescript.pas"/>
|
<Filename Value="framescript.pas"/>
|
||||||
<Caret Line="33" Column="20" TopLine="17"/>
|
<Caret Line="33" Column="20" TopLine="17"/>
|
||||||
</Position10>
|
</Position4>
|
||||||
<Position11>
|
<Position5>
|
||||||
<Filename Value="framescript.pas"/>
|
<Filename Value="framescript.pas"/>
|
||||||
<Caret Line="175" Column="16" TopLine="137"/>
|
<Caret Line="175" Column="16" TopLine="137"/>
|
||||||
|
</Position5>
|
||||||
|
<Position6>
|
||||||
|
<Filename Value="testunit.pas"/>
|
||||||
|
<Caret Line="62" Column="15" TopLine="34"/>
|
||||||
|
</Position6>
|
||||||
|
<Position7>
|
||||||
|
<Filename Value="testunit.pas"/>
|
||||||
|
<Caret Line="100" Column="21" TopLine="72"/>
|
||||||
|
</Position7>
|
||||||
|
<Position8>
|
||||||
|
<Filename Value="testunit.pas"/>
|
||||||
|
<Caret Line="151" Column="17" TopLine="123"/>
|
||||||
|
</Position8>
|
||||||
|
<Position9>
|
||||||
|
<Filename Value="testunit.pas"/>
|
||||||
|
<Caret Line="193" Column="25" TopLine="165"/>
|
||||||
|
</Position9>
|
||||||
|
<Position10>
|
||||||
|
<Filename Value="testunit.pas"/>
|
||||||
|
<Caret Line="969" Column="42" TopLine="960"/>
|
||||||
|
</Position10>
|
||||||
|
<Position11>
|
||||||
|
<Filename Value="testunit.pas"/>
|
||||||
|
<Caret Line="984" Column="1" TopLine="959"/>
|
||||||
</Position11>
|
</Position11>
|
||||||
<Position12>
|
<Position12>
|
||||||
<Filename Value="framefunctionlist.pas"/>
|
<Filename Value="testunit.pas"/>
|
||||||
<Caret Line="139" Column="26" TopLine="113"/>
|
<Caret Line="983" Column="87" TopLine="955"/>
|
||||||
</Position12>
|
</Position12>
|
||||||
<Position13>
|
<Position13>
|
||||||
<Filename Value="testunit.pas"/>
|
<Filename Value="testunit.pas"/>
|
||||||
<Caret Line="62" Column="15" TopLine="34"/>
|
<Caret Line="984" Column="28" TopLine="955"/>
|
||||||
</Position13>
|
</Position13>
|
||||||
<Position14>
|
<Position14>
|
||||||
<Filename Value="testunit.pas"/>
|
|
||||||
<Caret Line="100" Column="21" TopLine="72"/>
|
|
||||||
</Position14>
|
|
||||||
<Position15>
|
|
||||||
<Filename Value="testunit.pas"/>
|
|
||||||
<Caret Line="151" Column="17" TopLine="123"/>
|
|
||||||
</Position15>
|
|
||||||
<Position16>
|
|
||||||
<Filename Value="testunit.pas"/>
|
|
||||||
<Caret Line="193" Column="25" TopLine="165"/>
|
|
||||||
</Position16>
|
|
||||||
<Position17>
|
|
||||||
<Filename Value="testunit.pas"/>
|
|
||||||
<Caret Line="969" Column="42" TopLine="960"/>
|
|
||||||
</Position17>
|
|
||||||
<Position18>
|
|
||||||
<Filename Value="framefunctionlist.pas"/>
|
|
||||||
<Caret Line="85" Column="7" TopLine="63"/>
|
|
||||||
</Position18>
|
|
||||||
<Position19>
|
|
||||||
<Filename Value="framefunctionlist.pas"/>
|
|
||||||
<Caret Line="84" Column="73" TopLine="56"/>
|
|
||||||
</Position19>
|
|
||||||
<Position20>
|
|
||||||
<Filename Value="testunit.pas"/>
|
|
||||||
<Caret Line="984" Column="1" TopLine="959"/>
|
|
||||||
</Position20>
|
|
||||||
<Position21>
|
|
||||||
<Filename Value="testunit.pas"/>
|
|
||||||
<Caret Line="983" Column="87" TopLine="955"/>
|
|
||||||
</Position21>
|
|
||||||
<Position22>
|
|
||||||
<Filename Value="testunit.pas"/>
|
|
||||||
<Caret Line="984" Column="28" TopLine="955"/>
|
|
||||||
</Position22>
|
|
||||||
<Position23>
|
|
||||||
<Filename Value="testunit.pas"/>
|
<Filename Value="testunit.pas"/>
|
||||||
<Caret Line="988" Column="72" TopLine="956"/>
|
<Caret Line="988" Column="72" TopLine="956"/>
|
||||||
</Position23>
|
</Position14>
|
||||||
<Position24>
|
|
||||||
<Filename Value="framefunctionlist.pas"/>
|
|
||||||
<Caret Line="124" Column="64" TopLine="117"/>
|
|
||||||
</Position24>
|
|
||||||
<Position25>
|
|
||||||
<Filename Value="framefunctionlist.pas"/>
|
|
||||||
<Caret Line="41" Column="23" TopLine="48"/>
|
|
||||||
</Position25>
|
|
||||||
</JumpHistory>
|
</JumpHistory>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
|
@ -575,7 +575,9 @@ begin
|
|||||||
if OldIndex > TabIndex then
|
if OldIndex > TabIndex then
|
||||||
PageControl1.TabIndex := OldIndex - 1
|
PageControl1.TabIndex := OldIndex - 1
|
||||||
else if OldIndex < TabIndex then
|
else if OldIndex < TabIndex then
|
||||||
PageControl1.TabIndex := OldIndex;
|
PageControl1.TabIndex := OldIndex
|
||||||
|
else
|
||||||
|
PageControl1.TabIndex:= TabIndex;
|
||||||
end;
|
end;
|
||||||
if tabs.count <= 1 then
|
if tabs.count <= 1 then
|
||||||
begin;
|
begin;
|
||||||
|
@ -173,6 +173,7 @@ function TMBitmaps.CreateMirroredBitmap(bitmap: Integer;
|
|||||||
var
|
var
|
||||||
w,h : integer;
|
w,h : integer;
|
||||||
y,x : integer;
|
y,x : integer;
|
||||||
|
f1, f2: Integer;
|
||||||
Source,Dest : PRGB32;
|
Source,Dest : PRGB32;
|
||||||
begin
|
begin
|
||||||
Source := Bmp[Bitmap].FData;
|
Source := Bmp[Bitmap].FData;
|
||||||
@ -184,15 +185,28 @@ begin
|
|||||||
Result := CreateBMP(w,h);
|
Result := CreateBMP(w,h);
|
||||||
Dest := BmpArray[Result].FData;
|
Dest := BmpArray[Result].FData;
|
||||||
case MirrorStyle of
|
case MirrorStyle of
|
||||||
MirrorWidth : for y := (h-1) downto 0 do
|
MirrorWidth :
|
||||||
for x := (w-1) downto 0 do
|
begin
|
||||||
Dest[y*w+x] := Source[y*w+w-1-x];
|
f1 := w*h;
|
||||||
MirrorHeight : for y := (h-1) downto 0 do
|
f2 := f1 + w - 1;
|
||||||
Move(Source[y*w],Dest[(h-1 - y) * w],w*SizeOf(TRGB32));
|
for y := (h-1) downto 0 do
|
||||||
MirrorLine : for y := (h-1) downto 0 do
|
|
||||||
for x := (w-1) downto 0 do
|
for x := (w-1) downto 0 do
|
||||||
|
Dest[f1+x] := Source[f2-x];
|
||||||
|
end;
|
||||||
|
MirrorHeight :
|
||||||
|
begin
|
||||||
|
f1 := h - 1;
|
||||||
|
for y := f1 downto 0 do // Does SizeOf(TRGB32) Change?
|
||||||
|
Move(Source[y*w], Dest[(f1 - y) * w], w*SizeOf(TRGB32));
|
||||||
|
end;
|
||||||
|
MirrorLine :
|
||||||
|
begin
|
||||||
|
f1 := h-1;
|
||||||
|
f2 := w-1;
|
||||||
|
for y := f1 downto 0 do
|
||||||
|
for x := f2 downto 0 do
|
||||||
Dest[x*h+y] := Source[y*w+x];
|
Dest[x*h+y] := Source[y*w+x];
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
//Can be optmized, this is just proof of concept
|
//Can be optmized, this is just proof of concept
|
||||||
end;
|
end;
|
||||||
@ -502,7 +516,7 @@ begin
|
|||||||
begin;
|
begin;
|
||||||
for i := (w-1) downto 0 do
|
for i := (w-1) downto 0 do
|
||||||
FData[i] := Rec;
|
FData[i] := Rec;
|
||||||
for i := (h-1) downto 1 do
|
for i := (h-1) downto 1 do // does SizeOf(TRGB32) Change?
|
||||||
Move(FData[0],FData[i*w],w*SizeOf(TRGB32));
|
Move(FData[0],FData[i*w],w*SizeOf(TRGB32));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -535,11 +549,12 @@ end;
|
|||||||
procedure TMufasaBitmap.FastReplaceColor(OldColor, NewColor: TColor);
|
procedure TMufasaBitmap.FastReplaceColor(OldColor, NewColor: TColor);
|
||||||
var
|
var
|
||||||
OldCol,NewCol : TRGB32;
|
OldCol,NewCol : TRGB32;
|
||||||
i : integer;
|
i, wh : integer;
|
||||||
begin
|
begin
|
||||||
OldCol := RGBToBGR(OldColor);
|
OldCol := RGBToBGR(OldColor);
|
||||||
NewCol := RGBToBGR(NewColor);
|
NewCol := RGBToBGR(NewColor);
|
||||||
for i := w*h-1 downto 0 do
|
wh := w*h-1;
|
||||||
|
for i := wh downto 0 do
|
||||||
if LongWord(FData[i]) = LongWord(OldCol) then
|
if LongWord(FData[i]) = LongWord(OldCol) then
|
||||||
FData[i] := NewCol;
|
FData[i] := NewCol;
|
||||||
end;
|
end;
|
||||||
@ -547,7 +562,7 @@ end;
|
|||||||
procedure TMufasaBitmap.CopyClientToBitmap(MWindow : TObject;Resize : boolean; xs, ys, xe, ye: Integer);
|
procedure TMufasaBitmap.CopyClientToBitmap(MWindow : TObject;Resize : boolean; xs, ys, xe, ye: Integer);
|
||||||
var
|
var
|
||||||
y : integer;
|
y : integer;
|
||||||
wi,hi : integer;
|
wi, hi, hh : integer;
|
||||||
PtrRet : TRetData;
|
PtrRet : TRetData;
|
||||||
begin
|
begin
|
||||||
if Resize then
|
if Resize then
|
||||||
@ -562,7 +577,8 @@ begin
|
|||||||
writeln('WAT y'); }
|
writeln('WAT y'); }
|
||||||
PtrRet := TMWindow(MWindow).ReturnData(xs,ys,wi,hi);
|
PtrRet := TMWindow(MWindow).ReturnData(xs,ys,wi,hi);
|
||||||
|
|
||||||
for y := 0 to (hi-1) do
|
hh := hi-1;
|
||||||
|
for y := 0 to hh do
|
||||||
Move(PtrRet.Ptr[y * (wi + PtrRet.IncPtrWith)], FData[y * self.w],wi * SizeOf(TRGB32));
|
Move(PtrRet.Ptr[y * (wi + PtrRet.IncPtrWith)], FData[y * self.w],wi * SizeOf(TRGB32));
|
||||||
TMWindow(MWindow).FreeReturnData;
|
TMWindow(MWindow).FreeReturnData;
|
||||||
end;
|
end;
|
||||||
@ -571,7 +587,7 @@ procedure TMufasaBitmap.CopyClientToBitmap(MWindow: TObject; Resize: boolean;
|
|||||||
x, y: integer; xs, ys, xe, ye: Integer);
|
x, y: integer; xs, ys, xe, ye: Integer);
|
||||||
var
|
var
|
||||||
yy : integer;
|
yy : integer;
|
||||||
wi,hi : integer;
|
wi,hi,hh : integer;
|
||||||
PtrRet : TRetData;
|
PtrRet : TRetData;
|
||||||
begin
|
begin
|
||||||
if Resize then
|
if Resize then
|
||||||
@ -580,7 +596,8 @@ begin
|
|||||||
hi := Min(ye-ys + 1 + y,Self.h);
|
hi := Min(ye-ys + 1 + y,Self.h);
|
||||||
PtrRet := TMWindow(MWindow).ReturnData(xs,ys,wi - x,hi - y);
|
PtrRet := TMWindow(MWindow).ReturnData(xs,ys,wi - x,hi - y);
|
||||||
|
|
||||||
for yy := 0 to (hi-1 - y) do
|
hh := hi-1-y;
|
||||||
|
for yy := 0 to hh do
|
||||||
Move(PtrRet.Ptr[yy * (wi - x + PtrRet.IncPtrWith)], FData[(yy + y) * self.w + x],wi * SizeOf(TRGB32));
|
Move(PtrRet.Ptr[yy * (wi - x + PtrRet.IncPtrWith)], FData[(yy + y) * self.w + x],wi * SizeOf(TRGB32));
|
||||||
TMWindow(MWindow).FreeReturnData;
|
TMWindow(MWindow).FreeReturnData;
|
||||||
end;
|
end;
|
||||||
@ -600,7 +617,7 @@ var
|
|||||||
CosAngle,SinAngle : extended;
|
CosAngle,SinAngle : extended;
|
||||||
MinX,MinY,MaxX,MaxY : integer;
|
MinX,MinY,MaxX,MaxY : integer;
|
||||||
i : integer;
|
i : integer;
|
||||||
x,y : integer;
|
x,y,hm1, wm1, yy, xx : integer;
|
||||||
OldX,OldY : integer;
|
OldX,OldY : integer;
|
||||||
MiddlePoint : TPoint;
|
MiddlePoint : TPoint;
|
||||||
NewCorners : array[1..4] of TPoint; //(xs,ye);(xe,ye);(xe,ys);(xs,ys)
|
NewCorners : array[1..4] of TPoint; //(xs,ye);(xe,ye);(xe,ys);(xs,ys)
|
||||||
@ -612,9 +629,11 @@ begin
|
|||||||
MinY := MaxInt;
|
MinY := MaxInt;
|
||||||
MaxX := 0;
|
MaxX := 0;
|
||||||
MaxY := 0;
|
MaxY := 0;
|
||||||
NewCorners[1]:= RotatePointEdited(Point(0,h-1),angle,middlepoint.x,middlepoint.y);
|
hm1 := h-1;
|
||||||
NewCorners[2]:= RotatePointEdited(Point(w-1,h-1),angle,middlepoint.x,middlepoint.y);
|
wm1 := w-1;
|
||||||
NewCorners[3]:= RotatePointEdited(Point(w-1,0),angle,middlepoint.x,middlepoint.y);
|
NewCorners[1]:= RotatePointEdited(Point(0,hm1),angle,middlepoint.x,middlepoint.y);
|
||||||
|
NewCorners[2]:= RotatePointEdited(Point(wm1,hm1),angle,middlepoint.x,middlepoint.y);
|
||||||
|
NewCorners[3]:= RotatePointEdited(Point(wm1,0),angle,middlepoint.x,middlepoint.y);
|
||||||
NewCorners[4]:= RotatePointEdited(Point(0,0),angle,middlepoint.x,middlepoint.y);
|
NewCorners[4]:= RotatePointEdited(Point(0,0),angle,middlepoint.x,middlepoint.y);
|
||||||
for i := 1 to 4 do
|
for i := 1 to 4 do
|
||||||
begin;
|
begin;
|
||||||
@ -632,11 +651,15 @@ begin
|
|||||||
NewH := MaxY - MinY+1;
|
NewH := MaxY - MinY+1;
|
||||||
Writeln(format('New bounds: %d,%d',[NewW,NewH]));
|
Writeln(format('New bounds: %d,%d',[NewW,NewH]));
|
||||||
TargetBitmap.SetSize(NewW,NewH);
|
TargetBitmap.SetSize(NewW,NewH);
|
||||||
for y := NewH - 1 downto 0 do
|
hm1 := NewH-1;
|
||||||
for x := NewW - 1 downto 0 do
|
wm1 := NewW-1;
|
||||||
|
xx := MinX-MiddlePoint.x;
|
||||||
|
yy := MinY-MiddlePoint.y;
|
||||||
|
for y := hm1 downto 0 do
|
||||||
|
for x := wm1 downto 0 do
|
||||||
begin;
|
begin;
|
||||||
Oldx := Round(MiddlePoint.x + CosAngle * (x + MinX-MiddlePoint.x) - SinAngle * (y + MinY - MiddlePoint.y));
|
Oldx := Round(MiddlePoint.x + CosAngle * (x + xx) - SinAngle * (y + yy));
|
||||||
Oldy := Round(MiddlePoint.y + SinAngle * (x + MinX-MiddlePoint.x) + CosAngle * (y + MinY-MiddlePoint.y));
|
Oldy := Round(MiddlePoint.y + SinAngle * (x + xx) + CosAngle * (y + yy));
|
||||||
if not ((Oldx <0) or (Oldx >= w) or (Oldy < 0) or (Oldy >= h)) then
|
if not ((Oldx <0) or (Oldx >= w) or (Oldy < 0) or (Oldy >= h)) then
|
||||||
TargetBitmap.FData[ y * NewW + x] := Self.FData[OldY * W + OldX];
|
TargetBitmap.FData[ y * NewW + x] := Self.FData[OldY * W + OldX];
|
||||||
end;
|
end;
|
||||||
@ -644,12 +667,13 @@ end;
|
|||||||
|
|
||||||
procedure TMufasaBitmap.Desaturate;
|
procedure TMufasaBitmap.Desaturate;
|
||||||
var
|
var
|
||||||
I : integer;
|
I, HH : integer;
|
||||||
He,Se,Le : extended;
|
He,Se,Le : extended;
|
||||||
Ptr : PRGB32;
|
Ptr : PRGB32;
|
||||||
begin
|
begin
|
||||||
Ptr := FData;
|
Ptr := FData;
|
||||||
for i := (h*w-1) downto 0 do
|
HH := h*w-1;
|
||||||
|
for i := HH downto 0 do
|
||||||
begin;
|
begin;
|
||||||
RGBToHSL(Ptr^.R,Ptr^.G,Ptr^.B,He,Se,Le);
|
RGBToHSL(Ptr^.R,Ptr^.G,Ptr^.B,He,Se,Le);
|
||||||
HSLtoRGB(He,0.0,Le,Ptr^.R,Ptr^.G,Ptr^.B);
|
HSLtoRGB(He,0.0,Le,Ptr^.R,Ptr^.G,Ptr^.B);
|
||||||
@ -659,14 +683,15 @@ end;
|
|||||||
|
|
||||||
procedure TMufasaBitmap.Desaturate(TargetBitmap: TMufasaBitmap);
|
procedure TMufasaBitmap.Desaturate(TargetBitmap: TMufasaBitmap);
|
||||||
var
|
var
|
||||||
I : integer;
|
I,HH : integer;
|
||||||
He,Se,Le : extended;
|
He,Se,Le : extended;
|
||||||
PtrOld,PtrNew : PRGB32;
|
PtrOld,PtrNew : PRGB32;
|
||||||
begin
|
begin
|
||||||
TargetBitmap.SetSize(w,h);
|
TargetBitmap.SetSize(w,h);
|
||||||
PtrOld := Self.FData;
|
PtrOld := Self.FData;
|
||||||
PtrNew := TargetBitmap.FData;
|
PtrNew := TargetBitmap.FData;
|
||||||
for i := (h*w-1) downto 0 do
|
HH := w*h-1;
|
||||||
|
for i := HH downto 0 do
|
||||||
begin;
|
begin;
|
||||||
RGBToHSL(PtrOld^.R,PtrOld^.G,PtrOld^.B,He,Se,Le);
|
RGBToHSL(PtrOld^.R,PtrOld^.G,PtrOld^.B,He,Se,Le);
|
||||||
HSLtoRGB(He,0.0,Le,PtrNew^.R,PtrNew^.G,PtrNew^.B);
|
HSLtoRGB(He,0.0,Le,PtrNew^.R,PtrNew^.G,PtrNew^.B);
|
||||||
@ -677,14 +702,15 @@ end;
|
|||||||
|
|
||||||
procedure TMufasaBitmap.GreyScale(TargetBitmap: TMufasaBitmap);
|
procedure TMufasaBitmap.GreyScale(TargetBitmap: TMufasaBitmap);
|
||||||
var
|
var
|
||||||
I : integer;
|
I, HH : integer;
|
||||||
Lum : byte;
|
Lum : byte;
|
||||||
PtrOld,PtrNew : PRGB32;
|
PtrOld,PtrNew : PRGB32;
|
||||||
begin
|
begin
|
||||||
TargetBitmap.SetSize(w,h);
|
TargetBitmap.SetSize(w,h);
|
||||||
PtrOld := Self.FData;
|
PtrOld := Self.FData;
|
||||||
PtrNew := TargetBitmap.FData;
|
PtrNew := TargetBitmap.FData;
|
||||||
for i := (h*w-1) downto 0 do
|
HH := h*w-1;
|
||||||
|
for i := HH downto 0 do
|
||||||
begin;
|
begin;
|
||||||
Lum := Round(PtrOld^.r * 0.3 + PtrOld^.g * 0.59 + PtrOld^.b * 0.11);
|
Lum := Round(PtrOld^.r * 0.3 + PtrOld^.g * 0.59 + PtrOld^.b * 0.11);
|
||||||
PtrNew^.r := Lum;
|
PtrNew^.r := Lum;
|
||||||
@ -697,12 +723,13 @@ end;
|
|||||||
|
|
||||||
procedure TMufasaBitmap.GreyScale;
|
procedure TMufasaBitmap.GreyScale;
|
||||||
var
|
var
|
||||||
I : integer;
|
I, HH : integer;
|
||||||
Lum : Byte;
|
Lum : Byte;
|
||||||
Ptr: PRGB32;
|
Ptr: PRGB32;
|
||||||
begin
|
begin
|
||||||
Ptr := Self.FData;
|
Ptr := Self.FData;
|
||||||
for i := (h*w-1) downto 0 do
|
HH := h*w-1;
|
||||||
|
for i := HH downto 0 do
|
||||||
begin;
|
begin;
|
||||||
Lum := Round(Ptr^.r * 0.3 + Ptr^.g * 0.59 + Ptr^.b * 0.11);
|
Lum := Round(Ptr^.r * 0.3 + Ptr^.g * 0.59 + Ptr^.b * 0.11);
|
||||||
Ptr^.r := Lum;
|
Ptr^.r := Lum;
|
||||||
@ -725,11 +752,12 @@ begin;
|
|||||||
end;
|
end;
|
||||||
procedure TMufasaBitmap.Brightness(br: integer);
|
procedure TMufasaBitmap.Brightness(br: integer);
|
||||||
var
|
var
|
||||||
I : integer;
|
I, hh : integer;
|
||||||
Ptr: PRGB32;
|
Ptr: PRGB32;
|
||||||
begin
|
begin
|
||||||
Ptr := Self.FData;
|
Ptr := Self.FData;
|
||||||
for i := (h*w-1) downto 0 do
|
hh := h*w-1;
|
||||||
|
for i := hh downto 0 do
|
||||||
begin;
|
begin;
|
||||||
Ptr^.r := BrigthnessAdjust(Ptr^.r,br);
|
Ptr^.r := BrigthnessAdjust(Ptr^.r,br);
|
||||||
Ptr^.g := BrigthnessAdjust(Ptr^.g,br);
|
Ptr^.g := BrigthnessAdjust(Ptr^.g,br);
|
||||||
@ -740,13 +768,14 @@ end;
|
|||||||
|
|
||||||
procedure TMufasaBitmap.Brightness(TargetBitmap: TMufasaBitmap; br: integer);
|
procedure TMufasaBitmap.Brightness(TargetBitmap: TMufasaBitmap; br: integer);
|
||||||
var
|
var
|
||||||
I : integer;
|
I, hh: integer;
|
||||||
PtrOld,PtrNew : PRGB32;
|
PtrOld,PtrNew : PRGB32;
|
||||||
begin
|
begin
|
||||||
TargetBitmap.SetSize(w,h);
|
TargetBitmap.SetSize(w,h);
|
||||||
PtrOld := Self.FData;
|
PtrOld := Self.FData;
|
||||||
PtrNew := TargetBitmap.FData;
|
PtrNew := TargetBitmap.FData;
|
||||||
for i := (h*w-1) downto 0 do
|
hh := h*w-1;
|
||||||
|
for i := hh downto 0 do
|
||||||
begin;
|
begin;
|
||||||
PtrNew^.r := BrigthnessAdjust(PtrOld^.r,br);
|
PtrNew^.r := BrigthnessAdjust(PtrOld^.r,br);
|
||||||
PtrNew^.g := BrigthnessAdjust(PtrOld^.g,br);
|
PtrNew^.g := BrigthnessAdjust(PtrOld^.g,br);
|
||||||
@ -772,11 +801,12 @@ end;
|
|||||||
|
|
||||||
procedure TMufasaBitmap.Contrast(co: Extended);
|
procedure TMufasaBitmap.Contrast(co: Extended);
|
||||||
var
|
var
|
||||||
I : integer;
|
I, hh: integer;
|
||||||
Ptr: PRGB32;
|
Ptr: PRGB32;
|
||||||
begin
|
begin
|
||||||
Ptr := Self.FData;
|
Ptr := Self.FData;
|
||||||
for i := (h*w-1) downto 0 do
|
hh := h*w-1;
|
||||||
|
for i := hh downto 0 do
|
||||||
begin;
|
begin;
|
||||||
Ptr^.r := ContrastAdjust(Ptr^.r,co);
|
Ptr^.r := ContrastAdjust(Ptr^.r,co);
|
||||||
Ptr^.g := ContrastAdjust(Ptr^.g,co);
|
Ptr^.g := ContrastAdjust(Ptr^.g,co);
|
||||||
@ -787,13 +817,14 @@ end;
|
|||||||
|
|
||||||
procedure TMufasaBitmap.Contrast(TargetBitmap: TMufasaBitmap; co: Extended);
|
procedure TMufasaBitmap.Contrast(TargetBitmap: TMufasaBitmap; co: Extended);
|
||||||
var
|
var
|
||||||
I : integer;
|
I,hh: integer;
|
||||||
PtrOld,PtrNew : PRGB32;
|
PtrOld,PtrNew : PRGB32;
|
||||||
begin
|
begin
|
||||||
TargetBitmap.SetSize(w,h);
|
TargetBitmap.SetSize(w,h);
|
||||||
PtrOld := Self.FData;
|
PtrOld := Self.FData;
|
||||||
PtrNew := TargetBitmap.FData;
|
PtrNew := TargetBitmap.FData;
|
||||||
for i := (h*w-1) downto 0 do
|
hh := h*w-1;
|
||||||
|
for i := hh downto 0 do
|
||||||
begin;
|
begin;
|
||||||
PtrNew^.r := ContrastAdjust(PtrOld^.r,co);
|
PtrNew^.r := ContrastAdjust(PtrOld^.r,co);
|
||||||
PtrNew^.g := ContrastAdjust(PtrOld^.g,co);
|
PtrNew^.g := ContrastAdjust(PtrOld^.g,co);
|
||||||
@ -805,9 +836,10 @@ end;
|
|||||||
|
|
||||||
procedure TMufasaBitmap.Invert;
|
procedure TMufasaBitmap.Invert;
|
||||||
var
|
var
|
||||||
i : integer;
|
i, hh : integer;
|
||||||
begin
|
begin
|
||||||
for i := (h*w-1) downto 0 do
|
hh := h*w-1;
|
||||||
|
for i := hh downto 0 do
|
||||||
begin;
|
begin;
|
||||||
Self.FData[i].r := not Self.FData[i].r;
|
Self.FData[i].r := not Self.FData[i].r;
|
||||||
Self.FData[i].g := not Self.FData[i].g;
|
Self.FData[i].g := not Self.FData[i].g;
|
||||||
@ -817,7 +849,7 @@ end;
|
|||||||
|
|
||||||
procedure TMufasaBitmap.Posterize(TargetBitmap: TMufasaBitmap; Po: integer);
|
procedure TMufasaBitmap.Posterize(TargetBitmap: TMufasaBitmap; Po: integer);
|
||||||
var
|
var
|
||||||
I : integer;
|
I,hh : integer;
|
||||||
PtrOld,PtrNew : PRGB32;
|
PtrOld,PtrNew : PRGB32;
|
||||||
begin
|
begin
|
||||||
if not InRange(Po,1,255) then
|
if not InRange(Po,1,255) then
|
||||||
@ -825,7 +857,8 @@ begin
|
|||||||
TargetBitmap.SetSize(w,h);
|
TargetBitmap.SetSize(w,h);
|
||||||
PtrOld := Self.FData;
|
PtrOld := Self.FData;
|
||||||
PtrNew := TargetBitmap.FData;
|
PtrNew := TargetBitmap.FData;
|
||||||
for i := (h*w-1) downto 0 do
|
hh := w*h-1;
|
||||||
|
for i := hh downto 0 do
|
||||||
begin;
|
begin;
|
||||||
PtrNew^.r := min(Round(PtrOld^.r / po) * Po, 255);
|
PtrNew^.r := min(Round(PtrOld^.r / po) * Po, 255);
|
||||||
PtrNew^.g := min(Round(PtrOld^.g / po) * Po, 255);
|
PtrNew^.g := min(Round(PtrOld^.g / po) * Po, 255);
|
||||||
@ -837,21 +870,22 @@ end;
|
|||||||
|
|
||||||
procedure TMufasaBitmap.Posterize(Po: integer);
|
procedure TMufasaBitmap.Posterize(Po: integer);
|
||||||
var
|
var
|
||||||
I : integer;
|
I,hh: integer;
|
||||||
Ptr: PRGB32;
|
Ptr: PRGB32;
|
||||||
{a:integer; }
|
{a:integer; }
|
||||||
begin
|
begin
|
||||||
if not InRange(Po,1,255) then
|
if not InRange(Po,1,255) then
|
||||||
Raise exception.CreateFmt('Posterize Po(%d) out of range[1,255]',[Po]);
|
Raise exception.CreateFmt('Posterize Po(%d) out of range[1,255]',[Po]);
|
||||||
Ptr := Self.FData;
|
Ptr := Self.FData;
|
||||||
for i := (h*w-1) downto 0 do
|
hh := w*h-1;
|
||||||
|
for i := hh downto 0 do
|
||||||
begin;
|
begin;
|
||||||
{ a := round(ptr^.r / po);
|
{ a := round(ptr^.r / po);
|
||||||
a := a * po;
|
a := a * po;
|
||||||
ptr^.r := min(a,255);
|
ptr^.r := min(a,255);
|
||||||
a := round(ptr^.g / po);
|
a := round(ptr^.g / po);
|
||||||
a := a * po;
|
a := a * po;
|
||||||
ptr^.g := min(a,255);
|
ptr^.g := min(a,255); // bit redundant math, aye?
|
||||||
a := round(ptr^.b / po);
|
a := round(ptr^.b / po);
|
||||||
a := a * po;
|
a := a * po;
|
||||||
ptr^.b := min(a,255); }
|
ptr^.b := min(a,255); }
|
||||||
|
@ -180,7 +180,7 @@ end;
|
|||||||
//SkipCoords[y][x] = False/True; True means its "transparent" and therefore not needed to be checked.
|
//SkipCoords[y][x] = False/True; True means its "transparent" and therefore not needed to be checked.
|
||||||
procedure CalculateBitmapSkipCoords(Bitmap : TMufasaBitmap; out SkipCoords : T2DBoolArray);
|
procedure CalculateBitmapSkipCoords(Bitmap : TMufasaBitmap; out SkipCoords : T2DBoolArray);
|
||||||
var
|
var
|
||||||
x,y : integer;
|
x,y,ww, hh : integer;
|
||||||
R,G,B : byte;
|
R,G,B : byte;
|
||||||
Ptr : PRGB32;
|
Ptr : PRGB32;
|
||||||
begin;
|
begin;
|
||||||
@ -191,8 +191,10 @@ begin;
|
|||||||
ColorToRGB(Bitmap.GetTransparentColor,r,g,b);
|
ColorToRGB(Bitmap.GetTransparentColor,r,g,b);
|
||||||
Ptr := Bitmap.FData;
|
Ptr := Bitmap.FData;
|
||||||
SetLength(SkipCoords,Bitmap.Height,Bitmap.Width);
|
SetLength(SkipCoords,Bitmap.Height,Bitmap.Width);
|
||||||
for y := 0 to Bitmap.Height - 1 do
|
ww := Bitmap.Width - 1;
|
||||||
for x := 0 to Bitmap.Width - 1 do
|
hh := Bitmap.Height - 1;
|
||||||
|
for y := 0 to hh do
|
||||||
|
for x := 0 to ww do
|
||||||
begin;
|
begin;
|
||||||
if (Ptr^.r = r) and (Ptr^.g = g) and (Ptr^.b = b) then
|
if (Ptr^.r = r) and (Ptr^.g = g) and (Ptr^.b = b) then
|
||||||
SkipCoords[y][x] := True
|
SkipCoords[y][x] := True
|
||||||
@ -204,7 +206,7 @@ end;
|
|||||||
//Points left holds the amount of points that are "left" to be checked (Including the point itself.. So for example Pointsleft[0][0] would hold the total amount of pixels that are to be checked.
|
//Points left holds the amount of points that are "left" to be checked (Including the point itself.. So for example Pointsleft[0][0] would hold the total amount of pixels that are to be checked.
|
||||||
procedure CalculateBitmapSkipCoordsEx(Bitmap : TMufasaBitmap; out SkipCoords : T2DBoolArray;out TotalPoints : integer; out PointsLeft : T2DIntArray);
|
procedure CalculateBitmapSkipCoordsEx(Bitmap : TMufasaBitmap; out SkipCoords : T2DBoolArray;out TotalPoints : integer; out PointsLeft : T2DIntArray);
|
||||||
var
|
var
|
||||||
x,y : integer;
|
x,y,ww,hh : integer;
|
||||||
R,G,B : byte;
|
R,G,B : byte;
|
||||||
Ptr : PRGB32;
|
Ptr : PRGB32;
|
||||||
TotalC : integer;
|
TotalC : integer;
|
||||||
@ -218,8 +220,10 @@ begin;
|
|||||||
Ptr := Bitmap.FData;
|
Ptr := Bitmap.FData;
|
||||||
SetLength(SkipCoords,Bitmap.Height,Bitmap.Width);
|
SetLength(SkipCoords,Bitmap.Height,Bitmap.Width);
|
||||||
SetLength(PointsLeft,Bitmap.Height,Bitmap.Width);
|
SetLength(PointsLeft,Bitmap.Height,Bitmap.Width);
|
||||||
for y := 0 to Bitmap.Height - 1 do
|
ww := Bitmap.Width - 1;
|
||||||
for x := 0 to Bitmap.Width - 1 do
|
hh := Bitmap.Height - 1;
|
||||||
|
for y := 0 to hh do
|
||||||
|
for x := 0 to ww do
|
||||||
begin;
|
begin;
|
||||||
if (Ptr^.r = r) and (Ptr^.g = g) and (Ptr^.b = b) then
|
if (Ptr^.r = r) and (Ptr^.g = g) and (Ptr^.b = b) then
|
||||||
SkipCoords[y][x] := True
|
SkipCoords[y][x] := True
|
||||||
@ -231,8 +235,8 @@ begin;
|
|||||||
inc(ptr);
|
inc(ptr);
|
||||||
end;
|
end;
|
||||||
TotalPoints:= TotalC;
|
TotalPoints:= TotalC;
|
||||||
for y := 0 to Bitmap.Height - 1 do
|
for y := 0 to hh do
|
||||||
for x := 0 to Bitmap.Width - 1 do
|
for x := 0 to ww do
|
||||||
begin;
|
begin;
|
||||||
PointsLeft[y][x] := TotalC;
|
PointsLeft[y][x] := TotalC;
|
||||||
if not SkipCoords[y][x] then
|
if not SkipCoords[y][x] then
|
||||||
@ -275,11 +279,14 @@ var
|
|||||||
H1,S1,L1,H2,S2,L2 : extended;
|
H1,S1,L1,H2,S2,L2 : extended;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
|
if Color1 = Color2 then
|
||||||
|
begin
|
||||||
|
Result := true;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
ColorToRGB(Color1,R1,G1,B1);
|
ColorToRGB(Color1,R1,G1,B1);
|
||||||
ColorToRGB(Color2,R2,G2,B2);
|
ColorToRGB(Color2,R2,G2,B2);
|
||||||
if Color1 = Color2 then
|
|
||||||
Result := true
|
|
||||||
else
|
|
||||||
case CTS of
|
case CTS of
|
||||||
0: Result := ((Abs(R1-R2) <= Tolerance) and (Abs(G1-G2) <= Tolerance) and (Abs(B1-B2) <= Tolerance));
|
0: Result := ((Abs(R1-R2) <= Tolerance) and (Abs(G1-G2) <= Tolerance) and (Abs(B1-B2) <= Tolerance));
|
||||||
1: Result := (Sqrt(sqr(R1-R2) + sqr(G1-G2) + sqr(B1-B2)) <= Tolerance);
|
1: Result := (Sqrt(sqr(R1-R2) + sqr(G1-G2) + sqr(B1-B2)) <= Tolerance);
|
||||||
@ -413,7 +420,6 @@ begin
|
|||||||
begin;
|
begin;
|
||||||
for xx := xs to xe do
|
for xx := xs to xe do
|
||||||
begin;
|
begin;
|
||||||
// Colour comparison here. Possibly with tolerance? ;)
|
|
||||||
if (Ptr^.R = clR) and (Ptr^.G = clG) and (Ptr^.B = clB) then
|
if (Ptr^.R = clR) and (Ptr^.G = clG) and (Ptr^.B = clB) then
|
||||||
inc(result);
|
inc(result);
|
||||||
Inc(Ptr);
|
Inc(Ptr);
|
||||||
|
Loading…
Reference in New Issue
Block a user