Using GdkPixmaps for storing static image data



On Thu, 22 Mar 2001, Havoc Pennington wrote:
> Basically a GdkPixmap is a server-side image data buffer, and isn't
> all that appropriate as a place to store image data loaded from disk,
> among other reasons because it makes you think about the visual/cmap
> of the workstation's video hardware.
>
> Anyhow, in GTK 2 the GdkPixmap code still works but you no longer need
> to use it in newly-written application code.

That's quite a statement! Perhaps I've missunderstood.

In Slash'EM (not-yet-cvs) we maintain a drawing area which is basically a map of
your surroundings, built up of tiles. These tiles are stored in a tileset, which
(depending on the mode) can be stored in a Pixmap. This makes drawing to the
map an efficient operation since both the tileset and the map are server-side
and the drawing commands end up being a series of CopyArea requests. If we were
to use Pixbufs we would presumably end up with a series of PutImage requests
which would be a _lot_ slower.

In other modes we store the tileset in an image and keep the map's backing
store as a shared image so we render from the tileset to the image without
sending any data to the server and then use whatever the gdk function is
(sorry, the code's at home) to draw from an image to a pixmap and hope that
this function deals efficiently with shared images. It seems to work well
except that my code to copy from image to image is currently just using the
pixel routines which are very slow.

Where shared images aren't available, we have to do things the hard way.

One of the things I think Gtk is missing is a function to go from disk to
image. You can use the API to go via pixmaps, but that's a little crazy :-)

One of my remaining jobs is to write a routine to copy from pixbufs to images
to solve this.

-- 
Ali Harlow                              Email: ali avrc city ac uk
Research programmer                     Tel:   (020) 7477 8000 X 4348
Applied Vision Research Centre          Intl: +44 20 7477 8000 X 4348
City University                         Fax:   (020) 7505 5515
London                                  Intl: +44 20 7505 5515




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