1/**************************************************************************
2 *
3 * Copyright 2009 VMware, Inc.  All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sub license, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial portions
15 * of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 **************************************************************************/
26
27#ifndef PAINT_H
28#define PAINT_H
29
30#include "vg_context.h"
31
32#include "VG/openvg.h"
33#include "pipe/p_state.h"
34
35struct vg_paint;
36struct vg_image;
37struct pipe_sampler_state;
38struct pipe_resource;
39
40struct vg_paint *paint_create(struct vg_context *ctx);
41void paint_destroy(struct vg_paint *paint);
42
43void paint_set_color(struct vg_paint *paint,
44                     const VGfloat *color);
45void paint_get_color(struct vg_paint *paint,
46                     VGfloat *color);
47
48void paint_set_coloriv(struct vg_paint *paint,
49                      const VGint *color);
50void paint_get_coloriv(struct vg_paint *paint,
51                      VGint *color);
52
53void paint_set_colori(struct vg_paint *paint,
54                      VGuint rgba);
55
56VGuint paint_colori(struct vg_paint *paint);
57
58void paint_set_type(struct vg_paint *paint, VGPaintType type);
59VGPaintType paint_type(struct vg_paint *paint);
60void paint_resolve_type(struct vg_paint *paint);
61
62void paint_set_linear_gradient(struct vg_paint *paint,
63                               const VGfloat *coords);
64void paint_linear_gradient(struct vg_paint *paint,
65                           VGfloat *coords);
66void paint_set_linear_gradienti(struct vg_paint *paint,
67                               const VGint *coords);
68void paint_linear_gradienti(struct vg_paint *paint,
69                           VGint *coords);
70
71
72void paint_set_radial_gradient(struct vg_paint *paint,
73                               const VGfloat *values);
74void paint_radial_gradient(struct vg_paint *paint,
75                           VGfloat *coords);
76void paint_set_radial_gradienti(struct vg_paint *paint,
77                                const VGint *values);
78void paint_radial_gradienti(struct vg_paint *paint,
79                            VGint *coords);
80
81
82void paint_set_ramp_stops(struct vg_paint *paint, const VGfloat *stops,
83                          int num);
84void paint_ramp_stops(struct vg_paint *paint, VGfloat *stops,
85                      int num);
86
87void paint_set_ramp_stopsi(struct vg_paint *paint, const VGint *stops,
88                           int num);
89void paint_ramp_stopsi(struct vg_paint *paint, VGint *stops,
90                       int num);
91
92int paint_num_ramp_stops(struct vg_paint *paint);
93
94void paint_set_spread_mode(struct vg_paint *paint,
95                           VGint mode);
96VGColorRampSpreadMode paint_spread_mode(struct vg_paint *paint);
97
98
99void paint_set_pattern(struct vg_paint *paint,
100                       struct vg_image *img);
101void paint_set_pattern_tiling(struct vg_paint *paint,
102                              VGTilingMode mode);
103VGTilingMode paint_pattern_tiling(struct vg_paint *paint);
104
105void paint_set_color_ramp_premultiplied(struct vg_paint *paint,
106                                        VGboolean set);
107VGboolean paint_color_ramp_premultiplied(struct vg_paint *paint);
108
109
110VGint paint_bind_samplers(struct vg_paint *paint, struct pipe_sampler_state **samplers,
111                          struct pipe_sampler_view **sampler_views);
112
113VGboolean paint_is_degenerate(struct vg_paint *paint);
114
115VGint paint_constant_buffer_size(struct vg_paint *paint);
116
117void paint_fill_constant_buffer(struct vg_paint *paint,
118                                const struct matrix *mat,
119                                void *buffer);
120
121VGboolean paint_is_opaque(struct vg_paint *paint);
122
123#endif
124