I have a problem that I am sure is something I have overlooked but I can't seem to pin point it.
I have a component that when it is created it run the following procedure.
the FBmp variable is part of component's private section just copied it here to help the tests.
procedure CreateRGBGradient;
var
g, b: integer;
FBmp : TBitmap=nil;
begin
if FBmp = nil then
begin
FBmp := TBitmap .Create;
FBmp.PixelFormat := pf32bit;
FBmp.Width := 256;
FBmp.Height := 256;
end;
for g := 255 downto 0 do
begin
for b := 0 to 255 do
FBmp.Canvas.Pixels[b,255-g] := RGB(FR, g, b);
end;
//FBmp.SaveToFile('D:\jkoz\Lazarus\Projects\To Convert\Components\mbColorLib\Test\RAxisColor.bmp');
end;
My custom component is based on TCustomControl and I have override the paint method with this one.
begin
{$IFDEF LCLWIN32}
Canvas.StretchDraw(ClientRect, FBmp);
{$ENDIF}
{$IFDEF LCLGTK2}
Canvas.StretchDraw(Rect(0, 0, Width, Height), FBmp);
// Canvas.Brush.Color := clFuchsia;
// canvas.Rectangle(0,0,100,100);
{$ENDIF}
CorrectCoords(mxx, myy);
DrawMarker(mxx, myy);
end;
Everything works as expected with the windows widget set the image is rendered on the component and I can see it on my application. But if I change my compilation to use GTK2 nothing is rendered on the component just to make sure that I haven't step out of some boundaries I added the rectangle call and this rectangle is rendered and shown.
This tells me that there is something else I should be aware about GTK2 that I am not.
I'm attaching 3 files
- the bitmap that the commented out line in CreateRGBGradient procedure saved.
- The result of the current paint in GTK2
- The result of paint in Windows widget set
Any one can shed some light on the the problem?
Testing Environment
Lazarus 1.1 r38674 FPC 2.6.1 i386-win32-win32/win64