Re: gtk3 replacement for gdk_pixmap_foreign_new



Also, I have replaced the following code:

    GdkPixmap *pixmap = NULL;
    gdk_pixbuf_render_pixmap_and_mask(pixbuf, &pixmap, NULL, 0);
    if(pixmap) {
      cairo_t *cairo;
      cairo = gdk_cairo_create(pixmap);
      if(cairo) {
        PangoLayout *layout;
        layout = pango_cairo_create_layout(cairo);

....// do layout stuff

      	pango_cairo_show_layout(cairo, layout);
          pixbuf_new = gdk_pixbuf_get_from_drawable(pixbuf, pixmap, NULL,\
              0, 0,\
              0, 0,\
              -1, -1);



which works, with:


      cairo_t *cairo;
      cairo_surface_t *surf;
      PangoLayout *layout;

      if (palette==WEED_PALETTE_BGR24||palette==WEED_PALETTE_RGB24)
	surf=cairo_image_surface_create(CAIRO_FORMAT_RGB24, width, height);
      else
	surf=cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
      cairo=cairo_create(surf);
      gdk_cairo_set_source_pixbuf(cairo,pixbuf,0,0);
      layout = pango_cairo_create_layout(cairo);

...

      	pango_cairo_show_layout(cairo, layout);
	cairo_paint(cairo);


which no longer paints any text on the pixbuf. Any suggestions ?

Regards,
Salsaman.


http://lives.sourceforge.net
https://www.ohloh.net/accounts/salsaman



On Wed, Jan 18, 2012 at 14:00, salsaman <salsaman gmail com> wrote:
> OK, here is what I discovered in replacing this code.
>
> gdk_pixbuf_get_from_window() should work as a replacement (actually I
> was using gdk_pixmap_get_from_drawable() before). However there may be
> a problem with colormaps (I have not been able to test this yet, but
> see below).
>
> With gtk+ 2.x a colormap is required for
> gdk_pixmap_get_from_drawable(), and the documentation says for screen
> captures it is OK to use the default colormap for the screen. This is
> in fact no longer the case !!! With Compiz, you need to create a 32
> bit colormap (whereas the screen default is 24 bit). I have to use
> gdk_visual_get_best_with_depth( depth_of_window ) followed by
> gdk_x11_colormap_get_xcolormap() and gdk_x11_colormap_foreign_new().
> depth_of_window is taken from the Xwindow and is 32 for Compiz.
>
> - So therefore, I hope this is taken into consideration and something
> similar done in the new function gdk_pixbuf_get_from_window() which
> does not take a colormap parameter.
>
>
> The other thing I noticed, gtk_socket_add_id() no longer seems to
> work. Before it was kind of flakey...it didnt always work, and for
> some reason it needed to be called twice in succession for it to work
> at all. Now it does not work at all. However this is probably an X
> Window issue, as trying to reparent a foreign window into a normal gdk
> window seems not to work either. perhaps somebody could look into
> that. However there seems to be another bug in gtk_socket_add_id() as
> I get errors about the GtkSocket not being a GObject, and even being
> mistaken for a PangoLayout object !
>
>
>
>
> Regards,
> Salsaman.
>
>
>
>
>
>
>
>
>
>
> http://lives.sourceforge.net
> https://www.ohloh.net/accounts/salsaman
>
>
>
> On Fri, Jan 6, 2012 at 09:51, Olav Vitters <olav vitters nl> wrote:
>> On Fri, Jan 06, 2012 at 12:51:32PM +0100, richard boaz wrote:
>>> i have been caught by this in the past as well: that documentation related
>>> to deprecated functions is woefully lacking.  it is emminently unhelpful to
>>> simply state "stop using this call".
>>
>> File bugs.
>>
>> --
>> Regards,
>> Olav
>> _______________________________________________
>> gtk-list mailing list
>> gtk-list gnome org
>> http://mail.gnome.org/mailman/listinfo/gtk-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]