TGtkDeviceContext(ACanvas.Handle)
{$if (lcl_major <> 1) or (lcl_minor <> 0)}
Wouldn't this be very nasty if Lazarus 1.2 is ever released?
About TGtkContext:
The class name changed. To compile both in new and old LCL see how i did in http://code.google.com/p/luipack/source/detail?r=901 (Must have LCLVersion unit in uses)
About Gtk coordinates:
It was changed to fix some bugs. Please add a bugreport with a small demo so we can look where the bug is
{$IFDEF LCLgtk2}
type TGtkDeviceContext = TGtk2DeviceContext;
{$ENDIF}
{$IFDEF LCLgtk2}
{$MACRO ON}
{$if (lcl_major <> 1) or (lcl_minor <> 0)}
{$define type TGtkDeviceContext = TGtk2DeviceContext;}
{$endif}
{$ENDIF}
// Start with enabling macros for all widgetsets so you're not surprised later on that something doesn't compile right:
{$MACRO ON}
{$IF LCL_FULLVERSION<1000200} //for laz older than say 1.0.2; you can also use >= and other operators
//((lcl_major * 100 + lcl_minor) * 100 + lcl_release) * 100 + lcl_patch;
//1.0.2.0
{$IFDEF LCLgtk2}
// This code will be compiled only if all IFDEFs are true, so the type will only be compiled/appear
// in LCL/Lazarus older than 1.0.2
type TGtkDeviceContext = TGtk2DeviceContext;
{$ENDIF LCLgtk2}
{$ENDIF LCL_FULLVERSION>=10002}
gdk_pixbuf_render_to_drawable(FPixBuf,
TGtkDeviceContext(ACanvas.Handle).Drawable,
TGtkDeviceContext(ACanvas.Handle).GC,
0,0,
TGtkDeviceContext(ACanvas.Handle).ClipRect.X+Rect.Left,
TGtkDeviceContext(ACanvas.Handle).ClipRect.y+Rect.Top,
Width,Height,
GDK_RGB_DITHER_NORMAL,0,0);
Seems that before Offset had some values, but now X and Y are 0. I changed to ClipRect and now it is working. I will ask in buckracker issue why this rect is now 0
About svn, I'm still using old svn repository. I had problem with the new one. I'll try to switch to the new repository when I have some time to do so.What is old svn link? Can't find it on wiki
fBuffer := BmpResize(fBitmap, w, h, fFineResample);
{$IFDEF LINUX} // bug!!!
fBuffer.Draw(fView.Canvas, x + fView.Left, y + fView.Top, fOpaque);
{$ELSE}
fBuffer.Draw(fView.Canvas, x, y, fOpaque);
{$ENDIF}
gdk_pixbuf_render_to_drawable(FPixBuf,Instead of
TGtkDeviceContext(ACanvas.Handle).Drawable,
TGtkDeviceContext(ACanvas.Handle).GC,
0,0,
TGtkDeviceContext(ACanvas.Handle).ClipRect.X+Rect.Left,
TGtkDeviceContext(ACanvas.Handle).ClipRect.y+Rect.Top,
Width,Height,
GDK_RGB_DITHER_NORMAL,0,0);
P := Rect.TopLeft;
DpToLP(ACanvas.Handle, P, 1);
gdk_pixbuf_render_to_drawable(FPixBuf,
TGtkDeviceContext(ACanvas.Handle).Drawable,
TGtkDeviceContext(ACanvas.Handle).GC,
0,0,
TGtkDeviceContext(ACanvas.Handle).Offset.X + abs(P.X),
TGtkDeviceContext(ACanvas.Handle).Offset.Y + abs(P.Y),
Width,Height,
GDK_RGB_DITHER_NORMAL,0,0);