diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-07-11 08:31:48 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-07-11 08:31:48 +0000 |
commit | 44e259dc6aae8b0436406b3d3a5aaa64fe2405de (patch) | |
tree | eb74ff75dd13ee7a1799f76a05fbaa58320cbb70 /prototypes | |
parent | a9131ca787efb6bec6b76c64788095cd621ef4c9 (diff) | |
download | fpGUI-44e259dc6aae8b0436406b3d3a5aaa64fe2405de.tar.xz |
* Minor fix in Canvas.GetPixel under Windows
Diffstat (limited to 'prototypes')
-rw-r--r-- | prototypes/fpgui2/source/core/gdi/gfx_gdi.pas | 8 | ||||
-rw-r--r-- | prototypes/fpgui2/tests/fpgcanvas.lpi | 1 | ||||
-rw-r--r-- | prototypes/fpgui2/tests/fpgcanvas.lpr | 9 |
3 files changed, 11 insertions, 7 deletions
diff --git a/prototypes/fpgui2/source/core/gdi/gfx_gdi.pas b/prototypes/fpgui2/source/core/gdi/gfx_gdi.pas index c50415a8..cfd0ce61 100644 --- a/prototypes/fpgui2/source/core/gdi/gfx_gdi.pas +++ b/prototypes/fpgui2/source/core/gdi/gfx_gdi.pas @@ -182,14 +182,14 @@ var c: dword; begin c := fpgColorToRGB(col); - //swapping bytes + //swapping bytes (Red and Blue colors) Result := ((c and $FF0000) shr 16) or ((c and $0000FF) shl 16) or (c and $00FF00); end; function WinColorTofpgColor(col: longword): TfpgColor; begin //swapping bytes - Result := ((col and $FF0000) shr 16) or ((col and $0000FF) shl 16) or (col and $00FF00); + Result := fpgColorToWin(col); end; function GetMyWidgetFromHandle(wh: TfpgWinHandle): TfpgWidget; @@ -1014,7 +1014,9 @@ function TfpgCanvasImpl.GetPixel(X, Y: integer): TfpgColor; var c: longword; begin - c := Windows.GetPixel(FDrawWindow.FWinHandle, X, Y); + c := Windows.GetPixel(Fgc, X, Y); + if c = CLR_INVALID then + Writeln('fpGFX/GDI: TfpgCanvasImpl.GetPixel returned an invalid color'); Result := WinColorTofpgColor(c); end; diff --git a/prototypes/fpgui2/tests/fpgcanvas.lpi b/prototypes/fpgui2/tests/fpgcanvas.lpi index c85685b5..fb951fa1 100644 --- a/prototypes/fpgui2/tests/fpgcanvas.lpi +++ b/prototypes/fpgui2/tests/fpgcanvas.lpi @@ -18,7 +18,6 @@ </VersionInfo> <PublishOptions> <Version Value="2"/> - <DestinationDirectory Value="$(TestDir)\publishedproject\"/> <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> </PublishOptions> diff --git a/prototypes/fpgui2/tests/fpgcanvas.lpr b/prototypes/fpgui2/tests/fpgcanvas.lpr index bae26d19..e820ad0b 100644 --- a/prototypes/fpgui2/tests/fpgcanvas.lpr +++ b/prototypes/fpgui2/tests/fpgcanvas.lpr @@ -117,9 +117,12 @@ begin // Testing Canvas.Pixels[] // two pixels should have changed color in the top left of the form - c := Canvas.Pixels[192, 215]; // should be orange like color - Canvas.Pixels[7,5] := clBlue; - Canvas.Pixels[8,5] := c; + Canvas.Pixels[7,5] := clBlue; // This tests consistant bit order handling (RGB) + Canvas.Pixels[8,5] := clRed; + c := Canvas.Pixels[192, 227]; // should be orange like color + Canvas.Pixels[9,5] := c; + c := Canvas.Pixels[150 + (32*4) + 3, 199]; // should be lightblue like color + Canvas.Pixels[10,5] := c; Canvas.EndDraw; end; |