summaryrefslogtreecommitdiff
path: root/common/pixman_utils.h
blob: 9fb1be1cbf38fc3a1144a9fa4253cce54051bc1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/* -*- 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 <spice/types.h>
#define PIXMAN_DONT_DEFINE_STDINT
#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 */