more work on constraints
[turbulence.git] / vapi / cairo-liquidity.vapi
blobf4a40a67ebadbb9a43f1dabd24a7c40fe136f15a
1 /* liquidity/vapi/cairo-liquidity.vapi
2  *
3  * Copyright (C) 2006-2008  Jürg Billeter
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.
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.
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
18  *
19  * Author:
20  *      Jürg Billeter <j@bitron.ch>
21  *
22  * Liquidity modifications by Patrick Walton <pcwalton@uchicago.edu>
23  */
25 [CCode (cheader_filename = "cairo.h", lower_case_cprefix="cairo_")]
26 namespace CairoLiquidity {
27         [CCode (ref_function = "cairo_reference", unref_function = "cairo_destroy", cname = "cairo_t", cprefix = "cairo_", cheader_filename = "cairo.h")]
28         public class Context {
29                 [CCode (cname = "cairo_create")]
30                 public Context (Surface target);
31                 public Status status ();
32                 public void save ();
33                 public void restore ();
34                 
35                 public weak Surface get_target ();
36                 public void push_group ();
37                 public void push_group_with_content (Content content);
38                 public Pattern pop_group ();
39                 public void pop_group_to_source ();
40                 public weak Surface get_group_target ();
41                 
42                 public void set_source_rgb (double red, double green, double blue);
43                 public void set_source_rgba (double red, double green, double blue, double alpha);
44                 public void set_source (Pattern source);
45                 public void set_source_surface (Surface surface, double x, double y);
46                 public weak Pattern get_source ();
48                 public void set_matrix (Matrix matrix);
49                 public void get_matrix (out Matrix matrix);
51                 public void set_antialias (Antialias antialias);
52                 public Antialias get_antialias ();
53                 
54                 public void set_dash (double[] dashes, double offset);
55                 
56                 public void set_fill_rule (FillRule fill_rule);
57                 public FillRule get_fill_rule ();
58                 
59                 public void set_line_cap (LineCap line_cap);
60                 public LineCap get_line_cap ();
61                 
62                 public void set_line_join (LineJoin line_join);
63                 public LineJoin get_line_join ();
64                 
65                 public void set_line_width (double width);
66                 public double get_line_width ();
67                 
68                 public void set_miter_limit (double limit);
69                 public double get_miter_limit ();
70                 
71                 public void set_operator (Operator op);
72                 public Operator get_operator ();
73                 
74                 public void set_tolerance (double tolerance);
75                 public double get_tolerance ();
76                 
77                 public void clip ();
78                 public void clip_preserve ();
79                 public void reset_clip ();
81                 public void fill ();
82                 public void fill_preserve ();
83                 public void fill_extents (ref double x1, ref double y1, ref double x2, ref double y2);
84                 public bool in_fill (double x, double y);
86                 public void mask (Pattern pattern);
87                 public void mask_surface (Surface surface, double surface_x, double surface_y);
88                 
89                 public void paint ();
90                 public void paint_with_alpha (double alpha);
92                 public void stroke ();
93                 public void stroke_preserve ();
94                 public void stroke_extents (ref double x1, ref double y1, ref double x2, ref double y2);
95                 public bool in_stroke (double x, double y);
97                 public void copy_page ();
98                 public void show_page ();
99                 
100                 public Path copy_path ();
101                 public Path copy_path_flat ();
102                 
103                 public void append_path (Path path);
104                 
105                 public void get_current_point (ref double x, ref double y);
106                 
107                 public void new_path ();
108                 public void new_sub_path ();
109                 public void close_path ();
110                 
111                 public void arc (double xc, double yc, double radius, double angle1, double angle2);
112                 public void arc_negative (double xc, double yc, double radius, double angle1, double angle2);
114                 public void curve_to (double x1, double y1, double x2, double y2, double x3, double y3);
115                 public void line_to (double x, double y);
116                 public void move_to (double x, double y);
117                 
118                 public void rectangle (double x, double y, double width, double height);
119                 
120                 public void glyph_path (Glyph[] glyphs);
121                 public void text_path (string! utf8);
122                 
123                 public void rel_curve_to (double dx1, double dy1, double dx2, double dy2, double dx3, double dy3);
124                 public void rel_line_to (double dx, double dy);
125                 public void rel_move_to (double dx, double dy);
126                 
127                 public void translate (double tx, double ty);
128                 public void scale (double sx, double sy);
129                 public void rotate (double angle);
130                 public void transform (Matrix matrix);
131                 public void identity_matrix ();
132                 
133                 public void user_to_device (ref double x, ref double y);
134                 public void user_to_device_distance (ref double dx, ref double dy);
135                 public void device_to_user (ref double x, ref double y);
136                 public void device_to_user_distance (ref double dx, ref double dy);
137                 
138                 public void select_font_face (string! family, FontSlant slant, FontWeight weight);
139                 public void set_font_size (double size);
140                 public void set_font_matrix (Matrix matrix);
141                 public void get_font_matrix (out Matrix matrix);
142                 public void set_font_options (ref FontOptions! options);
143                 public void get_font_options (ref FontOptions options);
144                 
145                 public void show_text (string! utf8);
146                 public void show_glyphs (Glyph[] glyphs);
147                 
148                 public weak FontFace get_font_face ();
149                 public void font_extents (ref FontExtents extents);
150                 public void set_font_face (FontFace font_face);
151                 public void set_scaled_font (ScaledFont! font);
152                 public void text_extents (string! utf8, ref TextExtents extents);
153                 public void glyph_extents (Glyph[] glyphs, ref TextExtents extents);
154         }
155         
156         public enum Antialias {
157                 DEFAULT,
158                 NONE,
159                 GRAY,
160                 SUBPIXEL
161         }
162         
163         public enum FillRule {
164                 WINDING,
165                 EVEN_ODD
166         }
167         
168         public enum LineCap {
169                 BUTT,
170                 ROUND,
171                 SQUARE
172         }
173         
174         public enum LineJoin {
175                 MITER,
176                 ROUND,
177                 BEVEL
178         }
179         
180         public enum Operator {
181                 CLEAR,
182                 SOURCE,
183                 OVER,
184                 IN,
185                 OUT,
186                 ATOP,
187                 DEST,
188                 DEST_OVER,
189                 DEST_IN,
190                 DEST_OUT,
191                 DEST_ATOP,
192                 XOR,
193                 ADD,
194                 SATURATE
195         }
196         
197         [CCode (free_function = "cairo_path_destroy", cname = "cairo_path_t")]
198         public class Path {
199                 public Status status;
200                 [NoArrayLength ()]
201                 public PathData[] data;
202                 public int num_data;
203         }
204         
205         [CCode (cname = "cairo_path_data_t")]
206         public struct PathData {
207                 public PathDataHeader header;
208                 public PathDataPoint point;
209         }
210         
211         public struct PathDataHeader {
212                 public PathDataType type;
213                 public int length;
214         }
215         
216         public struct PathDataPoint {
217                 public double x;
218                 public double y;
219         }
220         
221         [CCode (cprefix = "CAIRO_PATH_")]
222         public enum PathDataType {
223                 MOVE_TO,
224                 LINE_TO,
225                 CURVE_TO,
226                 CLOSE_PATH
227         }
228         
229         [CCode (ref_function = "cairo_pattern_reference", unref_function = "cairo_pattern_destroy", cname = "cairo_pattern_t")]
230         public class Pattern {
231                 public void add_color_stop_rgb (double offset, double red, double green, double blue);
232                 public void add_color_stop_rgba (double offset, double red, double green, double blue, double alpha);
234                 [CCode (cname = "cairo_pattern_create_rgb")]
235                 public Pattern.rgb (double red, double green, double blue);
236                 [CCode (cname = "cairo_pattern_create_rgba")]
237                 public Pattern.rgba (double red, double green, double blue, double alpha);
238                 [CCode (cname = "cairo_pattern_create_for_surface")]
239                 public Pattern.for_surface (Surface! surface);
240                 [CCode (cname = "cairo_pattern_create_linear")]
241                 public Pattern.linear (double x0, double y0, double x1, double y1);
242                 [CCode (cname = "cairo_pattern_create_radial")]
243                 public Pattern.radial (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1);
244                 
245                 public Status status ();
246                 
247                 public void set_extend (Extend extend);
248                 public Extend get_extend ();
249                 
250                 public void set_filter (Filter filter);
251                 public Filter get_filter ();
252                 
253                 public void set_matrix (Matrix matrix);
254                 public void get_matrix (out Matrix matrix);
255                 
256                 public PatternType get_type ();
257         }
258         
259         [CCode (cname = "cairo_extend_t")]
260         public enum Extend {
261                 NONE,
262                 REPEAT,
263                 REFLECT,
264                 PAD
265         }
266         
267         [CCode (cname = "cairo_filter_t")]
268         public enum Filter {
269                 FAST,
270                 GOOD,
271                 BEST,
272                 NEAREST,
273                 BILINEAR,
274                 GAUSSIAN
275         }
276         
277         [CCode (cname = "cairo_pattern_type_t")]
278         public enum PatternType {
279                 SOLID,
280                 SURFACE,
281                 LINEAR,
282                 RADIAL
283         }
284         
285         [CCode (cname = "cairo_glyph_t")]
286         public class Glyph {
287         }
288         
289         [CCode (cname = "cairo_font_slant_t")]
290         public enum FontSlant {
291                 NORMAL,
292                 ITALIC,
293                 OBLIQUE
294         }
295         
296         [CCode (cname = "cairo_font_weight_t")]
297         public enum FontWeight {
298                 NORMAL,
299                 BOLD
300         }
301         
302         [CCode (ref_function = "cairo_font_face_reference", unref_function = "cairo_font_face_destroy", cname = "cairo_font_face_t")]
303         public class FontFace {
304                 public Status status ();
305                 public FontType get_type ();
306         }
307         
308         [CCode (cname = "cairo_font_type_t")]
309         public enum FontType {
310                 TOY,
311                 FT,
312                 WIN32,
313                 ATSUI
314         }
315         
316         [CCode (ref_function = "cairo_scaled_font_reference", unref_function = "cairo_scaled_font_destroy", cname = "cairo_scaled_font_t")]
317         public class ScaledFont {
318                 [CCode (cname = "cairo_scaled_font_create")]
319                 public ScaledFont (Matrix font_matrix, Matrix ctm, ref FontOptions options);
320                 public Status status ();
321                 public void extents (ref FontExtents extents);
322                 public void text_extents (string! utf8, ref TextExtents extents);
323                 public void glyph_extents (Glyph[] glyphs, ref TextExtents extents);
324                 public weak FontFace get_font_face ();
325                 public void get_font_options (ref FontOptions options);
326                 public void get_font_matrix (out Matrix font_matrix);
327                 public void get_ctm (out Matrix ctm);
328                 public FontType get_type ();
329         }
330         
331         [CCode (cname = "cairo_font_extents_t")]
332         public struct FontExtents {
333                 public double ascent;
334                 public double descent;
335                 public double height;
336                 public double max_x_advance;
337                 public double max_y_advance;
338         }
339         
340         [CCode (cname = "cairo_text_extents_t")]
341         public struct TextExtents {
342                 public double x_bearing;
343                 public double y_bearing;
344                 public double width;
345                 public double height;
346                 public double x_advance;
347                 public double y_advance;
348         }
349         
350         [CCode (copy_function = "cairo_font_options_copy", free_function = "cairo_font_options_destroy", cname = "cairo_font_options_t")]
351         public class FontOptions {
352                 [CCode (cname = "cairo_font_options_create")]
353                 public FontOptions ();
354                 public Status status ();
355                 public void merge (FontOptions other);
356                 public ulong hash ();
357                 public bool equal (FontOptions other);
358                 public void set_antialias (Antialias antialias);
359                 public Antialias get_antialias ();
360                 public void set_subpixel_order (SubpixelOrder subpixel_order);
361                 public SubpixelOrder get_subpixel_order ();
362                 public void set_hint_style (HintStyle hint_style);
363                 public HintStyle get_hint_style ();
364                 public void set_hint_metrics (HintMetrics hint_metrics);
365                 public HintMetrics get_hint_metrics ();
366         }
367         
368         [CCode (cname = "cairo_subpixel_order_t")]
369         public enum SubpixelOrder {
370                 DEFAULT,
371                 RGB,
372                 BGR,
373                 VRGB,
374                 VBGR
375         }
376         
377         [CCode (cname = "cairo_hint_style_t")]
378         public enum HintStyle {
379                 DEFAULT,
380                 NONE,
381                 SLIGHT,
382                 MEDIUM,
383                 FULL
384         }
385         
386         [CCode (cname = "cairo_hint_metrics_t")]
387         public enum HintMetrics {
388                 DEFAULT,
389                 OFF,
390                 ON
391         }
392         
393         [CCode (ref_function = "cairo_surface_reference", unref_function = "cairo_surface_destroy", cname = "cairo_surface_t", cheader_filename = "cairo.h")]
394         public class Surface {
395                 [CCode (cname = "cairo_surface_create_similar")]
396                 public Surface.similar (Surface! other, Content content, int width, int height);
397                 public void finish ();
398                 public void flush ();
399                 public void get_font_options (ref FontOptions options);
400                 public Content get_content ();
401                 public void mark_dirty ();
402                 public void mark_dirty_rectangle (int x, int y, int width, int height);
403                 public void set_device_offset (double x_offset, double y_offset);
404                 public void get_device_offset (ref double x_offset, ref double y_offset);
405                 public void set_fallback_resolution (double x_pixels_per_inch, double y_pixels_per_inch);
406                 public Status status ();
407                 public SurfaceType get_type ();
409                 public Status write_to_png (string! filename);
410                 public Status write_to_png_stream (WriteFunc write_func, pointer closure);
411         }
412         
413         public enum Content {
414                 COLOR,
415                 ALPHA,
416                 COLOR_ALPHA
417         }
418         
419         public enum SurfaceType {
420                 IMAGE,
421                 PDF,
422                 PS,
423                 XLIB,
424                 XCB,
425                 GLITZ,
426                 QUARTZ,
427                 WIN32,
428                 BEOS,
429                 DIRECTFB,
430                 SVG
431         }
432         
433         public enum Format {
434                 ARGB32,
435                 RGB24,
436                 A8,
437                 A1,
438                 RGB16_565
439         }
440         
441         [CCode (cname = "cairo_surface_t")]
442         public class ImageSurface : Surface {
443                 [CCode (cname = "cairo_image_surface_create")]
444                 public ImageSurface (Format format, int width, int height);
445                 [CCode (cname = "cairo_image_surface_create_for_data")]
446                 [NoArrayLength ()]
447                 public ImageSurface.for_data (uchar[] data, Format format, int width, int height, int stride);
448                 public uchar *get_data ();
449                 public Format get_format ();
450                 public int get_width ();
451                 public int get_height ();
452                 public int get_stride ();
454                 [CCode (cname = "cairo_image_surface_create_from_png")]
455                 public ImageSurface.from_png (string! filename);
456                 [CCode (cname = "cairo_image_surface_create_from_png_stream")]
457                 public ImageSurface.from_png_stream (ReadFunc read_func, pointer closure);
458         }
459         
460         [CCode (cname = "cairo_surface_t", cheader_filename = "cairo-pdf.h")]
461         public class PdfSurface : Surface {
462                 [CCode (cname = "cairo_pdf_surface_create")]
463                 public PdfSurface (string! filename, double width_in_points, double height_in_points);
464                 [CCode (cname = "cairo_pdf_surface_create_for_stream")]
465                 public PdfSurface.for_stream (WriteFunc write_func, pointer closure, double width_in_points, double height_in_points);
466                 public void set_size (double width_in_points, double height_in_points);
467         }
468         
469         public static delegate Status ReadFunc (pointer closure, uchar[] data);
470         public static delegate Status WriteFunc (pointer closure, uchar[] data);
471         
472         [CCode (cname = "cairo_surface_t", cheader_filename = "cairo-ps.h")]
473         public class PsSurface : Surface {
474                 [CCode (cname = "cairo_ps_surface_create")]
475                 public PsSurface (string! filename, double width_in_points, double height_in_points);
476                 [CCode (cname = "cairo_ps_surface_create_for_stream")]
477                 public PsSurface.for_stream (WriteFunc write_func, pointer closure, double width_in_points, double height_in_points);
478                 public void set_size (double width_in_points, double height_in_points);
479                 public void dsc_begin_setup ();
480                 public void dsc_begin_page_setup ();
481                 public void dsc_comment (string! comment);
482         }
483         
484         [CCode (cname = "cairo_surface_t", cheader_filename = "cairo-svg.h")]
485         public class SvgSurface : Surface {
486                 [CCode (cname = "cairo_svg_surface_create")]
487                 public SvgSurface (string! filename, double width_in_points, double height_in_points);
488                 [CCode (cname = "cairo_svg_surface_create_for_stream")]
489                 public SvgSurface.for_stream (WriteFunc write_func, pointer closure, double width_in_points, double height_in_points);
490                 public void restrict_to_version (SvgVersion version);
491                 public static void get_versions (out SvgVersion[] versions);
492         }
493         
494         [CCode (cname = "cairo_svg_version_t", cprefix = "CAIRO_SVG_")]
495         public enum SvgVersion {
496                 VERSION_1_1,
497                 VERSION_1_2
498         }
499         
500         [CCode (cname = "cairo_surface_t", cheader_filename = "cairo-xlib.h")]
501         public class XlibSurface : Surface {
502                 [CCode (cname = "cairo_xlib_surface_create")]
503                 public XlibSurface (pointer dpy, int drawable, pointer visual, int width, int height);
504                 [CCode (cname = "cairo_xlib_surface_create_for_bitmap")]
505                 public XlibSurface.for_bitmap (pointer dpy, int bitmap, pointer screen, int width, int height);
506                 public void set_size (int width, int height);
507                 public pointer get_display ();
508                 public pointer get_screen ();
509                 public void set_drawable (int drawable, int width, int height);
510                 public int get_drawable ();
511                 public pointer get_visual ();
512                 public int get_width ();
513                 public int get_height ();
514                 public int get_depth ();
515         }
516         
517         [CCode (cname = "cairo_matrix_t")]
518         public struct Matrix {
519                 [CCode (cname = "cairo_matrix_init")]
520                 public Matrix (double xx, double yx, double xy, double yy, double x0, double y0);
521                 [CCode (cname = "cairo_matrix_init_identity")]
522                 public Matrix.identity ();
523                 [CCode (cname = "cairo_matrix_init_translate")]
524                 public Matrix.translate (double tx, double ty);
525                 [CCode (cname = "cairo_matrix_init_scale")]
526                 public Matrix.scale (double sx, double sy);
527                 [CCode (cname = "cairo_matrix_init_rotate")]
528                 public Matrix.rotate (double radians);
530                 public void translate (double tx, double ty);
531                 public void scale (double sx, double sy);
532                 public void rotate (double radians);
533                 public Status invert ();
534                 public void multiply (Matrix a, Matrix b);
535                 public void transform_distance (ref double dx, ref double dy);
536                 public void transform_point (ref double x, ref double y);
537         }
538         
539         public enum Status {
540                 SUCCESS,
541                 NO_MEMORY,
542                 INVALID_RESTORE,
543                 INVALID_POP_GROUP,
544                 NO_CURRENT_POINT,
545                 INVALID_MATRIX,
546                 INVALID_STATUS,
547                 NULL_POINTER,
548                 INVALID_STRING,
549                 INVALID_PATH_DATA,
550                 READ_ERROR,
551                 WRITE_ERROR,
552                 SURFACE_FINISHED,
553                 SURFACE_TYPE_MISMATCH,
554                 PATTERN_TYPE_MISMATCH,
555                 INVALID_CONTENT,
556                 INVALID_FORMAT,
557                 INVALID_VISUAL,
558                 FILE_NOT_FOUND,
559                 INVALID_DASH,
560                 INVALID_DSC_COMMENT
561         }
562         
563         public int version ();
564         public weak string! version_string ();