Re: Re: Re: Re: Re: Getting a Cairo context

2015-03-28 Thread John Tall
On Fri, Mar 27, 2015 at 12:57 PM, Emmanuele Bassi wrote: > If you're writing new code and you're using GTK+ 2.x, you're sadly > Doing It Wrong™, as the kids say today. That's certainly true *if* you're a GNOME developer. However, that's unfortunately not the world where all of us live. If your c

Re: Re: Re: Re: Re: Getting a Cairo context

2015-03-28 Thread Lucas Levrel
Le 27 mars 2015, Emmanuele Bassi a écrit : I don't understand. Gtk2 is stable and only receives bug fixes, right? (Is this what you call deep maintenance?) So why should a tutorial on it be maintained? A tutorial on Gtk 2.24 would do, whatever its date. You still need to maintain a tutorial, u

Re: Re: Re: Re: Re: Getting a Cairo context

2015-03-27 Thread Emmanuele Bassi
Hi; On 27 March 2015 at 11:24, Lucas Levrel wrote: > Le 27 mars 2015, Emmanuele Bassi a écrit : > >> After GTK 2.8, you should be using the Cairo API for everything; some > > > Part of your sentence has been cutoff it seems. Ah, yes. I was meaning to link to the migration API, and I moved it at

Re: Re: Re: Re: Re: Getting a Cairo context

2015-03-27 Thread Lucas Levrel
Le 27 mars 2015, Emmanuele Bassi a écrit : After GTK 2.8, you should be using the Cairo API for everything; some Part of your sentence has been cutoff it seems. You likely won't ever see a GTK 2 programming tutorial that is both up to date and maintained, considering that GTK 2 is in deep ma

Re: Re: Re: Re: Re: Getting a Cairo context

2015-03-27 Thread Emmanuele Bassi
Hi; On 27 March 2015 at 10:22, Lucas Levrel wrote: >>> - draw your "background" on bare_pixmap >>> >>> - when you have to redraw, just copy bare_pixmap to full_pixmap, add >>> stuff >>> to full_pixmap, then display it: >>> >>> gdk_draw_drawable(full_pixmap,copy_gc,bare_pixmap,0,0,0,0,-1,-1);

Re: Re: Re: Re: Re: Getting a Cairo context

2015-03-27 Thread Lucas Levrel
Le 26 mars 2015, Emmanuele Bassi a écrit : What I do in a similar situation is keeping a kind of carbon copy of the bare drawing: - get two pixmaps from the drawing area : bare_pixmap=gdk_pixmap_new(d_area->window,width,height,-1); full_pixmap=gdk_pixmap_new(d_area->window,width,height,-1);

Re: Re: Re: Re: Re: Getting a Cairo context

2015-03-26 Thread Emmanuele Bassi
Hi; On 26 March 2015 at 19:54, Lucas Levrel wrote: > Le 26 mars 2015, Sergei Naumov a écrit : > >> Hmm. This is something I did not know I could do. But in this case I would >> have to redraw everything in the widget's drawing area which is my axes, >> tickmarks, labeles, etc... All right, I will

RE: Re: Re: Re: Re: Getting a Cairo context

2015-03-26 Thread Lucas Levrel
Le 26 mars 2015, Sergei Naumov a écrit : Hmm. This is something I did not know I could do. But in this case I would have to redraw everything in the widget's drawing area which is my axes, tickmarks, labeles, etc... All right, I will try it this way because it is much simpler. What I do in a

RE: Re: Re: Re: Re: Getting a Cairo context

2015-03-26 Thread Sergei Naumov
25.03.2015, 19:09:09 пользователь Emmanuele Bassi (eba...@gmail.com) написал: To be fair, though, if you're not going to offload drawing to a separate thread, then why are you complicating things this much? If you want your widget to be redrawn at periodic intervals, you can call gtk_widget_

Re: Re: Re: Re: Getting a Cairo context

2015-03-25 Thread Emmanuele Bassi
Hi; On 25 March 2015 at 14:49, Sergei Naumov wrote: > >> 25.03.2015, 18:09:41 пользователь Emmanuele Bassi (eba...@gmail.com) >> написал: >> >> > This is going >> > to be my setup draw (axes, tickmarks, etc). Then because I use >> > g_timeout_add_seconds() to fire up the thread, I'd have to chang

RE: Re: Re: Re: Getting a Cairo context

2015-03-25 Thread Sergei Naumov
25.03.2015, 18:09:41 пользователь Emmanuele Bassi (eba...@gmail.com) написал: > This is going > to be my setup draw (axes, tickmarks, etc). Then because I use > g_timeout_add_seconds() to fire up the thread, I'd have to change it to > something like that Why are you using a timeout to fire of

Re: Re: Re: Getting a Cairo context

2015-03-25 Thread Emmanuele Bassi
Hi; On 25 March 2015 at 13:45, Sergei Naumov wrote: >> 1. create the widget instance >> 2. realize it >> 3. create a similar Cairo surface from the GdkWindow of the widget >> 4. store Cairo surface on the widget instance; you can use a >> subclass or g_object_set_data(), with a p

RE: Re: Re: Getting a Cairo context

2015-03-25 Thread Sergei Naumov
24.03.2015, 18:59:07 пользователь Emmanuele Bassi (eba...@gmail.com) написал:   1. create the widget instance   2. realize it   3. create a similar Cairo surface from the GdkWindow of the widget   4. store Cairo surface on the widget instance; you can use a subclass or g_object_set_dat

Re: Re: Getting a Cairo context

2015-03-24 Thread Emmanuele Bassi
Hi; On 24 March 2015 at 14:43, Sergei Naumov wrote: >> The idiomatic way is to create a surface either using >> gdk_window_create_similar_surface(), or >> gdk_window_create_similar_image_surface(), which will take care of >> giving you the most appropriate surface for the platform you're using.

RE: Re: Getting a Cairo context

2015-03-24 Thread Sergei Naumov
> I am developing a program that has to draw some data using Cairo. The > question I have is about getting a cairo context from outside of the signal > "draw" that the examples describe. I have a multithreaded application where > one thread sets up the GTK drawing area

Re: Getting a Cairo context

2015-03-24 Thread Emmanuele Bassi
Hi; On 24 March 2015 at 12:17, Sergei Naumov wrote: > I am developing a program that has to draw some data using Cairo. The > question I have is about getting a cairo context from outside of the signal > "draw" that the examples describe. I have a multithreaded application

Re: Getting a Cairo context

2015-03-24 Thread Pramathesh Ambasta
> question I have is about getting a cairo context from outside of the signal > "draw" that the examples describe. I have a multithreaded application where > one thread sets up the GTK drawing area, axes, tickmarks, etc. and another > thread has to draw in this area. I atta

Getting a Cairo context

2015-03-24 Thread Sergei Naumov
Hi! I am developing a program that has to draw some data using Cairo. The question I have is about getting a cairo context from outside of the signal "draw" that the examples describe. I have a multithreaded application where one thread sets up the GTK drawing area, axes, tickmarks