~serge-hallyn/ubuntu/raring/spice/spice-fixed2

« back to all changes in this revision

Viewing changes to common/pixman_utils.h

  • Committer: Package Import Robot
  • Author(s): Liang Guo
  • Date: 2011-07-23 12:21:04 UTC
  • Revision ID: package-import@ubuntu.com-20110723122104-gvv70gd6ui6213qd
Tags: upstream-0.8.2
ImportĀ upstreamĀ versionĀ 0.8.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
 
2
/*
 
3
   Copyright (C) 2009 Red Hat, Inc.
 
4
 
 
5
   This library is free software; you can redistribute it and/or
 
6
   modify it under the terms of the GNU Lesser General Public
 
7
   License as published by the Free Software Foundation; either
 
8
   version 2.1 of the License, or (at your option) any later version.
 
9
 
 
10
   This library is distributed in the hope that it will be useful,
 
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
   Lesser General Public License for more details.
 
14
 
 
15
   You should have received a copy of the GNU Lesser General Public
 
16
   License along with this library; if not, see <http://www.gnu.org/licenses/>.
 
17
*/
 
18
 
 
19
#ifndef _H__PIXMAN_UTILS
 
20
#define _H__PIXMAN_UTILS
 
21
 
 
22
#include <spice/types.h>
 
23
#include <stdlib.h>
 
24
#define PIXMAN_DONT_DEFINE_STDINT
 
25
#include <pixman.h>
 
26
 
 
27
#include "draw.h"
 
28
 
 
29
#ifdef __cplusplus
 
30
extern "C" {
 
31
#endif
 
32
 
 
33
/* This lists all possible 2 argument binary raster ops.
 
34
 * This enum has the same values as the X11 GXcopy type
 
35
 * and same as the GL constants (GL_AND etc) if you
 
36
 * or it with 0x1500. However it is not exactly the
 
37
 * same as the win32 ROP2 type (they use another order).
 
38
 */
 
39
typedef enum {
 
40
    SPICE_ROP_CLEAR,         /* 0x0    0 */
 
41
    SPICE_ROP_AND,           /* 0x1    src AND dst */
 
42
    SPICE_ROP_AND_REVERSE,   /* 0x2    src AND NOT dst */
 
43
    SPICE_ROP_COPY,          /* 0x3    src */
 
44
    SPICE_ROP_AND_INVERTED,  /* 0x4    (NOT src) AND dst */
 
45
    SPICE_ROP_NOOP,          /* 0x5    dst */
 
46
    SPICE_ROP_XOR,           /* 0x6    src XOR dst */
 
47
    SPICE_ROP_OR,            /* 0x7    src OR dst */
 
48
    SPICE_ROP_NOR,           /* 0x8    (NOT src) AND (NOT dst) */
 
49
    SPICE_ROP_EQUIV,         /* 0x9    (NOT src) XOR dst */
 
50
    SPICE_ROP_INVERT,        /* 0xa    NOT dst */
 
51
    SPICE_ROP_OR_REVERSE,    /* 0xb    src OR (NOT dst) */
 
52
    SPICE_ROP_COPY_INVERTED, /* 0xc    NOT src */
 
53
    SPICE_ROP_OR_INVERTED,   /* 0xd    (NOT src) OR dst */
 
54
    SPICE_ROP_NAND,          /* 0xe    (NOT src) OR (NOT dst) */
 
55
    SPICE_ROP_SET            /* 0xf    1 */
 
56
} SpiceROP;
 
57
 
 
58
 
 
59
int spice_pixman_image_get_bpp(pixman_image_t *image);
 
60
 
 
61
pixman_format_code_t spice_surface_format_to_pixman(uint32_t surface_format);
 
62
pixman_format_code_t spice_bitmap_format_to_pixman(int bitmap_format,
 
63
                                                   uint32_t palette_surface_format);
 
64
pixman_image_t *spice_bitmap_try_as_pixman(int src_format, int flags,
 
65
                                           int width, int height,
 
66
                                           uint8_t *data, int stride);
 
67
pixman_image_t *spice_bitmap_to_pixman(pixman_image_t *dest_image,
 
68
                                       int src_format, int flags,
 
69
                                       int width, int height,
 
70
                                       uint8_t *src, int src_stride,
 
71
                                       uint32_t palette_surface_format,
 
72
                                       SpicePalette *palette);
 
73
pixman_image_t *spice_bitmap_convert_to_pixman(pixman_format_code_t dest_format,
 
74
                                               pixman_image_t *dest_image,
 
75
                                               int src_format, int flags,
 
76
                                               int width, int height,
 
77
                                               uint8_t *src, int src_stride,
 
78
                                               uint32_t palette_surface_format,
 
79
                                               SpicePalette *palette);
 
80
 
 
81
void spice_pixman_region32_init_from_bitmap(pixman_region32_t *region,
 
82
                                            uint32_t *data,
 
83
                                            int width, int height,
 
84
                                            int stride);
 
85
pixman_bool_t spice_pixman_region32_init_rects(pixman_region32_t *region,
 
86
                                               const SpiceRect   *rects,
 
87
                                               int                count);
 
88
void spice_pixman_fill_rect(pixman_image_t *dest,
 
89
                            int x, int y,
 
90
                            int w, int h,
 
91
                            uint32_t value);
 
92
void spice_pixman_fill_rect_rop(pixman_image_t *dest,
 
93
                                int x, int y,
 
94
                                int w, int h,
 
95
                                uint32_t value,
 
96
                                SpiceROP rop);
 
97
void spice_pixman_tile_rect(pixman_image_t *dest,
 
98
                            int x, int y,
 
99
                            int w, int h,
 
100
                            pixman_image_t *tile,
 
101
                            int offset_x,
 
102
                            int offset_y);
 
103
void spice_pixman_tile_rect_rop(pixman_image_t *dest,
 
104
                                int x, int y,
 
105
                                int w, int h,
 
106
                                pixman_image_t *tile,
 
107
                                int offset_x,
 
108
                                int offset_y,
 
109
                                SpiceROP rop);
 
110
void spice_pixman_blit(pixman_image_t *dest,
 
111
                       pixman_image_t *src,
 
112
                       int src_x, int src_y,
 
113
                       int dest_x, int dest_y,
 
114
                       int w, int h);
 
115
void spice_pixman_blit_rop(pixman_image_t *dest,
 
116
                           pixman_image_t *src,
 
117
                           int src_x, int src_y,
 
118
                           int dest_x, int dest_y,
 
119
                           int w, int h,
 
120
                           SpiceROP rop);
 
121
void spice_pixman_blit_colorkey(pixman_image_t *dest,
 
122
                                pixman_image_t *src,
 
123
                                int src_x, int src_y,
 
124
                                int dest_x, int dest_y,
 
125
                                int width, int height,
 
126
                                uint32_t transparent_color);
 
127
void spice_pixman_copy_rect(pixman_image_t *image,
 
128
                            int src_x, int src_y,
 
129
                            int w, int h,
 
130
                            int dest_x, int dest_y);
 
131
 
 
132
#ifdef __cplusplus
 
133
}
 
134
#endif
 
135
 
 
136
#endif /* _H__PIXMAN_UTILS */