pixman.h revision a2760a4d593af57a19ec32cdfd1723b68495df8c
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/*
* Copyright © 1998, 2004 Keith Packard
* Copyright 2007 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef PIXMAN_H__
#define PIXMAN_H__
/*
* Standard integers
*/
# include <sys/int_types.h>
# include <stdint.h>
#elif defined (__OpenBSD__)
# include <inttypes.h>
#else
# include <stdint.h>
#endif
/*
* Boolean
*/
typedef int pixman_bool_t;
/*
* Fixpoint numbers
*/
typedef int64_t pixman_fixed_32_32_t;
typedef pixman_fixed_32_32_t pixman_fixed_48_16_t;
typedef uint32_t pixman_fixed_1_31_t;
typedef uint32_t pixman_fixed_1_16_t;
typedef int32_t pixman_fixed_16_16_t;
typedef pixman_fixed_16_16_t pixman_fixed_t;
#define pixman_fixed_to_int(f) ((int) ((f) >> 16))
#define pixman_fixed_to_double(f) (double) ((f) / (double) pixman_fixed_1)
#define pixman_fixed_frac(f) ((f) & pixman_fixed_1_minus_e)
#define pixman_fixed_floor(f) ((f) & ~pixman_fixed_1_minus_e)
#define pixman_fixed_fraction(f) ((f) & pixman_fixed_1_minus_e)
/*
* Misc structs
*/
typedef struct pixman_color pixman_color_t;
typedef struct pixman_point_fixed pixman_point_fixed_t;
typedef struct pixman_line_fixed pixman_line_fixed_t;
typedef struct pixman_vector pixman_vector_t;
typedef struct pixman_transform pixman_transform_t;
struct pixman_color
{
};
struct pixman_point_fixed
{
};
struct pixman_line_fixed
{
};
struct pixman_vector
{
};
struct pixman_transform
{
};
/* Don't blame me, blame XRender */
typedef enum
{
typedef enum
{
typedef enum
{
PIXMAN_OP_CLEAR = 0x00,
PIXMAN_OP_SRC = 0x01,
PIXMAN_OP_DST = 0x02,
PIXMAN_OP_OVER = 0x03,
PIXMAN_OP_OVER_REVERSE = 0x04,
PIXMAN_OP_IN = 0x05,
PIXMAN_OP_IN_REVERSE = 0x06,
PIXMAN_OP_OUT = 0x07,
PIXMAN_OP_OUT_REVERSE = 0x08,
PIXMAN_OP_ATOP = 0x09,
PIXMAN_OP_ATOP_REVERSE = 0x0a,
PIXMAN_OP_XOR = 0x0b,
PIXMAN_OP_ADD = 0x0c,
PIXMAN_OP_SATURATE = 0x0d,
PIXMAN_OP_DISJOINT_CLEAR = 0x10,
PIXMAN_OP_DISJOINT_SRC = 0x11,
PIXMAN_OP_DISJOINT_DST = 0x12,
PIXMAN_OP_DISJOINT_OVER = 0x13,
PIXMAN_OP_DISJOINT_OVER_REVERSE = 0x14,
PIXMAN_OP_DISJOINT_IN = 0x15,
PIXMAN_OP_DISJOINT_IN_REVERSE = 0x16,
PIXMAN_OP_DISJOINT_OUT = 0x17,
PIXMAN_OP_DISJOINT_OUT_REVERSE = 0x18,
PIXMAN_OP_DISJOINT_ATOP = 0x19,
PIXMAN_OP_DISJOINT_ATOP_REVERSE = 0x1a,
PIXMAN_OP_DISJOINT_XOR = 0x1b,
PIXMAN_OP_CONJOINT_CLEAR = 0x20,
PIXMAN_OP_CONJOINT_SRC = 0x21,
PIXMAN_OP_CONJOINT_DST = 0x22,
PIXMAN_OP_CONJOINT_OVER = 0x23,
PIXMAN_OP_CONJOINT_OVER_REVERSE = 0x24,
PIXMAN_OP_CONJOINT_IN = 0x25,
PIXMAN_OP_CONJOINT_IN_REVERSE = 0x26,
PIXMAN_OP_CONJOINT_OUT = 0x27,
PIXMAN_OP_CONJOINT_OUT_REVERSE = 0x28,
PIXMAN_OP_CONJOINT_ATOP = 0x29,
PIXMAN_OP_CONJOINT_ATOP_REVERSE = 0x2a,
PIXMAN_OP_CONJOINT_XOR = 0x2b
} pixman_op_t;
/*
* Regions
*/
typedef struct pixman_region16_data pixman_region16_data_t;
typedef struct pixman_box16 pixman_box16_t;
typedef struct pixman_rectangle16 pixman_rectangle16_t;
typedef struct pixman_region16 pixman_region16_t;
struct pixman_region16_data {
long size;
long numRects;
/* pixman_box16_t rects[size]; in memory but not explicitly declared */
};
struct pixman_rectangle16
{
int16_t x, y;
};
struct pixman_box16
{
};
struct pixman_region16
{
};
typedef enum
{
/* This function exists only to make it possible to preserve the X ABI - it should
* go away at first opportunity.
*/
/* creation/destruction */
int x,
int y,
unsigned int width,
unsigned int height);
/* manipulation */
int x,
int y);
int x,
int y,
unsigned int width,
unsigned int height);
int x, int y, pixman_box16_t *box);
int *n_rects);
/* Copy / Fill */
int src_stride,
int dst_stride,
int src_bpp,
int dst_bpp,
int stride,
int bpp,
int x,
int y,
int width,
int height,
/*
* Images
*/
typedef union pixman_image pixman_image_t;
typedef struct pixman_indexed pixman_indexed_t;
typedef struct pixman_gradient_stop pixman_gradient_stop_t;
struct pixman_gradient_stop {
};
#if PIXMAN_MAX_INDEXED <= 256
typedef uint8_t pixman_index_type;
#endif
struct pixman_indexed
{
};
/*
* While the protocol is generous in format support, the
* sample implementation allows only packed RGB and GBR
* representations for data to simplify software rendering,
*/
((type) << 16) | \
((a) << 12) | \
((r) << 8) | \
((g) << 4) | \
((b)))
#define PIXMAN_FORMAT_BPP(f) (((f) >> 24) )
#define PIXMAN_FORMAT_B(f) (((f) ) & 0x0f)
#define PIXMAN_FORMAT_RGB(f) (((f) ) & 0xfff)
#define PIXMAN_FORMAT_VIS(f) (((f) ) & 0xffff)
#define PIXMAN_FORMAT_DEPTH(f) (PIXMAN_FORMAT_A(f) + \
PIXMAN_FORMAT_R(f) + \
PIXMAN_FORMAT_G(f) + \
PIXMAN_FORMAT_B(f))
#define PIXMAN_TYPE_OTHER 0
#define PIXMAN_TYPE_A 1
#define PIXMAN_TYPE_ARGB 2
#define PIXMAN_TYPE_ABGR 3
#define PIXMAN_TYPE_COLOR 4
#define PIXMAN_TYPE_GRAY 5
/* 32bpp formats */
typedef enum {
/* 24bpp formats */
/* 16bpp formats */
/* 8bpp formats */
/* 4bpp formats */
/* 1bpp formats */
/* Constructors */
const pixman_gradient_stop_t *stops,
int n_stops);
const pixman_gradient_stop_t *stops,
int n_stops);
const pixman_gradient_stop_t *stops,
int n_stops);
int width,
int height,
int rowstride_bytes);
/* Destructor */
/* Set properties */
const pixman_transform_t *transform);
const pixman_fixed_t *filter_params,
int n_filter_params);
int n_params);
int16_t x,
int16_t y);
const pixman_indexed_t *indexed);
int n_rects,
const pixman_rectangle16_t *rects);
/* Composite */
/*
* Trapezoids
*/
typedef struct pixman_edge pixman_edge_t;
typedef struct pixman_trapezoid pixman_trapezoid_t;
typedef struct pixman_trap pixman_trap_t;
typedef struct pixman_span_fix pixman_span_fix_t;
/*
* An edge structure. This represents a single polygon edge
* and can be quickly stepped across small or large gaps in the
* sample grid
*/
struct pixman_edge
{
};
struct pixman_trapezoid
{
};
/* whether 't' is a well defined not obviously empty trapezoid */
#define pixman_trapezoid_valid(t) \
struct pixman_span_fix
{
pixman_fixed_t l, r, y;
};
struct pixman_trap
{
};
int bpp);
int bpp);
void pixman_edge_step (pixman_edge_t *e,
int n);
void pixman_edge_init (pixman_edge_t *e,
int bpp,
void pixman_line_fixed_edge_init (pixman_edge_t *e,
int bpp,
const pixman_line_fixed_t *line,
int x_off,
int y_off);
pixman_edge_t *l,
pixman_edge_t *r,
pixman_fixed_t b);
int ntrap,
int y_off,
int ntraps,
const pixman_trapezoid_t *traps);
const pixman_trapezoid_t *trap,
int x_off,
int y_off);
#endif /* PIXMAN_H__ */