[cairo] multiple sprites images in one PNG
Christopher Howard
christopher.howard at frigidcode.com
Thu Mar 15 22:06:46 PDT 2012
Hi. I've got this noobie question. I posted it at the gtk list, but
didn't get a response, so I'm going straight to the source:
I'm coding a simple space combat game with GTK+/cairo. For the sprites,
I know I can do this:
code:
----------
ship_surf = cairo_image_surface_create_from_png("ship.png");
// ...
cairo_set_source_surface (cr, ship_surf, x, y);
cairo_paint (cr);
----------
But what if I want, for ease of maintainability (and less system I/O
calls) to put a whole bunch of sprites in one PNG? Is it possible for me
to either...
* load one PNG image into a surface, and then draw to a CR using only a
small part of that surface?
or
* load one PNG into a surface, and then split that surface into multiple
smaller surfaces?
It wasn't quite clear to me from the documentation how I should go about
this.
--
frigidcode.com
indicium.us
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 554 bytes
Desc: OpenPGP digital signature
URL: <http://lists.cairographics.org/archives/cairo/attachments/20120315/f5ccf45d/attachment.pgp>
More information about the cairo
mailing list