Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /* cairo - a vector graphics library with display and print output
  2.  *
  3.  * Copyright © 2005 Red Hat, Inc
  4.  *
  5.  * This library is free software; you can redistribute it and/or
  6.  * modify it either under the terms of the GNU Lesser General Public
  7.  * License version 2.1 as published by the Free Software Foundation
  8.  * (the "LGPL") or, at your option, under the terms of the Mozilla
  9.  * Public License Version 1.1 (the "MPL"). If you do not alter this
  10.  * notice, a recipient may use your version of this file under either
  11.  * the MPL or the LGPL.
  12.  *
  13.  * You should have received a copy of the LGPL along with this library
  14.  * in the file COPYING-LGPL-2.1; if not, write to the Free Software
  15.  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
  16.  * You should have received a copy of the MPL along with this library
  17.  * in the file COPYING-MPL-1.1
  18.  *
  19.  * The contents of this file are subject to the Mozilla Public License
  20.  * Version 1.1 (the "License"); you may not use this file except in
  21.  * compliance with the License. You may obtain a copy of the License at
  22.  * http://www.mozilla.org/MPL/
  23.  *
  24.  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
  25.  * OF ANY KIND, either express or implied. See the LGPL or the MPL for
  26.  * the specific language governing rights and limitations.
  27.  *
  28.  * The Original Code is the cairo graphics library.
  29.  *
  30.  * The Initial Developer of the Original Code is Red Hat, Inc.
  31.  *
  32.  * Contributor(s):
  33.  *      Kristian Høgsberg <krh@redhat.com>
  34.  *      Adrian Johnson <ajohnson@redneon.com>
  35.  */
  36.  
  37. #ifndef CAIRO_RECORDING_SURFACE_H
  38. #define CAIRO_RECORDING_SURFACE_H
  39.  
  40. #include "cairoint.h"
  41. #include "cairo-path-fixed-private.h"
  42. #include "cairo-clip-private.h"
  43.  
  44. typedef enum {
  45.     /* The 5 basic drawing operations. */
  46.     CAIRO_COMMAND_PAINT,
  47.     CAIRO_COMMAND_MASK,
  48.     CAIRO_COMMAND_STROKE,
  49.     CAIRO_COMMAND_FILL,
  50.     CAIRO_COMMAND_SHOW_TEXT_GLYPHS,
  51. } cairo_command_type_t;
  52.  
  53. typedef enum {
  54.     CAIRO_RECORDING_REGION_ALL,
  55.     CAIRO_RECORDING_REGION_NATIVE,
  56.     CAIRO_RECORDING_REGION_IMAGE_FALLBACK
  57. } cairo_recording_region_type_t;
  58.  
  59. typedef struct _cairo_command_header {
  60.     cairo_command_type_t         type;
  61.     cairo_recording_region_type_t     region;
  62.     cairo_operator_t             op;
  63.     cairo_clip_t                 clip;
  64. } cairo_command_header_t;
  65.  
  66. typedef struct _cairo_command_paint {
  67.     cairo_command_header_t       header;
  68.     cairo_pattern_union_t        source;
  69. } cairo_command_paint_t;
  70.  
  71. typedef struct _cairo_command_mask {
  72.     cairo_command_header_t       header;
  73.     cairo_pattern_union_t        source;
  74.     cairo_pattern_union_t        mask;
  75. } cairo_command_mask_t;
  76.  
  77. typedef struct _cairo_command_stroke {
  78.     cairo_command_header_t       header;
  79.     cairo_pattern_union_t        source;
  80.     cairo_path_fixed_t           path;
  81.     cairo_stroke_style_t         style;
  82.     cairo_matrix_t               ctm;
  83.     cairo_matrix_t               ctm_inverse;
  84.     double                       tolerance;
  85.     cairo_antialias_t            antialias;
  86. } cairo_command_stroke_t;
  87.  
  88. typedef struct _cairo_command_fill {
  89.     cairo_command_header_t       header;
  90.     cairo_pattern_union_t        source;
  91.     cairo_path_fixed_t           path;
  92.     cairo_fill_rule_t            fill_rule;
  93.     double                       tolerance;
  94.     cairo_antialias_t            antialias;
  95. } cairo_command_fill_t;
  96.  
  97. typedef struct _cairo_command_show_text_glyphs {
  98.     cairo_command_header_t       header;
  99.     cairo_pattern_union_t        source;
  100.     char                        *utf8;
  101.     int                          utf8_len;
  102.     cairo_glyph_t               *glyphs;
  103.     unsigned int                 num_glyphs;
  104.     cairo_text_cluster_t        *clusters;
  105.     int                          num_clusters;
  106.     cairo_text_cluster_flags_t   cluster_flags;
  107.     cairo_scaled_font_t         *scaled_font;
  108. } cairo_command_show_text_glyphs_t;
  109.  
  110. typedef union _cairo_command {
  111.     cairo_command_header_t      header;
  112.  
  113.     cairo_command_paint_t                       paint;
  114.     cairo_command_mask_t                        mask;
  115.     cairo_command_stroke_t                      stroke;
  116.     cairo_command_fill_t                        fill;
  117.     cairo_command_show_text_glyphs_t            show_text_glyphs;
  118. } cairo_command_t;
  119.  
  120. typedef struct _cairo_recording_surface {
  121.     cairo_surface_t base;
  122.  
  123.     cairo_content_t content;
  124.  
  125.     /* A recording-surface is logically unbounded, but when used as a
  126.      * source we need to render it to an image, so we need a size at
  127.      * which to create that image. */
  128.     cairo_rectangle_t extents_pixels;
  129.     cairo_rectangle_int_t extents;
  130.     cairo_bool_t unbounded;
  131.  
  132.     cairo_clip_t clip;
  133.  
  134.     cairo_array_t commands;
  135.  
  136.     int replay_start_idx;
  137. } cairo_recording_surface_t;
  138.  
  139. slim_hidden_proto (cairo_recording_surface_create);
  140.  
  141. cairo_private cairo_int_status_t
  142. _cairo_recording_surface_get_path (cairo_surface_t       *surface,
  143.                                    cairo_path_fixed_t *path);
  144.  
  145. cairo_private cairo_status_t
  146. _cairo_recording_surface_replay (cairo_surface_t *surface,
  147.                                  cairo_surface_t *target);
  148.  
  149.  
  150. cairo_private cairo_status_t
  151. _cairo_recording_surface_replay_analyze_recording_pattern (cairo_surface_t *surface,
  152.                                                            cairo_surface_t *target);
  153.  
  154. cairo_private cairo_status_t
  155. _cairo_recording_surface_replay_and_create_regions (cairo_surface_t *surface,
  156.                                                     cairo_surface_t *target);
  157. cairo_private cairo_status_t
  158. _cairo_recording_surface_replay_region (cairo_surface_t                 *surface,
  159.                                         const cairo_rectangle_int_t *surface_extents,
  160.                                         cairo_surface_t                 *target,
  161.                                         cairo_recording_region_type_t   region);
  162.  
  163. cairo_private cairo_status_t
  164. _cairo_recording_surface_get_bbox (cairo_recording_surface_t *recording,
  165.                                    cairo_box_t *bbox,
  166.                                    const cairo_matrix_t *transform);
  167.  
  168. cairo_private cairo_bool_t
  169. _cairo_surface_is_recording (const cairo_surface_t *surface);
  170.  
  171. #endif /* CAIRO_RECORDING_SURFACE_H */
  172.