summaryrefslogtreecommitdiffstats
path: root/common/pixman_utils.h
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2010-02-08 11:48:12 +0100
committerAlexander Larsson <alexl@redhat.com>2010-02-23 14:43:15 +0100
commit9091e763a80d368114100d8452e26af67c5829b3 (patch)
treecd1129b6bdebbe7957e5f98cb1bd85b725f7eabc /common/pixman_utils.h
parent2233dd02a191200b5d33f0b37c32ebf05880c126 (diff)
downloadspice-9091e763a80d368114100d8452e26af67c5829b3.tar.gz
spice-9091e763a80d368114100d8452e26af67c5829b3.tar.xz
spice-9091e763a80d368114100d8452e26af67c5829b3.zip
Add pixman utilities
This includes: * pixman region from SpiceRects * rop2 enum * solid fill * solid fill with rop * tiled fill * tiled fill with rop * blit * blit with rop * copy rect
Diffstat (limited to 'common/pixman_utils.h')
-rw-r--r--common/pixman_utils.h103
1 files changed, 103 insertions, 0 deletions
diff --git a/common/pixman_utils.h b/common/pixman_utils.h
new file mode 100644
index 00000000..fb8dd02f
--- /dev/null
+++ b/common/pixman_utils.h
@@ -0,0 +1,103 @@
+/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+/*
+ Copyright (C) 2009 Red Hat, Inc.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of
+ the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _H__PIXMAN_UTILS
+#define _H__PIXMAN_UTILS
+
+#include <pixman.h>
+
+#include <spice/draw.h>
+
+/* This lists all possible 2 argument binary raster ops.
+ * This enum has the same values as the X11 GXcopy type
+ * and same as the GL constants (GL_AND etc) if you
+ * or it with 0x1500. However it is not exactly the
+ * same as the win32 ROP2 type (they use another order).
+ */
+typedef enum {
+ SPICE_ROP_CLEAR, /* 0x0 0 */
+ SPICE_ROP_AND, /* 0x1 src AND dst */
+ SPICE_ROP_AND_REVERSE, /* 0x2 src AND NOT dst */
+ SPICE_ROP_COPY, /* 0x3 src */
+ SPICE_ROP_AND_INVERTED, /* 0x4 (NOT src) AND dst */
+ SPICE_ROP_NOOP, /* 0x5 dst */
+ SPICE_ROP_XOR, /* 0x6 src XOR dst */
+ SPICE_ROP_OR, /* 0x7 src OR dst */
+ SPICE_ROP_NOR, /* 0x8 (NOT src) AND (NOT dst) */
+ SPICE_ROP_EQUIV, /* 0x9 (NOT src) XOR dst */
+ SPICE_ROP_INVERT, /* 0xa NOT dst */
+ SPICE_ROP_OR_REVERSE, /* 0xb src OR (NOT dst) */
+ SPICE_ROP_COPY_INVERTED, /* 0xc NOT src */
+ SPICE_ROP_OR_INVERTED, /* 0xd (NOT src) OR dst */
+ SPICE_ROP_NAND, /* 0xe (NOT src) OR (NOT dst) */
+ SPICE_ROP_SET /* 0xf 1 */
+} SpiceROP;
+
+
+void spice_pixman_region32_init_from_bitmap(pixman_region32_t *region,
+ uint32_t *data,
+ int width, int height,
+ int stride);
+pixman_bool_t spice_pixman_region32_init_rects(pixman_region32_t *region,
+ const SpiceRect *rects,
+ int count);
+void spice_pixman_fill_rect(pixman_image_t *dest,
+ int x, int y,
+ int w, int h,
+ uint32_t value);
+void spice_pixman_fill_rect_rop(pixman_image_t *dest,
+ int x, int y,
+ int w, int h,
+ uint32_t value,
+ SpiceROP rop);
+void spice_pixman_tile_rect(pixman_image_t *dest,
+ int x, int y,
+ int w, int h,
+ pixman_image_t *tile,
+ int offset_x,
+ int offset_y);
+void spice_pixman_tile_rect_rop(pixman_image_t *dest,
+ int x, int y,
+ int w, int h,
+ pixman_image_t *tile,
+ int offset_x,
+ int offset_y,
+ SpiceROP rop);
+void spice_pixman_blit(pixman_image_t *dest,
+ pixman_image_t *src,
+ int src_x, int src_y,
+ int dest_x, int dest_y,
+ int w, int h);
+void spice_pixman_blit_rop(pixman_image_t *dest,
+ pixman_image_t *src,
+ int src_x, int src_y,
+ int dest_x, int dest_y,
+ int w, int h,
+ SpiceROP rop);
+void spice_pixman_blit_colorkey(pixman_image_t *dest,
+ pixman_image_t *src,
+ int src_x, int src_y,
+ int dest_x, int dest_y,
+ int width, int height,
+ uint32_t transparent_color);
+void spice_pixman_copy_rect(pixman_image_t *image,
+ int src_x, int src_y,
+ int w, int h,
+ int dest_x, int dest_y);
+
+#endif /* _H__PIXMAN_UTILS */