Re: multiple sprites images in one PNG

Arjen Nienhuis <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <CAG6W84+vtFaLemjaOQGCrbTqG+yL-tTqdVQo2_JJD6jV+2p74w@mail.gmail.com>
You can use ..._clip() or ..._rectangle() with ..._fill()

Gr. Arjen
On Mar 16, 2012 6:13 AM, "Christopher Howard" <
[email protected]> 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:
>
> 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
>

--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.