Hi Ales, moving this thread to geda-dev with a better subject... El dom, 09-10-2005 a las 19:57 -0400, Ales Hvezda escribió: > >It's in relation with adding picture output support when exporting png. > >In order to do that I think it's better to use gtk functions to get a > >pixmap of the drawing area and then save it as a .png file. This way we > >can get rid of libgdgeda... (I think it's not used for anything more). > >It's like a preview picture of the schematic in memory, and this will be > >needed when using the file load/save gtk dialog... > >I made some tries to get a pixmap from the drawing area, but I was not > >quite succesfull. Anyone can give me a clue about how to do this? > > > Ah, yes, in order to do this you need to look at the gdk routines > which render into pixbufs and drawables: > > http://developer.gnome.org/doc/API/2.0/gdk/gdk-Pixbufs.html > > More specifically you should look at: > > http://developer.gnome.org/doc/API/2.0/gdk/gdk-Pixbufs.html#gdk-pixbuf-get-from-drawable > > In libgeda/gschem the: > > GdkWindow *window; > > and > > GdkPixmap *backingstore; > > are the primary drawables. Once you get the data into a pixbuf, you can use: > > http://developer.gnome.org/doc/API/2.0/gdk-pixbuf/gdk-pixbuf-file-saving.html > > the various routines for saving pixbufs to files.
I got pixmaps from GtkWidget *window and backingstore, but they are only pixmaps of the same area displayed in the gschem's window (which is not right if you are only displaying a small area of the schematic)... and I got best results from backingstore (I mean other visible windows in the desktop can affect the png output when using GtkWidget *window, I think). Is backingstore cleaner than GtkWidget *window? Is there any other variable storing the full gschem's window? If not, I guess I need to do a 'zoom extents' before getting the pixmap, get the pixmap, and then restore the previous zoom factor (without the user noticing all these, of course)... > I think that getting rid of libgdgeda is a great idea, but if we are going > to do that, we have to make sure we can do all the rendering without creating > a gui window etc... otherwise we are no better than the (my) existing (lame) > implementation for creating pngs. I think it's not so simple. I will get picture png support working first... The problem is that, for example, you need a visible window before setting the gc of the window, which is done when initializing the main window... I think we need to split non-gui functions and gui functions, and call the latter only when needed. Cheers, Carlos -- Carlos Nieves Ónega <[EMAIL PROTECTED]>