Some improvements to the fuzzy algorithm

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1313 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2010-09-02 07:14:50 +00:00
parent c9fc9311ef
commit a46b4a04a2
3 changed files with 16 additions and 7 deletions

View File

@ -4014,7 +4014,7 @@ object MainForm: TMainForm
end end
object SavePictureDialog: TSavePictureDialog object SavePictureDialog: TSavePictureDialog
Title = 'Save file as' Title = 'Save file as'
DefaultExt = '.xpm' DefaultExt = '.bmp'
Filter = 'Graphic (*.png; *.xpm; *.bmp)|*.png; *.xpm; *.bmp|Pixmap (*.xpm)|*.xpm|Bitmap (*.bmp)|*.bmp|Portable Network Graphic (*.png)|*.png' Filter = 'Graphic (*.png; *.xpm; *.bmp)|*.png; *.xpm; *.bmp|Pixmap (*.xpm)|*.xpm|Bitmap (*.bmp)|*.bmp|Portable Network Graphic (*.png)|*.png'
FilterIndex = 0 FilterIndex = 0
Options = [ofOverwritePrompt, ofEnableSizing, ofViewDetail, ofAutoPreview] Options = [ofOverwritePrompt, ofEnableSizing, ofViewDetail, ofAutoPreview]

View File

@ -4038,7 +4038,7 @@ LazarusResources.Add('TMainForm','FORMDATA',[
+'0'#6#13'ColorP=FFFFFF'#6#13'ColorQ=C0DCC0'#6#13'ColorR=F0CAA6'#6#13'ColorS=' +'0'#6#13'ColorP=FFFFFF'#6#13'ColorQ=C0DCC0'#6#13'ColorR=F0CAA6'#6#13'ColorS='
+'F0FBFF'#6#13'ColorT=A4A0A0'#0#4'left'#3#186#0#3'top'#2'Z'#0#0#18'TSavePictu' +'F0FBFF'#6#13'ColorT=A4A0A0'#0#4'left'#3#186#0#3'top'#2'Z'#0#0#18'TSavePictu'
+'reDialog'#17'SavePictureDialog'#5'Title'#6#12'Save file as'#10'DefaultExt'#6 +'reDialog'#17'SavePictureDialog'#5'Title'#6#12'Save file as'#10'DefaultExt'#6
+#4'.xpm'#6'Filter'#6#130'Graphic (*.png; *.xpm; *.bmp)|*.png; *.xpm; *.bmp|P' +#4'.bmp'#6'Filter'#6#130'Graphic (*.png; *.xpm; *.bmp)|*.png; *.xpm; *.bmp|P'
+'ixmap (*.xpm)|*.xpm|Bitmap (*.bmp)|*.bmp|Portable Network Graphic (*.png)|*' +'ixmap (*.xpm)|*.xpm|Bitmap (*.bmp)|*.bmp|Portable Network Graphic (*.png)|*'
+'.png'#11'FilterIndex'#2#0#7'Options'#11#17'ofOverwritePrompt'#14'ofEnableSi' +'.png'#11'FilterIndex'#2#0#7'Options'#11#17'ofOverwritePrompt'#14'ofEnableSi'
+'zing'#12'ofViewDetail'#13'ofAutoPreview'#0#4'left'#3#150#0#3'top'#2'~'#0#0 +'zing'#12'ofViewDetail'#13'ofAutoPreview'#0#4'left'#3#150#0#3'top'#2'~'#0#0

View File

@ -810,13 +810,22 @@ end;
procedure TRGB32Canvas.FuzzyRectangle(X1, Y1, X2, Y2: Integer); procedure TRGB32Canvas.FuzzyRectangle(X1, Y1, X2, Y2: Integer);
var var
X, Y: LongInt; X, Y: LongInt;
delta: Integer; deltaX, deltaY: Integer;
begin begin
for Y := Y1 + 5 to Y2 - 5 do for Y := Y1 to Y2 do
for X := X1 + 5 to X2 - 5 do for X := X1 to X2 do
begin begin
delta := X mod 5; // This computation has a good effect of making text illegible,
SetColor(X, Y, GetColor(X - delta, Y - delta)); // but keeping the overal image with the same colors
deltaX := X mod 5;
deltaY := deltaX;
// Makes sure we won't get any invalid pixel positions
if X < 5 then deltaX := -deltaX;
if Y < 5 then deltaY := -deltaY;
// Change the color
SetColor(X, Y, GetColor(X - deltaX, Y - deltaY));
end; end;
end; end;