cairo: multiple sprites images in one PNG
- From: Christopher Howard <christopher howard frigidcode com>
- To: gtk-app-devel-list gnome org
- Subject: cairo: multiple sprites images in one PNG
- Date: Thu, 15 Mar 2012 12:07:42 -0800
Question for the veterans:
I'm coding a simple space combat game with GTK+. For the sprites, I know
I can do this to draw:
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 to go about this.
--
frigidcode.com
indicium.us
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]