Re: Fast Image Manipulation?
- From: Federico Mena Quintero <federico nuclecu unam mx>
- To: mlepage cgocable net
- CC: gnome-list gnome org
- Subject: Re: Fast Image Manipulation?
- Date: Wed, 18 Nov 1998 14:41:25 -0500
> Now, if I were drawing straight to the screen, I could keep my items image as a
> gdk pixmap and do a simple gdk_draw_pixmap to blast the appropriate section.
>
> If I use gdk_imlib_paste_image, I don't get to choose a section, it just scales
> the image to fit. I'd have to do a gdk_imlib_crop_and_clone_image first, which
> is too slow (I assume). Or, I'd have to do that at the beginning, and keep many
> smaller item images, which takes up more memory (I assume). That's not good
> because I may have many item types and frames.
You need to do the following.
When your game starts up, load all the images using gdk_imlib. Render
them with gdk_imlib_render(), and extract the pixmaps/masks with
gdk_imlib_move_image() and gdk_imlib_move_mask(), respectively. Keep
those pixmaps around.
When you need to paint a frame, clear your off-screen pixmap, and then
fill it using gdk_draw_pixmap() from the pixmaps you created when the
game started up. Then blast the off-screen pixmap to your drawing
area.
Federico
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]