summaryrefslogtreecommitdiff
path: root/fimage.h
blob: a06190128d3af9b4585f2113d22deccc5ea4b551 (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
typedef struct fragment_t fragment_t;

#define TRUE 1
#define FALSE 0

fragment_t *fragment_new_blank  (int                   width,
				 int                   height);
fragment_t *fragment_new_white  (int                   width,
				 int                   height);
fragment_t *fragment_new_traps  (int                   width,
				 int                   height,
				 int                   n_traps,
				 pixman_trapezoid_t   *traps);
fragment_t *fragment_new_glyphs (int                   width,
				 int                   height,
				 pixman_glyph_cache_t *cache,
				 int                   n_glyphs,
				 pixman_glyph_t       *glyphs);
fragment_t *fragment_new_image  (int                   width,
				 int                   height,
				 pixman_image_t       *image);
fragment_t *fragment_new_region (pixman_region32_t    *region);

/* Creates a new fragment corresponding to the intersection of
 * source with destination. The content of this fragment is
 * (dest OP source).
 *
 * The intersection is subtracted from dest. The source is not changed
 *
 * Should probably be called "fragment_new_composite (op, dest, source)" FIXME
 */
fragment_t *  fragment_composite (fragment_t     *dest,
				  pixman_op_t     op,
				  fragment_t     *source);
/* A new fragment is create that is the same as dest with the
 * region of other subtracted. @dest is freed (or, more likely, recycled)
 */
fragment_t *  fragment_subtract  (fragment_t     *dest,
				  fragment_t     *other);
pixman_bool_t fragment_apply     (fragment_t     *fragment,
				  pixman_image_t *image);

void          fragment_free      (fragment_t *fragment);
pixman_bool_t fragment_is_empty (fragment_t *fragment);
pixman_bool_t fragment_is_broken (fragment_t *fragment);



/* Images */
typedef struct fimage_t fimage_t;

fimage_t *fimage_new_blank (int width, int height);
fimage_t *fimage_new_white (int width, int height);
/* Takes ownership of @glyphs, but not glyph_cache */
fimage_t *fimage_new_glyphs (int width, int height,
			     pixman_glyph_cache_t *glyph_cache,
			     int n_glyphs,
			     pixman_glyph_t *glyphs);
/* Takes ownership of the trapezoids */
fimage_t *fimage_new_traps (int width, int height, int n_traps, pixman_trapezoid_t *traps);
/* Takes ownership of the image */
fimage_t *fimage_new_image (int width, int height, pixman_image_t *image);
/* Makes a copy of the region; does not take ownership */
fimage_t *fimage_new_region (int width, int height,
			     pixman_region32_t *region);
fimage_t *
fimage_composite (fimage_t *dest, pixman_op_t op, fimage_t *source);
void fimage_free (fimage_t *image);