1 /* turbulence/vapi/cairo-turbulence.vapi
3 * Copyright (C) 2006-2008 Jürg Billeter
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
20 * Jürg Billeter <j@bitron.ch>
22 * Turbulence modifications by Patrick Walton <pcwalton@uchicago.edu>
25 [CCode (cheader_filename = "cairo.h", lower_case_cprefix="cairo_")]
26 namespace CairoTurbulence {
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 ();
33 public void restore ();
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 ();
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 ();
54 public void set_dash (double[] dashes, double offset);
56 public void set_fill_rule (FillRule fill_rule);
57 public FillRule get_fill_rule ();
59 public void set_line_cap (LineCap line_cap);
60 public LineCap get_line_cap ();
62 public void set_line_join (LineJoin line_join);
63 public LineJoin get_line_join ();
65 public void set_line_width (double width);
66 public double get_line_width ();
68 public void set_miter_limit (double limit);
69 public double get_miter_limit ();
71 public void set_operator (Operator op);
72 public Operator get_operator ();
74 public void set_tolerance (double tolerance);
75 public double get_tolerance ();
78 public void clip_preserve ();
79 public void reset_clip ();
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);
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 ();
100 public Path copy_path ();
101 public Path copy_path_flat ();
103 public void append_path (Path path);
105 public void get_current_point (ref double x, ref double y);
107 public void new_path ();
108 public void new_sub_path ();
109 public void close_path ();
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);
118 public void rectangle (double x, double y, double width, double height);
120 public void glyph_path (Glyph[] glyphs);
121 public void text_path (string! utf8);
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);
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 ();
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);
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);
145 public void show_text (string! utf8);
146 public void show_glyphs (Glyph[] glyphs);
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);
156 public enum Antialias {
163 public enum FillRule {
168 public enum LineCap {
174 public enum LineJoin {
180 public enum Operator {
197 [CCode (free_function = "cairo_path_destroy", cname = "cairo_path_t")]
199 public Status status;
201 public PathData[] data;
205 [CCode (cname = "cairo_path_data_t")]
206 public struct PathData {
207 public PathDataHeader header;
208 public PathDataPoint point;
211 public struct PathDataHeader {
212 public PathDataType type;
216 public struct PathDataPoint {
221 [CCode (cprefix = "CAIRO_PATH_")]
222 public enum PathDataType {
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);
245 public Status status ();
247 public void set_extend (Extend extend);
248 public Extend get_extend ();
250 public void set_filter (Filter filter);
251 public Filter get_filter ();
253 public void set_matrix (Matrix matrix);
254 public void get_matrix (out Matrix matrix);
256 public PatternType get_type ();
259 [CCode (cname = "cairo_extend_t")]
267 [CCode (cname = "cairo_filter_t")]
277 [CCode (cname = "cairo_pattern_type_t")]
278 public enum PatternType {
285 [CCode (cname = "cairo_glyph_t")]
289 [CCode (cname = "cairo_font_slant_t")]
290 public enum FontSlant {
296 [CCode (cname = "cairo_font_weight_t")]
297 public enum FontWeight {
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 ();
308 [CCode (cname = "cairo_font_type_t")]
309 public enum FontType {
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 ();
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;
340 [CCode (cname = "cairo_text_extents_t")]
341 public struct TextExtents {
342 public double x_bearing;
343 public double y_bearing;
345 public double height;
346 public double x_advance;
347 public double y_advance;
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 ();
368 [CCode (cname = "cairo_subpixel_order_t")]
369 public enum SubpixelOrder {
377 [CCode (cname = "cairo_hint_style_t")]
378 public enum HintStyle {
386 [CCode (cname = "cairo_hint_metrics_t")]
387 public enum HintMetrics {
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);
413 public enum Content {
419 public enum SurfaceType {
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")]
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);
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);
469 public static delegate Status ReadFunc (pointer closure, uchar[] data);
470 public static delegate Status WriteFunc (pointer closure, uchar[] data);
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);
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);
494 [CCode (cname = "cairo_svg_version_t", cprefix = "CAIRO_SVG_")]
495 public enum SvgVersion {
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 ();
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);
553 SURFACE_TYPE_MISMATCH,
554 PATTERN_TYPE_MISMATCH,
563 public int version ();
564 public weak string! version_string ();