summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2010-05-12 16:42:44 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2010-05-12 16:42:44 +0200
commit7c4d9ec9910d4afd38ee9c22d8add2e7f411e3f2 (patch)
tree411ec1d756520185a3ad9449d516f677925c492c
parentee6ce6a61b65eaf8161ed24b8f786ebea4499722 (diff)
downloadfpGUI-7c4d9ec9910d4afd38ee9c22d8add2e7f411e3f2.tar.xz
TfpgImageBase.Invert() now takes a boolean property to include the mask or not.
Default is not to include the mask.
-rw-r--r--src/corelib/fpg_base.pas17
-rw-r--r--src/corelib/fpg_imgfmt_bmp.pas2
2 files changed, 11 insertions, 8 deletions
diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas
index b0c4acee..3bd9bfbd 100644
--- a/src/corelib/fpg_base.pas
+++ b/src/corelib/fpg_base.pas
@@ -195,7 +195,7 @@ type
public
constructor Create;
destructor Destroy; override;
- procedure Invert;
+ procedure Invert(IncludeMask: Boolean = False);
procedure FreeImage;
procedure AllocateImage(acolordepth, awidth, aheight: integer);
procedure AllocateMask;
@@ -1950,7 +1950,7 @@ begin
inherited Destroy;
end;
-procedure TfpgImageBase.Invert;
+procedure TfpgImageBase.Invert(IncludeMask: Boolean);
var
p: ^byte;
n: integer;
@@ -1965,13 +1965,16 @@ begin
Inc(p);
end;
- if FMaskData <> nil then
+ if IncludeMask then
begin
- p := FMaskData;
- for n := 1 to FMaskDataSize do
+ if FMaskData <> nil then
begin
- p^ := p^ xor $FF;
- Inc(p);
+ p := FMaskData;
+ for n := 1 to FMaskDataSize do
+ begin
+ p^ := p^ xor $FF;
+ Inc(p);
+ end;
end;
end;
end;
diff --git a/src/corelib/fpg_imgfmt_bmp.pas b/src/corelib/fpg_imgfmt_bmp.pas
index b373e724..48b25d5b 100644
--- a/src/corelib/fpg_imgfmt_bmp.pas
+++ b/src/corelib/fpg_imgfmt_bmp.pas
@@ -217,7 +217,7 @@ begin
//Writeln(linecnt,' lines loaded.');
move(img.ImageData^, img.MaskData^, img.ImageDataSize);
- img.Invert;
+ img.Invert(True);
end;
4: