Re: [gtk-list] Re: Large pixmap strategy needed



Dave Swegen wrote:
> 
> On Sat, Dec 05, 1998 at 16:06 +0000, Todd Dukes wrote:
> > You might try a tiled approach. You could have a library of tiles. Each
> > tile would be a small portion of the map. A map would be a list or array
> > of the tiles to use.
> >
> > If you need to edit, you probably want to use an XImage instead of a
> > pixmap.
> > You can use shared memory if you need to display the images quickly
> > after
> > changing them.
> 
> Is GdkImage a wrapper for XImage? That is what it looks like to me...
> 

Actually I may not be much help with this. The last time I was doing
animation was before I starting using gtk so I just used the XImage
directly. It appears that you are correct that GdkImage is a wrapper
around XImage. I am not sure what the correct methods for manipulating
the XImages wrapped by GdkImage are. If portability beyond X is not
a concern, you could probably just access the XImage using the gdk macro
GDK_IMAGE_XIMAGE.

> >
> > The  O'Reilly XLib programming manual goes into manipulating XImages.
> 
> Is this the same as the XLib programming manual that is available on the
> net (http://www.lsv.ens-cachan.fr/~tronche/)? It says it is an html
> version of the one from X Consortium. If so it might be worth putting in
> the tutorial/FAQ as an important resource...
> 

I don't think so.

I couldn't find anything that looked similar at the address above. 
(Of course, not knowing french may have something to do with that). 

I looked in my copy of "Xlib - C Language X Interface, 
MIT X Consortium Standard, X Version 11, Release 6" and it doesn't
seem to discuss XImage as much as the O'Reilly book does.
This book is available on-line somewhere, I got my copy off of a
CD that came with a book. You may be able to find them at the XFree
site.

The O'Reilly book is not freely available. I found my Xlib 
Programming Manual in a used bookstore for about $15. There are 
8 or 9 volumns in the set. Most of them aren't as useful once
you start using gtk. But I still think volumns 1 (Programmers Manual)
and 2 (Reference) are good to have.


> (Thinking aloud) So the basic steps are:
> 
> * Load map as tiles one way or another.
> 
> * Set up equivalent number of GdkImages using gdk_image_new(), then point
> them at the loaded data with gdk_image_get(?)
> 

The gdk_image_get() looks like it gets an image from a window. I don't 
think thats what you want. gdk_imlib should have functions that will
create the image from the file.

> * Draw the tiles using gdk_draw_image().
> 

> * Place any pixmaps on top.
> 


> * Make any changes to tiles using gdk_image_put_pixel()
> 

You want to make any changes first (before gdk_draw_image). 

When you call gdk_draw_image(), it copies the image to the
server. Changing the image on the client shouldn't change the
appearance on the server until you call gdk_draw_image() again.

If you are changing alot of pixels you may want to bypass 
the gdk_image_put_pixel() and access the data directly.
I would try using gdk_image_put_pixel first and if performance is 
acceptable use it. It depends on what you are trying to do.

> * Call gdk_scratch_head() when things go pear-shaped (OK, perhaps not).
> 
> Dave (probably talking utter confused rubbish)
> 
> --
> Dave Swegen <dave@recursive.prestel.co.uk>
> .plan: To find a job working with Linux
> 
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null

Hope this helps. It has been a year or so since I have done
any work with animation and stuff using pixmaps and images.

Todd.

-- 
-----------------------------------------
Todd & Lisa Dukes
tjdukes@flash.net



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