summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--prototypes/fpgui2/source/core/gdi/gfx_gdi.pas8
-rw-r--r--prototypes/fpgui2/tests/fpgcanvas.lpi1
-rw-r--r--prototypes/fpgui2/tests/fpgcanvas.lpr9
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;