Back to index

lightning-sunbird  0.9+nobinonly
cairo.h
Go to the documentation of this file.
00001 /* cairo - a vector graphics library with display and print output
00002  *
00003  * Copyright © 2002 University of Southern California
00004  * Copyright © 2005 Red Hat, Inc.
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it either under the terms of the GNU Lesser General Public
00008  * License version 2.1 as published by the Free Software Foundation
00009  * (the "LGPL") or, at your option, under the terms of the Mozilla
00010  * Public License Version 1.1 (the "MPL"). If you do not alter this
00011  * notice, a recipient may use your version of this file under either
00012  * the MPL or the LGPL.
00013  *
00014  * You should have received a copy of the LGPL along with this library
00015  * in the file COPYING-LGPL-2.1; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00017  * You should have received a copy of the MPL along with this library
00018  * in the file COPYING-MPL-1.1
00019  *
00020  * The contents of this file are subject to the Mozilla Public License
00021  * Version 1.1 (the "License"); you may not use this file except in
00022  * compliance with the License. You may obtain a copy of the License at
00023  * http://www.mozilla.org/MPL/
00024  *
00025  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
00026  * OF ANY KIND, either express or implied. See the LGPL or the MPL for
00027  * the specific language governing rights and limitations.
00028  *
00029  * The Original Code is the cairo graphics library.
00030  *
00031  * The Initial Developer of the Original Code is University of Southern
00032  * California.
00033  *
00034  * Contributor(s):
00035  *     Carl D. Worth <cworth@cworth.org>
00036  */
00037 
00038 #ifndef CAIRO_H
00039 #define CAIRO_H
00040 
00041 #include <cairo-features.h>
00042 
00043 CAIRO_BEGIN_DECLS
00044 
00045 #define CAIRO_VERSION_ENCODE(major, minor, micro) (     \
00046          ((major) * 10000)                             \
00047        + ((minor) *   100)                             \
00048        + ((micro) *     1))
00049 
00050 #define CAIRO_VERSION CAIRO_VERSION_ENCODE(     \
00051        CAIRO_VERSION_MAJOR,                    \
00052        CAIRO_VERSION_MINOR,                    \
00053        CAIRO_VERSION_MICRO)
00054 
00055 int
00056 cairo_version (void);
00057 
00058 const char*
00059 cairo_version_string (void);
00060 
00075 typedef int cairo_bool_t;
00076 
00083 typedef struct _cairo cairo_t;
00084 
00097 typedef struct _cairo_surface cairo_surface_t;
00098 
00116 typedef struct _cairo_matrix {
00117     double xx; double yx;
00118     double xy; double yy;
00119     double x0; double y0;
00120 } cairo_matrix_t;
00121 
00122 typedef struct _cairo_pattern cairo_pattern_t;
00123 
00132 typedef void (*cairo_destroy_func_t) (void *data);
00133 
00144 typedef struct _cairo_user_data_key {
00145     int unused;
00146 } cairo_user_data_key_t;
00147 
00176 typedef enum _cairo_status {
00177     CAIRO_STATUS_SUCCESS = 0,
00178     CAIRO_STATUS_NO_MEMORY,
00179     CAIRO_STATUS_INVALID_RESTORE,
00180     CAIRO_STATUS_INVALID_POP_GROUP,
00181     CAIRO_STATUS_NO_CURRENT_POINT,
00182     CAIRO_STATUS_INVALID_MATRIX,
00183     CAIRO_STATUS_INVALID_STATUS,
00184     CAIRO_STATUS_NULL_POINTER,
00185     CAIRO_STATUS_INVALID_STRING,
00186     CAIRO_STATUS_INVALID_PATH_DATA,
00187     CAIRO_STATUS_READ_ERROR,
00188     CAIRO_STATUS_WRITE_ERROR,
00189     CAIRO_STATUS_SURFACE_FINISHED,
00190     CAIRO_STATUS_SURFACE_TYPE_MISMATCH,
00191     CAIRO_STATUS_PATTERN_TYPE_MISMATCH,
00192     CAIRO_STATUS_INVALID_CONTENT,
00193     CAIRO_STATUS_INVALID_FORMAT,
00194     CAIRO_STATUS_INVALID_VISUAL,
00195     CAIRO_STATUS_FILE_NOT_FOUND,
00196     CAIRO_STATUS_INVALID_DASH
00197 } cairo_status_t;
00198 
00215 typedef cairo_status_t (*cairo_write_func_t) (void               *closure,
00216                                          const unsigned char *data,
00217                                          unsigned int      length);
00218 
00235 typedef cairo_status_t (*cairo_read_func_t) (void              *closure,
00236                                         unsigned char   *data,
00237                                         unsigned int    length);
00238 
00239 /* Functions for manipulating state objects */
00240 cairo_t *
00241 cairo_create (cairo_surface_t *target);
00242 
00243 cairo_t *
00244 cairo_reference (cairo_t *cr);
00245 
00246 void
00247 cairo_destroy (cairo_t *cr);
00248 
00249 void
00250 cairo_save (cairo_t *cr);
00251 
00252 void
00253 cairo_restore (cairo_t *cr);
00254 
00255 /* XXX: I want to rethink this API
00256 void
00257 cairo_push_group (cairo_t *cr);
00258 
00259 void
00260 cairo_pop_group (cairo_t *cr);
00261 */
00262 
00263 /* Modify state */
00264 
00265 typedef enum _cairo_operator {
00266     CAIRO_OPERATOR_CLEAR,
00267 
00268     CAIRO_OPERATOR_SOURCE,
00269     CAIRO_OPERATOR_OVER,
00270     CAIRO_OPERATOR_IN,
00271     CAIRO_OPERATOR_OUT,
00272     CAIRO_OPERATOR_ATOP,
00273 
00274     CAIRO_OPERATOR_DEST,
00275     CAIRO_OPERATOR_DEST_OVER,
00276     CAIRO_OPERATOR_DEST_IN,
00277     CAIRO_OPERATOR_DEST_OUT,
00278     CAIRO_OPERATOR_DEST_ATOP,
00279 
00280     CAIRO_OPERATOR_XOR,
00281     CAIRO_OPERATOR_ADD,
00282     CAIRO_OPERATOR_SATURATE
00283 } cairo_operator_t;
00284 
00285 void
00286 cairo_set_operator (cairo_t *cr, cairo_operator_t op);
00287 
00288 void
00289 cairo_set_source (cairo_t *cr, cairo_pattern_t *source);
00290 
00291 void
00292 cairo_set_source_rgb (cairo_t *cr, double red, double green, double blue);
00293 
00294 void
00295 cairo_set_source_rgba (cairo_t *cr,
00296                      double red, double green, double blue,
00297                      double alpha);
00298 
00299 void
00300 cairo_set_source_surface (cairo_t    *cr,
00301                        cairo_surface_t *surface,
00302                        double         x,
00303                        double         y);
00304 
00305 void
00306 cairo_set_tolerance (cairo_t *cr, double tolerance);
00307 
00321 typedef enum _cairo_antialias {
00322     CAIRO_ANTIALIAS_DEFAULT,
00323     CAIRO_ANTIALIAS_NONE,
00324     CAIRO_ANTIALIAS_GRAY,
00325     CAIRO_ANTIALIAS_SUBPIXEL
00326 } cairo_antialias_t;
00327 
00328 void
00329 cairo_set_antialias (cairo_t *cr, cairo_antialias_t antialias);
00330 
00352 typedef enum _cairo_fill_rule {
00353     CAIRO_FILL_RULE_WINDING,
00354     CAIRO_FILL_RULE_EVEN_ODD
00355 } cairo_fill_rule_t;
00356 
00357 void
00358 cairo_set_fill_rule (cairo_t *cr, cairo_fill_rule_t fill_rule);
00359 
00360 void
00361 cairo_set_line_width (cairo_t *cr, double width);
00362 
00363 
00372 typedef enum _cairo_line_cap {
00373     CAIRO_LINE_CAP_BUTT,
00374     CAIRO_LINE_CAP_ROUND,
00375     CAIRO_LINE_CAP_SQUARE
00376 } cairo_line_cap_t;
00377 
00378 void
00379 cairo_set_line_cap (cairo_t *cr, cairo_line_cap_t line_cap);
00380 
00381 typedef enum _cairo_line_join {
00382     CAIRO_LINE_JOIN_MITER,
00383     CAIRO_LINE_JOIN_ROUND,
00384     CAIRO_LINE_JOIN_BEVEL
00385 } cairo_line_join_t;
00386 
00387 void
00388 cairo_set_line_join (cairo_t *cr, cairo_line_join_t line_join);
00389 
00390 void
00391 cairo_set_dash (cairo_t     *cr,
00392               double *dashes,
00393               int     num_dashes,
00394               double  offset);
00395 
00396 void
00397 cairo_set_miter_limit (cairo_t *cr, double limit);
00398 
00399 void
00400 cairo_translate (cairo_t *cr, double tx, double ty);
00401 
00402 void
00403 cairo_scale (cairo_t *cr, double sx, double sy);
00404 
00405 void
00406 cairo_rotate (cairo_t *cr, double angle);
00407 
00408 void
00409 cairo_transform (cairo_t          *cr,
00410                const cairo_matrix_t *matrix);
00411 
00412 void
00413 cairo_set_matrix (cairo_t          *cr,
00414                 const cairo_matrix_t *matrix);
00415 
00416 void
00417 cairo_identity_matrix (cairo_t *cr);
00418 
00419 void
00420 cairo_user_to_device (cairo_t *cr, double *x, double *y);
00421 
00422 void
00423 cairo_user_to_device_distance (cairo_t *cr, double *dx, double *dy);
00424 
00425 void
00426 cairo_device_to_user (cairo_t *cr, double *x, double *y);
00427 
00428 void
00429 cairo_device_to_user_distance (cairo_t *cr, double *dx, double *dy);
00430 
00431 /* Path creation functions */
00432 void
00433 cairo_new_path (cairo_t *cr);
00434 
00435 void
00436 cairo_move_to (cairo_t *cr, double x, double y);
00437 
00438 void
00439 cairo_line_to (cairo_t *cr, double x, double y);
00440 
00441 void
00442 cairo_curve_to (cairo_t *cr,
00443               double x1, double y1,
00444               double x2, double y2,
00445               double x3, double y3);
00446 
00447 void
00448 cairo_arc (cairo_t *cr,
00449           double xc, double yc,
00450           double radius,
00451           double angle1, double angle2);
00452 
00453 void
00454 cairo_arc_negative (cairo_t *cr,
00455                   double xc, double yc,
00456                   double radius,
00457                   double angle1, double angle2);
00458 
00459 /* XXX: NYI
00460 void
00461 cairo_arc_to (cairo_t *cr,
00462              double x1, double y1,
00463              double x2, double y2,
00464              double radius);
00465 */
00466 
00467 void
00468 cairo_rel_move_to (cairo_t *cr, double dx, double dy);
00469 
00470 void
00471 cairo_rel_line_to (cairo_t *cr, double dx, double dy);
00472 
00473 void
00474 cairo_rel_curve_to (cairo_t *cr,
00475                   double dx1, double dy1,
00476                   double dx2, double dy2,
00477                   double dx3, double dy3);
00478 
00479 void
00480 cairo_rectangle (cairo_t *cr,
00481                double x, double y,
00482                double width, double height);
00483 
00484 /* XXX: NYI
00485 void
00486 cairo_stroke_to_path (cairo_t *cr);
00487 */
00488 
00489 void
00490 cairo_close_path (cairo_t *cr);
00491 
00492 /* Painting functions */
00493 void
00494 cairo_paint (cairo_t *cr);
00495 
00496 void
00497 cairo_paint_with_alpha (cairo_t *cr,
00498                      double   alpha);
00499 
00500 void
00501 cairo_mask (cairo_t         *cr,
00502            cairo_pattern_t *pattern);
00503 
00504 void
00505 cairo_mask_surface (cairo_t         *cr,
00506                   cairo_surface_t *surface,
00507                   double           surface_x,
00508                   double           surface_y);
00509 
00510 void
00511 cairo_stroke (cairo_t *cr);
00512 
00513 void
00514 cairo_stroke_preserve (cairo_t *cr);
00515 
00516 void
00517 cairo_fill (cairo_t *cr);
00518 
00519 void
00520 cairo_fill_preserve (cairo_t *cr);
00521 
00522 void
00523 cairo_copy_page (cairo_t *cr);
00524 
00525 void
00526 cairo_show_page (cairo_t *cr);
00527 
00528 /* Insideness testing */
00529 cairo_bool_t
00530 cairo_in_stroke (cairo_t *cr, double x, double y);
00531 
00532 cairo_bool_t
00533 cairo_in_fill (cairo_t *cr, double x, double y);
00534 
00535 /* Rectangular extents */
00536 void
00537 cairo_stroke_extents (cairo_t *cr,
00538                     double *x1, double *y1,
00539                     double *x2, double *y2);
00540 
00541 void
00542 cairo_fill_extents (cairo_t *cr,
00543                   double *x1, double *y1,
00544                   double *x2, double *y2);
00545 
00546 /* Clipping */
00547 void
00548 cairo_reset_clip (cairo_t *cr);
00549 
00550 void
00551 cairo_clip (cairo_t *cr);
00552 
00553 void
00554 cairo_clip_preserve (cairo_t *cr);
00555 
00556 /* Font/Text functions */
00557 
00566 typedef struct _cairo_scaled_font cairo_scaled_font_t;
00567 
00578 typedef struct _cairo_font_face cairo_font_face_t;
00579 
00604 typedef struct {
00605   unsigned long        index;
00606   double               x;
00607   double               y;
00608 } cairo_glyph_t;
00609 
00637 typedef struct {
00638     double x_bearing;
00639     double y_bearing;
00640     double width;
00641     double height;
00642     double x_advance;
00643     double y_advance;
00644 } cairo_text_extents_t;
00645 
00687 typedef struct {
00688     double ascent;
00689     double descent;
00690     double height;
00691     double max_x_advance;
00692     double max_y_advance;
00693 } cairo_font_extents_t;
00694 
00695 typedef enum _cairo_font_slant {
00696   CAIRO_FONT_SLANT_NORMAL,
00697   CAIRO_FONT_SLANT_ITALIC,
00698   CAIRO_FONT_SLANT_OBLIQUE
00699 } cairo_font_slant_t;
00700   
00701 typedef enum _cairo_font_weight {
00702   CAIRO_FONT_WEIGHT_NORMAL,
00703   CAIRO_FONT_WEIGHT_BOLD
00704 } cairo_font_weight_t;
00705 
00723 typedef enum _cairo_subpixel_order {
00724     CAIRO_SUBPIXEL_ORDER_DEFAULT,
00725     CAIRO_SUBPIXEL_ORDER_RGB,
00726     CAIRO_SUBPIXEL_ORDER_BGR,
00727     CAIRO_SUBPIXEL_ORDER_VRGB,
00728     CAIRO_SUBPIXEL_ORDER_VBGR
00729 } cairo_subpixel_order_t;
00730 
00751 typedef enum _cairo_hint_style {
00752     CAIRO_HINT_STYLE_DEFAULT,
00753     CAIRO_HINT_STYLE_NONE,
00754     CAIRO_HINT_STYLE_SLIGHT,
00755     CAIRO_HINT_STYLE_MEDIUM,
00756     CAIRO_HINT_STYLE_FULL
00757 } cairo_hint_style_t;
00758 
00772 typedef enum _cairo_hint_metrics {
00773     CAIRO_HINT_METRICS_DEFAULT,
00774     CAIRO_HINT_METRICS_OFF,
00775     CAIRO_HINT_METRICS_ON
00776 } cairo_hint_metrics_t;
00777 
00778 typedef struct _cairo_font_options cairo_font_options_t;
00779 
00780 cairo_font_options_t *
00781 cairo_font_options_create (void);
00782 
00783 cairo_font_options_t *
00784 cairo_font_options_copy (const cairo_font_options_t *original);
00785 
00786 void 
00787 cairo_font_options_destroy (cairo_font_options_t *options);
00788 
00789 cairo_status_t
00790 cairo_font_options_status (cairo_font_options_t *options);
00791 
00792 void
00793 cairo_font_options_merge (cairo_font_options_t       *options,
00794                        const cairo_font_options_t *other);
00795 cairo_bool_t
00796 cairo_font_options_equal (const cairo_font_options_t *options,
00797                        const cairo_font_options_t *other);
00798 
00799 unsigned long
00800 cairo_font_options_hash (const cairo_font_options_t *options);
00801 
00802 void
00803 cairo_font_options_set_antialias (cairo_font_options_t *options,
00804                               cairo_antialias_t     antialias);
00805 cairo_antialias_t
00806 cairo_font_options_get_antialias (const cairo_font_options_t *options);
00807 
00808 void
00809 cairo_font_options_set_subpixel_order (cairo_font_options_t   *options,
00810                                    cairo_subpixel_order_t  subpixel_order);
00811 cairo_subpixel_order_t
00812 cairo_font_options_get_subpixel_order (const cairo_font_options_t *options);
00813                       
00814 void
00815 cairo_font_options_set_hint_style (cairo_font_options_t *options,
00816                                cairo_hint_style_t     hint_style);
00817 cairo_hint_style_t
00818 cairo_font_options_get_hint_style (const cairo_font_options_t *options);
00819 
00820 void
00821 cairo_font_options_set_hint_metrics (cairo_font_options_t *options,
00822                                  cairo_hint_metrics_t  hint_metrics);
00823 cairo_hint_metrics_t
00824 cairo_font_options_get_hint_metrics (const cairo_font_options_t *options);
00825 
00826 
00827 /* This interface is for dealing with text as text, not caring about the
00828    font object inside the the cairo_t. */
00829 
00830 void
00831 cairo_select_font_face (cairo_t              *cr, 
00832                      const char           *family, 
00833                      cairo_font_slant_t   slant, 
00834                      cairo_font_weight_t  weight);
00835 
00836 void
00837 cairo_set_font_size (cairo_t *cr, double size);
00838 
00839 void
00840 cairo_set_font_matrix (cairo_t                *cr,
00841                      const cairo_matrix_t *matrix);
00842 
00843 void
00844 cairo_get_font_matrix (cairo_t *cr,
00845                      cairo_matrix_t *matrix);
00846 
00847 void
00848 cairo_set_font_options (cairo_t                    *cr,
00849                      const cairo_font_options_t *options);
00850 
00851 void
00852 cairo_get_font_options (cairo_t              *cr,
00853                      cairo_font_options_t *options);
00854 
00855 void
00856 cairo_show_text (cairo_t *cr, const char *utf8);
00857 
00858 void
00859 cairo_show_glyphs (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs);
00860 
00861 cairo_font_face_t *
00862 cairo_get_font_face (cairo_t *cr);
00863 
00864 void
00865 cairo_font_extents (cairo_t              *cr, 
00866                   cairo_font_extents_t *extents);
00867 
00868 void
00869 cairo_set_font_face (cairo_t *cr, cairo_font_face_t *font_face);
00870 
00871 void
00872 cairo_text_extents (cairo_t              *cr,
00873                   const char        *utf8,
00874                   cairo_text_extents_t *extents);
00875 
00876 void
00877 cairo_glyph_extents (cairo_t               *cr,
00878                    cairo_glyph_t         *glyphs, 
00879                    int                   num_glyphs,
00880                    cairo_text_extents_t  *extents);
00881 
00882 void
00883 cairo_text_path  (cairo_t *cr, const char *utf8);
00884 
00885 void
00886 cairo_glyph_path (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs);
00887 
00888 /* Generic identifier for a font style */
00889 
00890 cairo_font_face_t *
00891 cairo_font_face_reference (cairo_font_face_t *font_face);
00892 
00893 void
00894 cairo_font_face_destroy (cairo_font_face_t *font_face);
00895 
00896 cairo_status_t
00897 cairo_font_face_status (cairo_font_face_t *font_face);
00898 
00899 void *
00900 cairo_font_face_get_user_data (cairo_font_face_t    *font_face,
00901                             const cairo_user_data_key_t *key);
00902 
00903 cairo_status_t
00904 cairo_font_face_set_user_data (cairo_font_face_t    *font_face,
00905                             const cairo_user_data_key_t *key,
00906                             void                    *user_data,
00907                             cairo_destroy_func_t     destroy);
00908 
00909 /* Portable interface to general font features. */
00910 
00911 cairo_scaled_font_t *
00912 cairo_scaled_font_create (cairo_font_face_t          *font_face,
00913                        const cairo_matrix_t       *font_matrix,
00914                        const cairo_matrix_t       *ctm,
00915                        const cairo_font_options_t *options);
00916 
00917 cairo_scaled_font_t *
00918 cairo_scaled_font_reference (cairo_scaled_font_t *scaled_font);
00919 
00920 void
00921 cairo_scaled_font_destroy (cairo_scaled_font_t *scaled_font);
00922 
00923 cairo_status_t
00924 cairo_scaled_font_status (cairo_scaled_font_t *scaled_font);
00925 
00926 void
00927 cairo_scaled_font_extents (cairo_scaled_font_t  *scaled_font,
00928                         cairo_font_extents_t *extents);
00929 
00930 void
00931 cairo_scaled_font_glyph_extents (cairo_scaled_font_t   *scaled_font,
00932                              cairo_glyph_t         *glyphs, 
00933                              int                   num_glyphs,
00934                              cairo_text_extents_t  *extents);
00935 
00936 /* Query functions */
00937 
00938 cairo_operator_t
00939 cairo_get_operator (cairo_t *cr);
00940 
00941 cairo_pattern_t *
00942 cairo_get_source (cairo_t *cr);
00943 
00944 double
00945 cairo_get_tolerance (cairo_t *cr);
00946 
00947 cairo_antialias_t
00948 cairo_get_antialias (cairo_t *cr);
00949 
00950 void
00951 cairo_get_current_point (cairo_t *cr, double *x, double *y);
00952 
00953 cairo_fill_rule_t
00954 cairo_get_fill_rule (cairo_t *cr);
00955 
00956 double
00957 cairo_get_line_width (cairo_t *cr);
00958 
00959 cairo_line_cap_t
00960 cairo_get_line_cap (cairo_t *cr);
00961 
00962 cairo_line_join_t
00963 cairo_get_line_join (cairo_t *cr);
00964 
00965 double
00966 cairo_get_miter_limit (cairo_t *cr);
00967 
00968 /* XXX: How to do cairo_get_dash??? Do we want to switch to a cairo_dash object? */
00969 
00970 void
00971 cairo_get_matrix (cairo_t *cr, cairo_matrix_t *matrix);
00972 
00973 cairo_surface_t *
00974 cairo_get_target (cairo_t *cr);
00975 
00976 typedef enum _cairo_path_data_type {
00977     CAIRO_PATH_MOVE_TO,
00978     CAIRO_PATH_LINE_TO,
00979     CAIRO_PATH_CURVE_TO,
00980     CAIRO_PATH_CLOSE_PATH
00981 } cairo_path_data_type_t;
00982 
01042 typedef union _cairo_path_data_t cairo_path_data_t;
01043 union _cairo_path_data_t {
01044     struct {
01045        cairo_path_data_type_t type;
01046        int length;
01047     } header;
01048     struct {
01049        double x, y;
01050     } point;
01051 };
01052 
01072 typedef struct cairo_path {
01073     cairo_status_t status;
01074     cairo_path_data_t *data;
01075     int num_data;
01076 } cairo_path_t;
01077 
01078 cairo_path_t *
01079 cairo_copy_path (cairo_t *cr);
01080 
01081 cairo_path_t *
01082 cairo_copy_path_flat (cairo_t *cr);
01083 
01084 void
01085 cairo_append_path (cairo_t  *cr,
01086                  cairo_path_t *path);
01087 
01088 void
01089 cairo_path_destroy (cairo_path_t *path);
01090 
01091 /* Error status queries */
01092 
01093 cairo_status_t
01094 cairo_status (cairo_t *cr);
01095 
01096 const char *
01097 cairo_status_to_string (cairo_status_t status);
01098 
01099 /* Surface manipulation */
01100 
01115 typedef enum _cairo_content {
01116     CAIRO_CONTENT_COLOR            = 0x1000,
01117     CAIRO_CONTENT_ALPHA            = 0x2000,
01118     CAIRO_CONTENT_COLOR_ALPHA      = 0x3000
01119 } cairo_content_t;
01120 
01121 cairo_surface_t *
01122 cairo_surface_create_similar (cairo_surface_t  *other,
01123                            cairo_content_t       content,
01124                            int            width,
01125                            int            height);
01126 
01127 cairo_surface_t *
01128 cairo_surface_reference (cairo_surface_t *surface);
01129 
01130 void
01131 cairo_surface_destroy (cairo_surface_t *surface);
01132 
01133 cairo_status_t
01134 cairo_surface_status (cairo_surface_t *surface);
01135 
01136 void
01137 cairo_surface_finish (cairo_surface_t *surface);
01138 
01139 #if CAIRO_HAS_PNG_FUNCTIONS
01140 
01141 cairo_status_t
01142 cairo_surface_write_to_png (cairo_surface_t      *surface,
01143                          const char              *filename);
01144 
01145 cairo_status_t
01146 cairo_surface_write_to_png_stream (cairo_surface_t      *surface,
01147                                cairo_write_func_t       write_func,
01148                                void                     *closure);
01149 
01150 #endif
01151 
01152 void *
01153 cairo_surface_get_user_data (cairo_surface_t             *surface,
01154                           const cairo_user_data_key_t *key);
01155 
01156 cairo_status_t
01157 cairo_surface_set_user_data (cairo_surface_t             *surface,
01158                           const cairo_user_data_key_t *key,
01159                           void                    *user_data,
01160                           cairo_destroy_func_t    destroy);
01161 
01162 void
01163 cairo_surface_get_font_options (cairo_surface_t      *surface,
01164                             cairo_font_options_t *options);
01165 
01166 void
01167 cairo_surface_flush (cairo_surface_t *surface);
01168 
01169 void
01170 cairo_surface_mark_dirty (cairo_surface_t *surface);
01171 
01172 void
01173 cairo_surface_mark_dirty_rectangle (cairo_surface_t *surface,
01174                                 int              x,
01175                                 int              y,
01176                                 int              width,
01177                                 int              height);
01178 
01179 void
01180 cairo_surface_set_device_offset (cairo_surface_t *surface,
01181                              double           x_offset,
01182                              double           y_offset);
01183 
01184 /* Image-surface functions */
01185 
01208 typedef enum _cairo_format {
01209     CAIRO_FORMAT_ARGB32,
01210     CAIRO_FORMAT_RGB24,
01211     CAIRO_FORMAT_A8,
01212     CAIRO_FORMAT_A1
01213 } cairo_format_t;
01214 
01215 cairo_surface_t *
01216 cairo_image_surface_create (cairo_format_t       format,
01217                          int                     width,
01218                          int                     height);
01219 
01220 cairo_surface_t *
01221 cairo_image_surface_create_for_data (unsigned char             *data,
01222                                  cairo_format_t         format,
01223                                  int                    width,
01224                                  int                    height,
01225                                  int                    stride);
01226 
01227 int
01228 cairo_image_surface_get_width (cairo_surface_t *surface);
01229 
01230 int
01231 cairo_image_surface_get_height (cairo_surface_t *surface);
01232 
01233 #if CAIRO_HAS_PNG_FUNCTIONS
01234 
01235 cairo_surface_t *
01236 cairo_image_surface_create_from_png (const char  *filename);
01237 
01238 cairo_surface_t *
01239 cairo_image_surface_create_from_png_stream (cairo_read_func_t  read_func,
01240                                        void             *closure);
01241 
01242 #endif
01243 
01244 /* Pattern creation functions */
01245 
01246 cairo_pattern_t *
01247 cairo_pattern_create_rgb (double red, double green, double blue);
01248 
01249 cairo_pattern_t *
01250 cairo_pattern_create_rgba (double red, double green, double blue,
01251                         double alpha);
01252 
01253 cairo_pattern_t *
01254 cairo_pattern_create_for_surface (cairo_surface_t *surface);
01255 
01256 cairo_pattern_t *
01257 cairo_pattern_create_linear (double x0, double y0,
01258                           double x1, double y1);
01259 
01260 cairo_pattern_t *
01261 cairo_pattern_create_radial (double cx0, double cy0, double radius0,
01262                           double cx1, double cy1, double radius1);
01263 
01264 cairo_pattern_t *
01265 cairo_pattern_reference (cairo_pattern_t *pattern);
01266 
01267 void
01268 cairo_pattern_destroy (cairo_pattern_t *pattern);
01269   
01270 cairo_status_t
01271 cairo_pattern_status (cairo_pattern_t *pattern);
01272 
01273 void
01274 cairo_pattern_add_color_stop_rgb (cairo_pattern_t *pattern,
01275                               double offset,
01276                               double red, double green, double blue);
01277 
01278 void
01279 cairo_pattern_add_color_stop_rgba (cairo_pattern_t *pattern,
01280                                double offset,
01281                                double red, double green, double blue,
01282                                double alpha);
01283 
01284 void
01285 cairo_pattern_set_matrix (cairo_pattern_t      *pattern,
01286                        const cairo_matrix_t *matrix);
01287 
01288 void
01289 cairo_pattern_get_matrix (cairo_pattern_t *pattern,
01290                        cairo_matrix_t  *matrix);
01291 
01292 typedef enum _cairo_extend {
01293     CAIRO_EXTEND_NONE,
01294     CAIRO_EXTEND_REPEAT,
01295     CAIRO_EXTEND_REFLECT
01296 } cairo_extend_t;
01297 
01298 void
01299 cairo_pattern_set_extend (cairo_pattern_t *pattern, cairo_extend_t extend);
01300 
01301 cairo_extend_t
01302 cairo_pattern_get_extend (cairo_pattern_t *pattern);
01303 
01304 typedef enum _cairo_filter {
01305     CAIRO_FILTER_FAST,
01306     CAIRO_FILTER_GOOD,
01307     CAIRO_FILTER_BEST,
01308     CAIRO_FILTER_NEAREST,
01309     CAIRO_FILTER_BILINEAR,
01310     CAIRO_FILTER_GAUSSIAN
01311 } cairo_filter_t;
01312   
01313 void
01314 cairo_pattern_set_filter (cairo_pattern_t *pattern, cairo_filter_t filter);
01315 
01316 cairo_filter_t
01317 cairo_pattern_get_filter (cairo_pattern_t *pattern);
01318 
01319 /* Matrix functions */
01320 
01321 void
01322 cairo_matrix_init (cairo_matrix_t *matrix,
01323                  double  xx, double  yx,
01324                  double  xy, double  yy,
01325                  double  x0, double  y0);
01326 
01327 void
01328 cairo_matrix_init_identity (cairo_matrix_t *matrix);
01329 
01330 void
01331 cairo_matrix_init_translate (cairo_matrix_t *matrix,
01332                           double tx, double ty);
01333 
01334 void
01335 cairo_matrix_init_scale (cairo_matrix_t *matrix,
01336                       double sx, double sy);
01337 
01338 void
01339 cairo_matrix_init_rotate (cairo_matrix_t *matrix,
01340                        double radians);
01341 
01342 void
01343 cairo_matrix_translate (cairo_matrix_t *matrix, double tx, double ty);
01344 
01345 void
01346 cairo_matrix_scale (cairo_matrix_t *matrix, double sx, double sy);
01347 
01348 void
01349 cairo_matrix_rotate (cairo_matrix_t *matrix, double radians);
01350 
01351 cairo_status_t
01352 cairo_matrix_invert (cairo_matrix_t *matrix);
01353 
01354 void
01355 cairo_matrix_multiply (cairo_matrix_t         *result,
01356                      const cairo_matrix_t *a,
01357                      const cairo_matrix_t *b);
01358 
01359 /* XXX: Need a new name here perhaps. */
01360 void
01361 cairo_matrix_transform_distance (const cairo_matrix_t *matrix,
01362                              double *dx, double *dy);
01363 
01364 /* XXX: Need a new name here perhaps. */
01365 void
01366 cairo_matrix_transform_point (const cairo_matrix_t *matrix,
01367                            double *x, double *y);
01368 
01369 #ifndef _CAIROINT_H_
01370 
01371 /* Obsolete functions. These definitions exist to coerce the compiler
01372  * into providing a little bit of guidance with its error
01373  * messages. The idea is to help users port their old code without
01374  * having to dig through lots of documentation.
01375  *
01376  * The first set of REPLACED_BY functions is for functions whose names
01377  * have just been changed. So fixing these up is mechanical, (and
01378  * automated by means of the cairo/util/cairo-api-update script.
01379  *
01380  * The second set of DEPRECATED_BY functions is for functions where
01381  * the replacement is used in a different way, (ie. different
01382  * arguments, multiple functions instead of one, etc). Fixing these up
01383  * will require a bit more work on the user's part, (and hopefully we
01384  * can get cairo-api-update to find these and print some guiding
01385  * information).
01386  */
01387 #define cairo_current_font_extents   cairo_current_font_extents_REPLACED_BY_cairo_font_extents
01388 #define cairo_get_font_extents       cairo_get_font_extents_REPLACED_BY_cairo_font_extents
01389 #define cairo_current_operator       cairo_current_operator_REPLACED_BY_cairo_get_operator
01390 #define cairo_current_tolerance         cairo_current_tolerance_REPLACED_BY_cairo_get_tolerance
01391 #define cairo_current_point      cairo_current_point_REPLACED_BY_cairo_get_current_point
01392 #define cairo_current_fill_rule         cairo_current_fill_rule_REPLACED_BY_cairo_get_fill_rule
01393 #define cairo_current_line_width     cairo_current_line_width_REPLACED_BY_cairo_get_line_width
01394 #define cairo_current_line_cap       cairo_current_line_cap_REPLACED_BY_cairo_get_line_cap
01395 #define cairo_current_line_join      cairo_current_line_join_REPLACED_BY_cairo_get_line_join
01396 #define cairo_current_miter_limit    cairo_current_miter_limit_REPLACED_BY_cairo_get_miter_limit
01397 #define cairo_current_matrix         cairo_current_matrix_REPLACED_BY_cairo_get_matrix
01398 #define cairo_current_target_surface cairo_current_target_surface_REPLACED_BY_cairo_get_target
01399 #define cairo_get_status             cairo_get_status_REPLACED_BY_cairo_status
01400 #define cairo_concat_matrix         cairo_concat_matrix_REPLACED_BY_cairo_transform
01401 #define cairo_scale_font                 cairo_scale_font_REPLACED_BY_cairo_set_font_size
01402 #define cairo_select_font                cairo_select_font_REPLACED_BY_cairo_select_font_face
01403 #define cairo_transform_font             cairo_transform_font_REPLACED_BY_cairo_set_font_matrix
01404 #define cairo_transform_point              cairo_transform_point_REPLACED_BY_cairo_user_to_device
01405 #define cairo_transform_distance    cairo_transform_distance_REPLACED_BY_cairo_user_to_device_distance
01406 #define cairo_inverse_transform_point      cairo_inverse_transform_point_REPLACED_BY_cairo_device_to_user
01407 #define cairo_inverse_transform_distance cairo_inverse_transform_distance_REPLACED_BY_cairo_device_to_user_distance
01408 #define cairo_init_clip                    cairo_init_clip_REPLACED_BY_cairo_reset_clip
01409 #define cairo_surface_create_for_image     cairo_surface_create_for_image_REPLACED_BY_cairo_image_surface_create_for_data
01410 #define cairo_default_matrix               cairo_default_matrix_REPLACED_BY_cairo_identity_matrix
01411 #define cairo_matrix_set_affine            cairo_matrix_set_affine_REPLACED_BY_cairo_matrix_init
01412 #define cairo_matrix_set_identity   cairo_matrix_set_identity_REPLACED_BY_cairo_matrix_init_identity
01413 #define cairo_pattern_add_color_stop       cairo_pattern_add_color_stop_REPLACED_BY_cairo_pattern_add_color_stop_rgba
01414 #define cairo_set_rgb_color         cairo_set_rgb_color_REPLACED_BY_cairo_set_source_rgb
01415 #define cairo_set_pattern           cairo_set_pattern_REPLACED_BY_cairo_set_source
01416 #define cairo_xlib_surface_create_for_pixmap_with_visual       cairo_xlib_surface_create_for_pixmap_with_visual_REPLACED_BY_cairo_xlib_surface_create
01417 #define cairo_xlib_surface_create_for_window_with_visual       cairo_xlib_surface_create_for_window_with_visual_REPLACED_BY_cairo_xlib_surface_create
01418 #define cairo_xcb_surface_create_for_pixmap_with_visual cairo_xcb_surface_create_for_pixmap_with_visual_REPLACED_BY_cairo_xcb_surface_create
01419 #define cairo_xcb_surface_create_for_window_with_visual cairo_xcb_surface_create_for_window_with_visual_REPLACED_BY_cairo_xcb_surface_create
01420 
01421 
01422 #define cairo_current_path       cairo_current_path_DEPRECATED_BY_cairo_copy_path
01423 #define cairo_current_path_flat         cairo_current_path_flat_DEPRECATED_BY_cairo_copy_path_flat
01424 #define cairo_get_path                  cairo_get_path_DEPRECATED_BY_cairo_copy_path
01425 #define cairo_get_path_flat      cairo_get_path_flat_DEPRECATED_BY_cairo_get_path_flat
01426 #define cairo_set_alpha                 cairo_set_alpha_DEPRECATED_BY_cairo_set_source_rgba_OR_cairo_paint_with_alpha
01427 #define cairo_show_surface       cairo_show_surface_DEPRECATED_BY_cairo_set_source_surface_AND_cairo_paint
01428 #define cairo_copy               cairo_copy_DEPRECATED_BY_cairo_create_AND_MANY_INDIVIDUAL_FUNCTIONS
01429 #define cairo_surface_set_repeat   cairo_surface_set_repeat_DEPRECATED_BY_cairo_pattern_set_extend
01430 #define cairo_surface_set_matrix   cairo_surface_set_matrix_DEPRECATED_BY_cairo_pattern_set_matrix
01431 #define cairo_surface_get_matrix   cairo_surface_get_matrix_DEPRECATED_BY_cairo_pattern_get_matrix
01432 #define cairo_surface_set_filter   cairo_surface_set_filter_DEPRECATED_BY_cairo_pattern_set_filter
01433 #define cairo_surface_get_filter   cairo_surface_get_filter_DEPRECATED_BY_cairo_pattern_get_filter
01434 #define cairo_matrix_create        cairo_matrix_create_DEPRECATED_BY_cairo_matrix_t
01435 #define cairo_matrix_destroy              cairo_matrix_destroy_DEPRECATED_BY_cairo_matrix_t
01436 #define cairo_matrix_copy          cairo_matrix_copy_DEPRECATED_BY_cairo_matrix_t
01437 #define cairo_matrix_get_affine           cairo_matrix_get_affine_DEPRECATED_BY_cairo_matrix_t
01438 #define cairo_set_target_surface   cairo_set_target_surface_DEPRECATED_BY_cairo_create
01439 #define cairo_set_target_glitz            cairo_set_target_glitz_DEPRECATED_BY_cairo_glitz_surface_create
01440 #define cairo_set_target_image            cairo_set_target_image_DEPRECATED_BY_cairo_image_surface_create_for_data
01441 #define cairo_set_target_pdf              cairo_set_target_pdf_DEPRECATED_BY_cairo_pdf_surface_create
01442 #define cairo_set_target_png              cairo_set_target_png_DEPRECATED_BY_cairo_surface_write_to_png
01443 #define cairo_set_target_ps        cairo_set_target_ps_DEPRECATED_BY_cairo_ps_surface_create
01444 #define cairo_set_target_quartz           cairo_set_target_quartz_DEPRECATED_BY_cairo_quartz_surface_create
01445 #define cairo_set_target_win32            cairo_set_target_win32_DEPRECATED_BY_cairo_win32_surface_create
01446 #define cairo_set_target_xcb              cairo_set_target_xcb_DEPRECATED_BY_cairo_xcb_surface_create
01447 #define cairo_set_target_drawable  cairo_set_target_drawable_DEPRECATED_BY_cairo_xlib_surface_create
01448 #define cairo_get_status_string           cairo_get_status_string_DEPRECATED_BY_cairo_status_AND_cairo_status_to_string
01449 #define cairo_status_string        cairo_status_string_DEPRECATED_BY_cairo_status_AND_cairo_status_to_string
01450 
01451 #endif
01452 
01453 CAIRO_END_DECLS
01454 
01455 #endif /* CAIRO_H */