Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /* cairo - a vector graphics library with display and print output
  2.  *
  3.  * Copyright © 2002 University of Southern California
  4.  * Copyright © 2005 Red Hat, Inc.
  5.  *
  6.  * This library is free software; you can redistribute it and/or
  7.  * modify it either under the terms of the GNU Lesser General Public
  8.  * License version 2.1 as published by the Free Software Foundation
  9.  * (the "LGPL") or, at your option, under the terms of the Mozilla
  10.  * Public License Version 1.1 (the "MPL"). If you do not alter this
  11.  * notice, a recipient may use your version of this file under either
  12.  * the MPL or the LGPL.
  13.  *
  14.  * You should have received a copy of the LGPL along with this library
  15.  * in the file COPYING-LGPL-2.1; if not, write to the Free Software
  16.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17.  * You should have received a copy of the MPL along with this library
  18.  * in the file COPYING-MPL-1.1
  19.  *
  20.  * The contents of this file are subject to the Mozilla Public License
  21.  * Version 1.1 (the "License"); you may not use this file except in
  22.  * compliance with the License. You may obtain a copy of the License at
  23.  * http://www.mozilla.org/MPL/
  24.  *
  25.  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
  26.  * OF ANY KIND, either express or implied. See the LGPL or the MPL for
  27.  * the specific language governing rights and limitations.
  28.  *
  29.  * The Original Code is the cairo graphics library.
  30.  *
  31.  * The Initial Developer of the Original Code is University of Southern
  32.  * California.
  33.  *
  34.  * Contributor(s):
  35.  *      Carl D. Worth <cworth@cworth.org>
  36.  */
  37.  
  38. #ifndef CAIRO_IMAGE_SURFACE_PRIVATE_H
  39. #define CAIRO_IMAGE_SURFACE_PRIVATE_H
  40.  
  41. #include "cairo-surface-private.h"
  42.  
  43. #include <pixman.h>
  44.  
  45. CAIRO_BEGIN_DECLS
  46.  
  47. /* The canonical image backend */
  48. struct _cairo_image_surface {
  49.     cairo_surface_t base;
  50.  
  51.     pixman_image_t *pixman_image;
  52.     const cairo_compositor_t *compositor;
  53.  
  54.     /* Parenting is tricky wrt lifetime tracking...
  55.      *
  56.      * One use for tracking the parent of an image surface is for
  57.      * create_similar_image() where we wish to create a device specific
  58.      * surface but return an image surface to the user. In such a case,
  59.      * the image may be owned by the device specific surface, its parent,
  60.      * but the user lifetime tracking is then performed on the image. So
  61.      * when the image is then finalized we call cairo_surface_destroy()
  62.      * on the parent. However, for normal usage where the lifetime tracking
  63.      * is done on the parent surface, we need to be careful to unhook
  64.      * the image->parent pointer before finalizing the image.
  65.      */
  66.     cairo_surface_t *parent;
  67.  
  68.     pixman_format_code_t pixman_format;
  69.     cairo_format_t format;
  70.     unsigned char *data;
  71.  
  72.     int width;
  73.     int height;
  74.     int stride;
  75.     int depth;
  76.  
  77.     unsigned owns_data : 1;
  78.     unsigned transparency : 2;
  79.     unsigned color : 2;
  80. };
  81. #define to_image_surface(S) ((cairo_image_surface_t *)(S))
  82.  
  83. /* A wrapper for holding pixman images returned by create_for_pattern */
  84. typedef struct _cairo_image_source {
  85.     cairo_surface_t base;
  86.  
  87.     pixman_image_t *pixman_image;
  88.     unsigned is_opaque_solid : 1;
  89. } cairo_image_source_t;
  90.  
  91. cairo_private extern const cairo_surface_backend_t _cairo_image_surface_backend;
  92. cairo_private extern const cairo_surface_backend_t _cairo_image_source_backend;
  93.  
  94. cairo_private const cairo_compositor_t *
  95. _cairo_image_mask_compositor_get (void);
  96.  
  97. cairo_private const cairo_compositor_t *
  98. _cairo_image_traps_compositor_get (void);
  99.  
  100. cairo_private const cairo_compositor_t *
  101. _cairo_image_spans_compositor_get (void);
  102.  
  103. #define _cairo_image_default_compositor_get _cairo_image_spans_compositor_get
  104.  
  105. cairo_private cairo_int_status_t
  106. _cairo_image_surface_paint (void                        *abstract_surface,
  107.                             cairo_operator_t             op,
  108.                             const cairo_pattern_t       *source,
  109.                             const cairo_clip_t          *clip);
  110.  
  111. cairo_private cairo_int_status_t
  112. _cairo_image_surface_mask (void                         *abstract_surface,
  113.                            cairo_operator_t              op,
  114.                            const cairo_pattern_t        *source,
  115.                            const cairo_pattern_t        *mask,
  116.                            const cairo_clip_t           *clip);
  117.  
  118. cairo_private cairo_int_status_t
  119. _cairo_image_surface_stroke (void                       *abstract_surface,
  120.                              cairo_operator_t            op,
  121.                              const cairo_pattern_t      *source,
  122.                              const cairo_path_fixed_t   *path,
  123.                              const cairo_stroke_style_t *style,
  124.                              const cairo_matrix_t       *ctm,
  125.                              const cairo_matrix_t       *ctm_inverse,
  126.                              double                      tolerance,
  127.                              cairo_antialias_t           antialias,
  128.                              const cairo_clip_t         *clip);
  129.  
  130. cairo_private cairo_int_status_t
  131. _cairo_image_surface_fill (void                         *abstract_surface,
  132.                            cairo_operator_t              op,
  133.                            const cairo_pattern_t        *source,
  134.                            const cairo_path_fixed_t     *path,
  135.                            cairo_fill_rule_t             fill_rule,
  136.                            double                        tolerance,
  137.                            cairo_antialias_t             antialias,
  138.                            const cairo_clip_t           *clip);
  139.  
  140. cairo_private cairo_int_status_t
  141. _cairo_image_surface_glyphs (void                       *abstract_surface,
  142.                              cairo_operator_t            op,
  143.                              const cairo_pattern_t      *source,
  144.                              cairo_glyph_t              *glyphs,
  145.                              int                         num_glyphs,
  146.                              cairo_scaled_font_t        *scaled_font,
  147.                              const cairo_clip_t         *clip);
  148.  
  149. cairo_private void
  150. _cairo_image_surface_init (cairo_image_surface_t *surface,
  151.                            pixman_image_t       *pixman_image,
  152.                            pixman_format_code_t  pixman_format);
  153.  
  154. cairo_private cairo_surface_t *
  155. _cairo_image_surface_create_similar (void              *abstract_other,
  156.                                      cairo_content_t    content,
  157.                                      int                width,
  158.                                      int                height);
  159.  
  160. cairo_private cairo_image_surface_t *
  161. _cairo_image_surface_map_to_image (void *abstract_other,
  162.                                    const cairo_rectangle_int_t *extents);
  163.  
  164. cairo_private cairo_int_status_t
  165. _cairo_image_surface_unmap_image (void *abstract_surface,
  166.                                   cairo_image_surface_t *image);
  167.  
  168. cairo_private cairo_surface_t *
  169. _cairo_image_surface_source (void                       *abstract_surface,
  170.                              cairo_rectangle_int_t      *extents);
  171.  
  172. cairo_private cairo_status_t
  173. _cairo_image_surface_acquire_source_image (void                    *abstract_surface,
  174.                                            cairo_image_surface_t  **image_out,
  175.                                            void                   **image_extra);
  176.  
  177. cairo_private void
  178. _cairo_image_surface_release_source_image (void                   *abstract_surface,
  179.                                            cairo_image_surface_t  *image,
  180.                                            void                   *image_extra);
  181.  
  182. cairo_private cairo_surface_t *
  183. _cairo_image_surface_snapshot (void *abstract_surface);
  184.  
  185. cairo_private_no_warn cairo_bool_t
  186. _cairo_image_surface_get_extents (void                    *abstract_surface,
  187.                                   cairo_rectangle_int_t   *rectangle);
  188.  
  189. cairo_private void
  190. _cairo_image_surface_get_font_options (void                  *abstract_surface,
  191.                                        cairo_font_options_t  *options);
  192.  
  193. cairo_private cairo_surface_t *
  194. _cairo_image_source_create_for_pattern (cairo_surface_t *dst,
  195.                                         const cairo_pattern_t *pattern,
  196.                                         cairo_bool_t is_mask,
  197.                                         const cairo_rectangle_int_t *extents,
  198.                                         const cairo_rectangle_int_t *sample,
  199.                                         int *src_x, int *src_y);
  200.  
  201. cairo_private cairo_status_t
  202. _cairo_image_surface_finish (void *abstract_surface);
  203.  
  204. cairo_private pixman_image_t *
  205. _pixman_image_for_color (const cairo_color_t *cairo_color);
  206.  
  207. cairo_private pixman_image_t *
  208. _pixman_image_for_pattern (cairo_image_surface_t *dst,
  209.                            const cairo_pattern_t *pattern,
  210.                            cairo_bool_t is_mask,
  211.                            const cairo_rectangle_int_t *extents,
  212.                            const cairo_rectangle_int_t *sample,
  213.                            int *tx, int *ty);
  214.  
  215. cairo_private void
  216. _pixman_image_add_traps (pixman_image_t *image,
  217.                          int dst_x, int dst_y,
  218.                          cairo_traps_t *traps);
  219.  
  220. cairo_private void
  221. _pixman_image_add_tristrip (pixman_image_t *image,
  222.                             int dst_x, int dst_y,
  223.                             cairo_tristrip_t *strip);
  224.  
  225. cairo_private cairo_image_surface_t *
  226. _cairo_image_surface_clone_subimage (cairo_surface_t             *surface,
  227.                                      const cairo_rectangle_int_t *extents);
  228.  
  229. /* Similar to clone; but allow format conversion */
  230. cairo_private cairo_image_surface_t *
  231. _cairo_image_surface_create_from_image (cairo_image_surface_t *other,
  232.                                         pixman_format_code_t format,
  233.                                         int x, int y, int width, int height,
  234.                                         int stride);
  235.  
  236. CAIRO_END_DECLS
  237.  
  238. #endif /* CAIRO_IMAGE_SURFACE_PRIVATE_H */
  239.