summaryrefslogtreecommitdiff
path: root/src/cairoint.h
blob: f728cd010b4ac5dc16a386223c73f49b747e6df7 (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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
/*
 * Copyright © 2002 USC, Information Sciences Institute
 *
 * 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 the
 * University of Southern California not be used in advertising or
 * publicity pertaining to distribution of the software without
 * specific, written prior permission. The University of Southern
 * California makes no representations about the suitability of this
 * software for any purpose.  It is provided "as is" without express
 * or implied warranty.
 *
 * THE UNIVERSITY OF SOUTHERN CALIFORNIA DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF
 * SOUTHERN CALIFORNIA 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.
 *
 * Author: Carl D. Worth <cworth@isi.edu>
 */

/*
 * These definitions are solely for use by the implementation of Cairo
 * and constitute no kind of standard.  If you need any of these
 * functions, please drop me a note.  Either the library needs new
 * functionality, or there's a way to do what you need using the
 * existing published interfaces. cworth@isi.edu
 */

#ifndef _CAIROINT_H_
#define _CAIROINT_H_

#include <assert.h>

#include <math.h>
#include <X11/Xlibint.h>
#include <X11/Xft/Xft.h>

#include "cairo.h"

#ifndef __GCC__
#define __attribute__(x)
#endif

#ifdef WIN32
typedef __int64		cairo_fixed_32_32_t;
#else
#  if defined(__alpha__) || defined(__alpha) || \
      defined(ia64) || defined(__ia64__) || \
      defined(__sparc64__) || \
      defined(__s390x__) || \
      defined(x86_64) || defined (__x86_64__)
typedef long		cairo_fixed_32_32_t;
# else
#  if defined(__GNUC__) && \
    ((__GNUC__ > 2) || \
     ((__GNUC__ == 2) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ > 7)))
__extension__
#  endif
typedef long long int	cairo_fixed_32_32_t;
# endif
#endif

typedef cairo_fixed_32_32_t cairo_fixed_48_16_t;
typedef int32_t cairo_fixed_16_16_t;

/* Sure wish C had a real enum type so that this would be distinct
   from cairo_status_t. Oh well, without that, I'll use this bogus 1000
   offset */
typedef enum cairo_int_status {
    cairo_int_status_degenerate = 1000
} cairo_int_status_t;

typedef enum cairo_path_op {
    cairo_path_op_move_to = 0,
    cairo_path_op_line_to = 1,
    cairo_path_op_curve_to = 2,
    cairo_path_op_close_path = 3
} __attribute__ ((packed)) cairo_path_op_t; /* Don't want 32 bits if we can avoid it. */

typedef enum cairo_path_direction {
    cairo_path_direction_forward,
    cairo_path_direction_reverse
} cairo_path_direction_t;

typedef enum cairo_sub_path_done {
    cairo_sub_path_done_cap,
    cairo_sub_path_done_join
} cairo_sub_path_done_t;

typedef struct cairo_path_callbacks {
    cairo_status_t (*AddEdge) (void *closure, XPointFixed *p1, XPointFixed *p2);
    cairo_status_t (*AddSpline) (void *closure, XPointFixed *a, XPointFixed *b, XPointFixed *c, XPointFixed *d);
    cairo_status_t (*DoneSubPath) (void *closure, cairo_sub_path_done_t done);
    cairo_status_t (*DonePath) (void *closure);
} cairo_path_callbacks_t;

#define CAIRO_PATH_BUF_SZ 64

typedef struct cairo_path_op_buf {
    int num_ops;
    cairo_path_op_t op[CAIRO_PATH_BUF_SZ];

    struct cairo_path_op_buf *next, *prev;
} cairo_path_op_buf_t;

typedef struct cairo_path_arg_buf {
    int num_pts;
    XPointFixed pt[CAIRO_PATH_BUF_SZ];

    struct cairo_path_arg_buf *next, *prev;
} cairo_path_arg_buf_t;

typedef struct cairo_path {
    cairo_path_op_buf_t *op_head;
    cairo_path_op_buf_t *op_tail;

    cairo_path_arg_buf_t *arg_head;
    cairo_path_arg_buf_t *arg_tail;
} cairo_path_t;

typedef struct cairo_edge {
    XLineFixed edge;
    Bool clockWise;

    XFixed current_x;
    struct cairo_edge *next, *prev;
} cairo_edge_t;

typedef struct cairo_polygon {
    int num_edges;
    int edges_size;
    cairo_edge_t *edges;

    XPointFixed first_pt;
    int first_pt_defined;
    XPointFixed last_pt;
    int last_pt_defined;

    int closed;
} cairo_polygon_t;

typedef struct cairo_slope_fixed
{
    XFixed dx;
    XFixed dy;
} cairo_slope_fixed_t;

typedef struct cairo_spline {
    XPointFixed a, b, c, d;

    cairo_slope_fixed_t initial_slope;
    cairo_slope_fixed_t final_slope;

    int num_pts;
    int pts_size;
    XPointFixed *pts;
} cairo_spline_t;

/* XXX: This can go away once incremental spline tessellation is working */
typedef enum cairo_pen_stroke_direction {
    cairo_pen_stroke_direction_forward,
    cairo_pen_stroke_direction_reverse
} cairo_pen_stroke_direction_t;

typedef struct _cairo_pen_vertex {
    XPointFixed pt;

    double theta;
    cairo_slope_fixed_t slope_ccw;
    cairo_slope_fixed_t slope_cw;
} cairo_pen_vertex_t;

typedef struct cairo_pen {
    double radius;
    double tolerance;

    int num_vertices;
    cairo_pen_vertex_t *vertex;
} cairo_pen_t;

struct cairo_surface {
    Display *dpy;
    char *image_data;

    XcSurface *xc_surface;

    double ppm;

    unsigned int ref_count;
};

typedef struct cairo_color {
    double red;
    double green;
    double blue;
    double alpha;

    XcColor xc_color;
} cairo_color_t;

struct cairo_matrix {
    double m[3][2];
};

typedef struct cairo_traps {
    int num_xtraps;
    int xtraps_size;
    XTrapezoid *xtraps;
} cairo_traps_t;

#define CAIRO_FONT_KEY_DEFAULT		"serif"

typedef struct cairo_font {
    unsigned char *key;

    double scale;
    cairo_matrix_t matrix;

    Display *dpy;
    XftFont *xft_font;
} cairo_font_t;


#define CAIRO_GSTATE_OPERATOR_DEFAULT	CAIRO_OPERATOR_OVER
#define CAIRO_GSTATE_TOLERANCE_DEFAULT	0.1
#define CAIRO_GSTATE_FILL_RULE_DEFAULT	CAIRO_FILL_RULE_WINDING
#define CAIRO_GSTATE_LINE_WIDTH_DEFAULT	2.0
#define CAIRO_GSTATE_LINE_CAP_DEFAULT	CAIRO_LINE_CAP_BUTT
#define CAIRO_GSTATE_LINE_JOIN_DEFAULT	CAIRO_LINE_JOIN_MITER
#define CAIRO_GSTATE_MITER_LIMIT_DEFAULT	10.0

/* Need a name distinct from the cairo_clip function */
typedef struct cairo_clip_rec {
    int x;
    int y;
    int width;
    int height;
    cairo_surface_t *surface;
} cairo_clip_rec_t;

typedef struct cairo_gstate {
    cairo_operator_t operator;
    
    double tolerance;

    /* stroke style */
    double line_width;
    cairo_line_cap_t line_cap;
    cairo_line_join_t line_join;
    double miter_limit;

    cairo_fill_rule_t fill_rule;

    double *dash;
    int num_dashes;
    double dash_offset;

    cairo_font_t font;

    cairo_surface_t *surface;
    cairo_surface_t *solid;
    cairo_surface_t *pattern;
    XPointDouble pattern_offset;

    cairo_clip_rec_t clip;

    double alpha;
    cairo_color_t color;

    double ppm;
    cairo_matrix_t ctm;
    cairo_matrix_t ctm_inverse;

    cairo_path_t path;

    XPointDouble last_move_pt;
    XPointDouble current_pt;
    int has_current_pt;

    cairo_pen_t pen_regular;

    struct cairo_gstate *next;
} cairo_gstate_t;

struct cairo {
    cairo_gstate_t *gstate;
    cairo_status_t status;
};

typedef struct cairo_stroke_face {
    XPointFixed ccw;
    XPointFixed pt;
    XPointFixed cw;
    cairo_slope_fixed_t dev_vector;
    XPointDouble usr_vector;
} cairo_stroke_face_t;

/* cairo_gstate_t.c */
cairo_gstate_t *
_cairo_gstate_create (void);

void
_cairo_gstate_init (cairo_gstate_t *gstate);

cairo_status_t
_cairo_gstate_init_copy (cairo_gstate_t *gstate, cairo_gstate_t *other);

void
_cairo_gstate_fini (cairo_gstate_t *gstate);

void
_cairo_gstate_destroy (cairo_gstate_t *gstate);

cairo_gstate_t *
_cairo_gstate_clone (cairo_gstate_t *gstate);

cairo_status_t
_cairo_gstate_begin_group (cairo_gstate_t *gstate);

cairo_status_t
_cairo_gstate_end_group (cairo_gstate_t *gstate);

cairo_status_t
_cairo_gstate_set_drawable (cairo_gstate_t *gstate, Drawable drawable);

cairo_status_t
_cairo_gstate_set_visual (cairo_gstate_t *gstate, Visual *visual);

cairo_status_t
_cairo_gstate_set_format (cairo_gstate_t *gstate, cairo_format_t format);

cairo_status_t
_cairo_gstate_set_target_surface (cairo_gstate_t *gstate, cairo_surface_t *surface);

cairo_surface_t *
_cairo_gstate_get_target_surface (cairo_gstate_t *gstate);

cairo_status_t
_cairo_gstate_set_pattern (cairo_gstate_t *gstate, cairo_surface_t *pattern);

cairo_status_t
_cairo_gstate_set_operator (cairo_gstate_t *gstate, cairo_operator_t operator);

cairo_operator_t
_cairo_gstate_get_operator (cairo_gstate_t *gstate);

cairo_status_t
_cairo_gstate_set_rgb_color (cairo_gstate_t *gstate, double red, double green, double blue);

cairo_status_t
_cairo_gstate_get_rgb_color (cairo_gstate_t *gstate, double *red, double *green, double *blue);

cairo_status_t
_cairo_gstate_set_tolerance (cairo_gstate_t *gstate, double tolerance);

double
_cairo_gstate_get_tolerance (cairo_gstate_t *gstate);

cairo_status_t
_cairo_gstate_set_alpha (cairo_gstate_t *gstate, double alpha);

double
_cairo_gstate_get_alpha (cairo_gstate_t *gstate);

cairo_status_t
_cairo_gstate_set_fill_rule (cairo_gstate_t *gstate, cairo_fill_rule_t fill_rule);

cairo_status_t
_cairo_gstate_set_line_width (cairo_gstate_t *gstate, double width);

double
_cairo_gstate_get_line_width (cairo_gstate_t *gstate);

cairo_status_t
_cairo_gstate_set_line_cap (cairo_gstate_t *gstate, cairo_line_cap_t line_cap);

cairo_line_cap_t
_cairo_gstate_get_line_cap (cairo_gstate_t *gstate);

cairo_status_t
_cairo_gstate_set_line_join (cairo_gstate_t *gstate, cairo_line_join_t line_join);

cairo_line_join_t
_cairo_gstate_get_line_join (cairo_gstate_t *gstate);

cairo_status_t
_cairo_gstate_set_dash (cairo_gstate_t *gstate, double *dash, int num_dashes, double offset);

cairo_status_t
_cairo_gstate_set_miter_limit (cairo_gstate_t *gstate, double limit);

double
_cairo_gstate_get_miter_limit (cairo_gstate_t *gstate);

cairo_status_t
cairo_gstate_translate (cairo_gstate_t *gstate, double tx, double ty);

cairo_status_t
_cairo_gstate_scale (cairo_gstate_t *gstate, double sx, double sy);

cairo_status_t
_cairo_gstate_rotate (cairo_gstate_t *gstate, double angle);

cairo_status_t
_cairo_gstate_concat_matrix (cairo_gstate_t *gstate,
			     cairo_matrix_t *matrix);

cairo_status_t
_cairo_gstate_set_matrix (cairo_gstate_t *gstate,
			  cairo_matrix_t *matrix);

cairo_status_t
_cairo_gstate_default_matrix (cairo_gstate_t *gstate);

cairo_status_t
_cairo_gstate_identity_matrix (cairo_gstate_t *gstate);

cairo_status_t
cairo_gstateransform_point (cairo_gstate_t *gstate, double *x, double *y);

cairo_status_t
cairo_gstateransform_distance (cairo_gstate_t *gstate, double *dx, double *dy);

cairo_status_t
_cairo_gstate_inverse_transform_point (cairo_gstate_t *gstate, double *x, double *y);

cairo_status_t
_cairo_gstate_inverse_transform_distance (cairo_gstate_t *gstate, double *dx, double *dy);

cairo_status_t
_cairo_gstate_new_path (cairo_gstate_t *gstate);

cairo_status_t
_cairo_gstate_move_to (cairo_gstate_t *gstate, double x, double y);

cairo_status_t
_cairo_gstate_line_to (cairo_gstate_t *gstate, double x, double y);

cairo_status_t
_cairo_gstate_curve_to (cairo_gstate_t *gstate,
			double x1, double y1,
			double x2, double y2,
			double x3, double y3);

cairo_status_t
_cairo_gstate_rel_move_to (cairo_gstate_t *gstate, double dx, double dy);

cairo_status_t
_cairo_gstate_rel_line_to (cairo_gstate_t *gstate, double dx, double dy);

cairo_status_t
_cairo_gstate_rel_curve_to (cairo_gstate_t *gstate,
			    double dx1, double dy1,
			    double dx2, double dy2,
			    double dx3, double dy3);

cairo_status_t
_cairo_gstate_close_path (cairo_gstate_t *gstate);

cairo_status_t
_cairo_gstate_get_current_point (cairo_gstate_t *gstate, double *x, double *y);

cairo_status_t
_cairo_gstate_stroke (cairo_gstate_t *gstate);

cairo_status_t
_cairo_gstate_fill (cairo_gstate_t *gstate);

cairo_status_t
_cairo_gstate_clip (cairo_gstate_t *gstate);

cairo_status_t
_cairo_gstate_select_font (cairo_gstate_t *gstate, const char *key);

cairo_status_t
_cairo_gstate_scale_font (cairo_gstate_t *gstate, double scale);

cairo_status_t
cairo_gstateransform_font (cairo_gstate_t *gstate,
			   double a, double b,
			   double c, double d);

cairo_status_t
cairo_gstateext_extents (cairo_gstate_t *gstate,
			 const unsigned char *utf8,
			 double *x, double *y,
			 double *width, double *height,
			 double *dx, double *dy);

cairo_status_t
_cairo_gstate_show_text (cairo_gstate_t *gstate, const unsigned char *utf8);

cairo_status_t
_cairo_gstate_show_surface (cairo_gstate_t	*gstate,
			    cairo_surface_t	*surface,
			    int			width,
			    int			height);

/* cairo_color_t.c */
void
_cairo_color_init (cairo_color_t *color);

void
_cairo_color_fini (cairo_color_t *color);

void
_cairo_color_set_rgb (cairo_color_t *color, double red, double green, double blue);

void
_cairo_color_get_rgb (cairo_color_t *color, double *red, double *green, double *blue);

void
_cairo_color_set_alpha (cairo_color_t *color, double alpha);

/* cairo_font_t.c */

void
_cairo_font_init (cairo_font_t *font);

cairo_status_t
_cairo_font_init_copy (cairo_font_t *font, cairo_font_t *other);

void
_cairo_font_fini (cairo_font_t *font);

cairo_status_t
_cairo_font_select (cairo_font_t *font, const char *key);

cairo_status_t
_cairo_font_scale (cairo_font_t *font, double scale);

cairo_status_t
cairo_font_transform (cairo_font_t *font,
		      double a, double b,
		      double c, double d);

cairo_status_t
_cairo_font_resolve_xft_font (cairo_font_t *font, cairo_gstate_t *gstate, XftFont **xft_font);

/* cairo_path_t.c */
void
_cairo_path_init (cairo_path_t *path);

cairo_status_t
_cairo_path_init_copy (cairo_path_t *path, cairo_path_t *other);

void
_cairo_path_fini (cairo_path_t *path);

cairo_status_t
_cairo_path_move_to (cairo_path_t *path, double x, double y);

cairo_status_t
_cairo_path_line_to (cairo_path_t *path, double x, double y);

cairo_status_t
_cairo_path_curve_to (cairo_path_t *path,
		      double x1, double y1,
		      double x2, double y2,
		      double x3, double y3);

cairo_status_t
_cairo_path_close_path (cairo_path_t *path);

cairo_status_t
_cairo_path_interpret (cairo_path_t *path,
		       cairo_path_direction_t dir,
		       const cairo_path_callbacks_t *cb,
		       void *closure);

cairo_status_t
_cairo_path_bounds (cairo_path_t *path, double *x1, double *y1, double *x2, double *y2);

/* cairo_path_tfill.c */

cairo_status_t
_cairo_path_fill_to_traps (cairo_path_t *path, cairo_gstate_t *gstate, cairo_traps_t *traps);

/* cairo_path_tstroke.c */

cairo_status_t
_cairo_path_stroke_to_traps (cairo_path_t *path, cairo_gstate_t *gstate, cairo_traps_t *traps);

/* cairo_surface_t.c */

void
_cairo_surface_reference (cairo_surface_t *surface);

XcSurface *
_cairo_surface_get_xc_surface (cairo_surface_t *surface);

/* XXX: This function is going away, right? */
Picture
_cairo_surface_get_picture (cairo_surface_t *surface);

void
_cairo_surface_fill_rectangle (cairo_surface_t	*surface,
			       cairo_operator_t	operator,
			       cairo_color_t	*color,
			       int		x,
			       int		y,
			       int		width,
			       int		height);

/* cairo_pen_t.c */
cairo_status_t
_cairo_pen_init (cairo_pen_t *pen, double radius, cairo_gstate_t *gstate);

cairo_status_t
_cairo_pen_init_empty (cairo_pen_t *pen);

cairo_status_t
_cairo_pen_init_copy (cairo_pen_t *pen, cairo_pen_t *other);

void
_cairo_pen_fini (cairo_pen_t *pen);

cairo_status_t
_cairo_pen_add_points (cairo_pen_t *pen, XPointFixed *pt, int num_pts);

cairo_status_t
_cairo_pen_add_points_for_slopes (cairo_pen_t *pen,
				  XPointFixed *a,
				  XPointFixed *b,
				  XPointFixed *c,
				  XPointFixed *d);

cairo_status_t
_cairo_pen_find_active_cw_vertex_index (cairo_pen_t *pen,
					cairo_slope_fixed_t *slope,
					int *active);

cairo_status_t
_cairo_pen_find_active_ccw_vertex_index (cairo_pen_t *pen,
					 cairo_slope_fixed_t *slope,
					 int *active);

cairo_status_t
_cairo_pen_stroke_spline (cairo_pen_t *pen,
			  cairo_spline_t *spline,
			  double tolerance,
			  cairo_traps_t *traps);

/* cairo_polygon_t.c */
void
_cairo_polygon_init (cairo_polygon_t *polygon);

void
_cairo_polygon_fini (cairo_polygon_t *polygon);

cairo_status_t
_cairo_polygon_add_edge (cairo_polygon_t *polygon, XPointFixed *p1, XPointFixed *p2);

cairo_status_t
_cairo_polygon_add_point (cairo_polygon_t *polygon, XPointFixed *pt);

cairo_status_t
_cairo_polygon_close (cairo_polygon_t *polygon);

/* cairo_spline_t.c */
cairo_int_status_t
_cairo_spline_init (cairo_spline_t *spline,
		    XPointFixed *a,
		    XPointFixed *b,
		    XPointFixed *c,
		    XPointFixed *d);

cairo_status_t
_cairo_spline_decompose (cairo_spline_t *spline, double tolerance);

void
_cairo_spline_fini (cairo_spline_t *spline);

/* cairo_matrix_t.c */
void
_cairo_matrix_init (cairo_matrix_t *matrix);

void
_cairo_matrix_fini (cairo_matrix_t *matrix);

cairo_status_t
_cairo_matrix_set_translate (cairo_matrix_t *matrix,
			     double tx, double ty);

cairo_status_t
_cairo_matrix_set_scale (cairo_matrix_t *matrix,
			 double sx, double sy);

cairo_status_t
_cairo_matrix_set_rotate (cairo_matrix_t *matrix,
			  double angle);

cairo_status_t
cairo_matrix_transform_bounding_box (cairo_matrix_t *matrix,
				     double *x, double *y,
				     double *width, double *height);

cairo_status_t
_cairo_matrix_compute_determinant (cairo_matrix_t *matrix, double *det);

cairo_status_t
_cairo_matrix_compute_eigen_values (cairo_matrix_t *matrix, double *lambda1, double *lambda2);

/* cairo_traps.c */
void
cairo_traps_init (cairo_traps_t *traps);

void
cairo_traps_fini (cairo_traps_t *traps);

cairo_status_t
cairo_traps_tessellate_triangle (cairo_traps_t *traps, XPointFixed t[3]);

cairo_status_t
cairo_traps_tessellate_rectangle (cairo_traps_t *traps, XPointFixed q[4]);

cairo_status_t
cairo_traps_tessellate_polygon (cairo_traps_t *traps,
				cairo_polygon_t *poly,
				cairo_fill_rule_t fill_rule);

/* cairo_misc.c */

void
_compute_slope (XPointFixed *a, XPointFixed *b, cairo_slope_fixed_t *slope);

#endif