Exemple #1
0
static void image32_copy_from_pixbuf(GalImage *image,
		eint dx, eint dy,
		GalPixbuf *pixbuf,
		eint sx, eint sy,
		eint w, eint h)
{
    eint x, y;
    euint32 *p = (euint32 *)(image->pixels + image->rowbytes * dy + dx * image->pixelbytes);

    for (y = 0; y < h; y++) {
        for (x = 0; x < w; x++)
            p[x] = pixbuf_read_pixel32(pixbuf, x + sx, y + sy);
        p += image->w;
    }
}
Exemple #2
0
static void image24_copy_from_pixbuf(GalImage *image,
		eint dx, eint dy,
		GalPixbuf *pixbuf,
		eint sx, eint sy,
		eint w, eint h)
{
    eint x, y;
    euint8 *p;

	if (image->negative) {
		p = image->pixels + image->rowbytes * (dy + h - 1) + dx * image->pixelbytes;
		for (y = 0; y < h; y++) {
			for (x = 0; x < w; x++) {
				euint32 u = pixbuf_read_pixel32(pixbuf, x + sx, y + sy);
				p[x * 3 + 0] = (0xff & u);
				p[x * 3 + 1] = (0xff00 & u) >> 8;
				p[x * 3 + 2] = (0xff0000 & u) >> 16;
			}
			p -= image->rowbytes;
		}
	}