Hello,
I am testing some gdk functions, and I'd like to connect them to LCL.
My current gtk code is this one:
Pixbuf := gdk_pixbuf_get_from_drawable(nil,
gdk_screen_get_root_window(gdk_screen_get_default),
gdk_window_get_colormap(gdk_screen_get_root_window(gdk_screen_get_default)),
0, 0, 0, 0, CXScreen - 1, CYScreen -1);
gdk_pixbuf_save(Pixbuf, '/home/felipe/tmp/tmp.png', 'png', nil);
This takes a screenshot of the screen. This works.
Now, I'd like to save that Pixbuf into a TBitmap, so I can display it
in a lazarus form. How can I do that? Do I need to manually copy the
memory of the image into the TBitmap? Or just using gtk functions is
enougth?
I attempted to draw the pixbuf into a created, but empty TBitmap:
GDIObject := PgdiObject(bmpDisplay.Handle);
gdk_draw_pixbuf(GDIObject^.GDIPixmapObject, nil, Pixbuf, 0, 0, 0, 0,
CXScreen - 1, CYScreen -1, GDK_RGB_DITHER_NONE, 0, 0);
But this doesn't work.
In case anyone wants to test this, I declared my own gdk functions,
because they are Gtk2.2+ specific.
uses gdk2, gtkdef, gdk2pixbuf, gtk2, glib2;
procedure gdk_display_get_pointer(display : PGdkDisplay; screen
:PGdkScreen; x :Pgint; y : Pgint; mask : PGdkModifierType); cdecl;
external gdklib;
function gdk_display_get_default:PGdkDisplay; cdecl; external gdklib;
procedure gdk_draw_pixbuf(drawable : PGdkDrawable; gc : PGdkGC; pixbuf
: PGdkPixbuf; src_x, src_y, dest_x, dest_y, width, height : gint;
dither : TGdkRgbDither;
x_dither, y_dither : gint); cdecl; external gdklib;
function gdk_screen_get_default: PGdkScreen; cdecl; external gdklib;
thanks,
--
Felipe Monteiro de Carvalho
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives