multiple sprites images in one PNG
Christopher Howard <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
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
--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
signature.asc
(application/pgp-signature, 554 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJPYsp0AAoJEI2DxlFxTtgdwf4IAJHSxgrHPDdS+/p89cELMY1A Frfj+7XVOEjp0cQF0zQzw53ztTHhCA6rNQU9TrsjtwmCaktGcvI73T5empWk2aCu 2X981Jf+Hp2OWRZEtAQxKBk9luojHCiLJgffiz/A3Cw33x6RRHx0CIw1wipEpwYO NeG1gSQ1sYhbVTvWmq3+4EOgun5MTqG4WgMIrGaSd99bS6zLB5LvUCcBrp8+ArpR w7Qw4bL4XGPk1P4LQlrXyk/MWpCX0hWDc0euy4y0qJ3yc/4/AF9xdqrcmDASy736 ZAXeE//7XbUWRtAFAQMEQbO6JBR/elMNqIxp5WvTDQiQro4pBTwu+EaqQ3jMrNQ= =A1az -----END PGP SIGNATURE-----