[cairo] multiple sprites images in one PNG
a.g.nienhuis at gmail.com
Fri Mar 16 12:10:54 PDT 2012
You can use ..._clip() or ..._rectangle() with ..._fill()
On Mar 16, 2012 6:13 AM, "Christopher Howard" <
christopher.howard at frigidcode.com> wrote:
> 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:
> 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?
> * 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
> cairo mailing list
> cairo at cairographics.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cairo