RE: Images in GTKmm



Thanks. It looks like these won't work in gtkmm3. E.g. the "Changes in gtkmm 3" notes:

9. Gdk::Pixmap and Gdk::Bitmap were removed in favour of Gdk::Pixbuf.

I had a look in the Gdk::window api (http://developer.gnome.org/gtkmm/stable/classGdk_1_1Window.html), but couldn't see a draw_drawable method.

Any idea how to do this in gtkmm3?

Tom
________________________________________
From: gtkmm-list-bounces gnome org [gtkmm-list-bounces gnome org] on behalf of Yann LEYDIER [yann leydier info]
Sent: 02 August 2011 18:19
To: gtkmm-list gnome org
Subject: Re: Images in GTKmm

I'm not using Gtkmm 3, but you might have to use cairomm to do that.

In Gtkmm 2, I render the Pixbuf to a Pixmap and then use
Gdk::Window::draw_drawable on the DrawingArea's Gdk window. Perhaps it
still works in API 3…


yann

On 02/08/11 19:05, Thomas Harty wrote:
> Thank you for the reply.
>
> I tried following the example here: http://developer.gnome.org/gtkmm-tutorial/3.0/sec-draw-images.html.en to test out using a Pixbuf in a Drawing area, but got a few compile-time errors (n.b. I'm using gtkmm 3.0):
>
> error: ‘class Gdk::Pixbuf’ has no member named ‘render_to_drawable’
> error: ‘get_style’ was not declared in this scope
> error: ‘RGB_DITHER_NONE’ is not a member of ‘Gdk’
>
> I had a look in the class reference (http://developer.gnome.org/gtkmm/3.1/classGdk_1_1Pixbuf.html) and couldn't see render_to_drawable. Has this been depreciated in gtkmm 3? If so, what's the appropriate way to do this now?
>
> Tom
>
>
>
> ________________________________________
> From: gtkmm-list-bounces gnome org [gtkmm-list-bounces gnome org] on behalf of Yann LEYDIER [yann leydier info]
> Sent: 02 August 2011 16:29
> To: gtkmm-list gnome org
> Subject: Re: Images in GTKmm
>
> I would do this with a DrawingArea. It is possible to resize a Pixbuf to
> the size of the DrawingArea and render it in a callback plugged to the
> expose_event signal.
>
> But I don't known if it is the best way! ;)
> yann
>
> On 02/08/11 12:51, Thomas Harty wrote:
>> I want to put an image into a box in such a way that the image will
>> shrink to fit into empty space in the box, whilst preserving its aspect
>> ratio. Thus, the dimensions of the image should be determined by the
>> dimensions of the objects around it. The image needs to shrink and
>> expand with the box (e.g. if the user re-sizes the main window).
>>
>> For example, I want to put a few items in a VBox and have these items
>> determine the width of the VBox. I then want to be able to add the image
>> to the VBox in such a way that it doesn't resize the box, but rather
>> fits into the space. If there is space left above/below the widget (due
>> to the constraint of preserving it's aspect ratio), this should be
>> filled with padding, rather than the image expanding to fill the space.
>>
>> What's the best way of accomplishing this in Gtkmm?
>>
>> Tom
>>
>>
>>
>> _______________________________________________
>> gtkmm-list mailing list
>> gtkmm-list gnome org
>> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list


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