Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /* -*- Mode: c; tab-width: 8; c-basic-offset: 4; indent-tabs-mode: t; -*- */
  2. /* cairo - a vector graphics library with display and print output
  3.  *
  4.  * Copyright © 2011 Intel Corporation
  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., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, 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.  *      Chris Wilson <chris@chris-wilson.co.uk>
  36.  */
  37.  
  38. #ifndef CAIRO_COMPOSITOR_PRIVATE_H
  39. #define CAIRO_COMPOSITOR_PRIVATE_H
  40.  
  41. #include "cairo-composite-rectangles-private.h"
  42.  
  43. CAIRO_BEGIN_DECLS
  44.  
  45. typedef struct {
  46.     cairo_scaled_font_t *font;
  47.     cairo_glyph_t *glyphs;
  48.     int num_glyphs;
  49.     cairo_bool_t use_mask;
  50.     cairo_rectangle_int_t extents;
  51. } cairo_composite_glyphs_info_t;
  52.  
  53. struct cairo_compositor {
  54.     const cairo_compositor_t *delegate;
  55.  
  56.     cairo_warn cairo_int_status_t
  57.     (*paint)                    (const cairo_compositor_t       *compositor,
  58.                                  cairo_composite_rectangles_t   *extents);
  59.  
  60.     cairo_warn cairo_int_status_t
  61.     (*mask)                     (const cairo_compositor_t       *compositor,
  62.                                  cairo_composite_rectangles_t   *extents);
  63.  
  64.     cairo_warn cairo_int_status_t
  65.     (*stroke)                   (const cairo_compositor_t       *compositor,
  66.                                  cairo_composite_rectangles_t   *extents,
  67.                                  const cairo_path_fixed_t       *path,
  68.                                  const cairo_stroke_style_t     *style,
  69.                                  const cairo_matrix_t           *ctm,
  70.                                  const cairo_matrix_t           *ctm_inverse,
  71.                                  double                          tolerance,
  72.                                  cairo_antialias_t               antialias);
  73.  
  74.     cairo_warn cairo_int_status_t
  75.     (*fill)                     (const cairo_compositor_t       *compositor,
  76.                                  cairo_composite_rectangles_t   *extents,
  77.                                  const cairo_path_fixed_t       *path,
  78.                                  cairo_fill_rule_t               fill_rule,
  79.                                  double                          tolerance,
  80.                                  cairo_antialias_t               antialias);
  81.  
  82.     cairo_warn cairo_int_status_t
  83.     (*glyphs)                   (const cairo_compositor_t        *compositor,
  84.                                  cairo_composite_rectangles_t   *extents,
  85.                                  cairo_scaled_font_t            *scaled_font,
  86.                                  cairo_glyph_t                  *glyphs,
  87.                                  int                             num_glyphs,
  88.                                  cairo_bool_t                    overlap);
  89. };
  90.  
  91. struct cairo_mask_compositor {
  92.     cairo_compositor_t base;
  93.  
  94.     cairo_int_status_t (*acquire) (void *surface);
  95.     cairo_int_status_t (*release) (void *surface);
  96.  
  97.     cairo_int_status_t (*set_clip_region) (void          *surface,
  98.                                            cairo_region_t       *clip_region);
  99.  
  100.     cairo_surface_t * (*pattern_to_surface) (cairo_surface_t *dst,
  101.                                              const cairo_pattern_t *pattern,
  102.                                              cairo_bool_t is_mask,
  103.                                              const cairo_rectangle_int_t *extents,
  104.                                              const cairo_rectangle_int_t *sample,
  105.                                              int *src_x, int *src_y);
  106.  
  107.     cairo_int_status_t (*draw_image_boxes) (void *surface,
  108.                                             cairo_image_surface_t *image,
  109.                                             cairo_boxes_t *boxes,
  110.                                             int dx, int dy);
  111.  
  112.     cairo_int_status_t (*copy_boxes) (void *surface,
  113.                                       cairo_surface_t *src,
  114.                                       cairo_boxes_t *boxes,
  115.                                       const cairo_rectangle_int_t *extents,
  116.                                       int dx, int dy);
  117.  
  118.     cairo_int_status_t
  119.         (*fill_rectangles)      (void                    *surface,
  120.                                  cairo_operator_t         op,
  121.                                  const cairo_color_t     *color,
  122.                                  cairo_rectangle_int_t   *rectangles,
  123.                                  int                      num_rects);
  124.  
  125.     cairo_int_status_t
  126.         (*fill_boxes)           (void                   *surface,
  127.                                  cairo_operator_t        op,
  128.                                  const cairo_color_t    *color,
  129.                                  cairo_boxes_t          *boxes);
  130.  
  131.     cairo_int_status_t
  132.         (*check_composite) (const cairo_composite_rectangles_t *extents);
  133.  
  134.     cairo_int_status_t
  135.         (*composite)            (void                   *dst,
  136.                                  cairo_operator_t        op,
  137.                                  cairo_surface_t        *src,
  138.                                  cairo_surface_t        *mask,
  139.                                  int                     src_x,
  140.                                  int                     src_y,
  141.                                  int                     mask_x,
  142.                                  int                     mask_y,
  143.                                  int                     dst_x,
  144.                                  int                     dst_y,
  145.                                  unsigned int            width,
  146.                                  unsigned int            height);
  147.  
  148.     cairo_int_status_t
  149.         (*composite_boxes)      (void                   *surface,
  150.                                  cairo_operator_t        op,
  151.                                  cairo_surface_t        *source,
  152.                                  cairo_surface_t        *mask,
  153.                                  int                     src_x,
  154.                                  int                     src_y,
  155.                                  int                     mask_x,
  156.                                  int                     mask_y,
  157.                                  int                     dst_x,
  158.                                  int                     dst_y,
  159.                                  cairo_boxes_t          *boxes,
  160.                                  const cairo_rectangle_int_t  *extents);
  161.  
  162.     cairo_int_status_t
  163.         (*check_composite_glyphs) (const cairo_composite_rectangles_t *extents,
  164.                                    cairo_scaled_font_t *scaled_font,
  165.                                    cairo_glyph_t *glyphs,
  166.                                    int *num_glyphs);
  167.     cairo_int_status_t
  168.         (*composite_glyphs)     (void                           *surface,
  169.                                  cairo_operator_t                op,
  170.                                  cairo_surface_t                *src,
  171.                                  int                             src_x,
  172.                                  int                             src_y,
  173.                                  int                             dst_x,
  174.                                  int                             dst_y,
  175.                                  cairo_composite_glyphs_info_t  *info);
  176. };
  177.  
  178. struct cairo_traps_compositor {
  179.     cairo_compositor_t base;
  180.  
  181.     cairo_int_status_t
  182.         (*acquire) (void *surface);
  183.  
  184.     cairo_int_status_t
  185.         (*release) (void *surface);
  186.  
  187.     cairo_int_status_t
  188.         (*set_clip_region) (void                 *surface,
  189.                             cairo_region_t      *clip_region);
  190.  
  191.     cairo_surface_t *
  192.         (*pattern_to_surface) (cairo_surface_t *dst,
  193.                                const cairo_pattern_t *pattern,
  194.                                cairo_bool_t is_mask,
  195.                                const cairo_rectangle_int_t *extents,
  196.                                const cairo_rectangle_int_t *sample,
  197.                                int *src_x, int *src_y);
  198.  
  199.     cairo_int_status_t (*draw_image_boxes) (void *surface,
  200.                                             cairo_image_surface_t *image,
  201.                                             cairo_boxes_t *boxes,
  202.                                             int dx, int dy);
  203.  
  204.     cairo_int_status_t (*copy_boxes) (void *surface,
  205.                                       cairo_surface_t *src,
  206.                                       cairo_boxes_t *boxes,
  207.                                       const cairo_rectangle_int_t *extents,
  208.                                       int dx, int dy);
  209.  
  210.     cairo_int_status_t
  211.         (*fill_boxes)           (void                   *surface,
  212.                                  cairo_operator_t        op,
  213.                                  const cairo_color_t    *color,
  214.                                  cairo_boxes_t          *boxes);
  215.  
  216.     cairo_int_status_t
  217.         (*check_composite) (const cairo_composite_rectangles_t *extents);
  218.  
  219.     cairo_int_status_t
  220.         (*composite)            (void                   *dst,
  221.                                  cairo_operator_t        op,
  222.                                  cairo_surface_t        *src,
  223.                                  cairo_surface_t        *mask,
  224.                                  int                     src_x,
  225.                                  int                     src_y,
  226.                                  int                     mask_x,
  227.                                  int                     mask_y,
  228.                                  int                     dst_x,
  229.                                  int                     dst_y,
  230.                                  unsigned int            width,
  231.                                  unsigned int            height);
  232.     cairo_int_status_t
  233.             (*lerp)             (void                   *_dst,
  234.                                  cairo_surface_t        *abstract_src,
  235.                                  cairo_surface_t        *abstract_mask,
  236.                                  int                    src_x,
  237.                                  int                    src_y,
  238.                                  int                    mask_x,
  239.                                  int                    mask_y,
  240.                                  int                    dst_x,
  241.                                  int                    dst_y,
  242.                                  unsigned int           width,
  243.                                  unsigned int           height);
  244.  
  245.     cairo_int_status_t
  246.         (*composite_boxes)      (void                   *surface,
  247.                                  cairo_operator_t        op,
  248.                                  cairo_surface_t        *source,
  249.                                  cairo_surface_t        *mask,
  250.                                  int                     src_x,
  251.                                  int                     src_y,
  252.                                  int                     mask_x,
  253.                                  int                     mask_y,
  254.                                  int                     dst_x,
  255.                                  int                     dst_y,
  256.                                  cairo_boxes_t          *boxes,
  257.                                  const cairo_rectangle_int_t  *extents);
  258.  
  259.     cairo_int_status_t
  260.         (*composite_traps)      (void                   *dst,
  261.                                  cairo_operator_t        op,
  262.                                  cairo_surface_t        *source,
  263.                                  int                     src_x,
  264.                                  int                     src_y,
  265.                                  int                     dst_x,
  266.                                  int                     dst_y,
  267.                                  const cairo_rectangle_int_t *extents,
  268.                                  cairo_antialias_t       antialias,
  269.                                  cairo_traps_t          *traps);
  270.  
  271.     cairo_int_status_t
  272.         (*composite_tristrip)   (void                   *dst,
  273.                                  cairo_operator_t        op,
  274.                                  cairo_surface_t        *source,
  275.                                  int                     src_x,
  276.                                  int                     src_y,
  277.                                  int                     dst_x,
  278.                                  int                     dst_y,
  279.                                  const cairo_rectangle_int_t *extents,
  280.                                  cairo_antialias_t       antialias,
  281.                                  cairo_tristrip_t       *tristrip);
  282.  
  283.     cairo_int_status_t
  284.         (*check_composite_glyphs) (const cairo_composite_rectangles_t *extents,
  285.                                    cairo_scaled_font_t *scaled_font,
  286.                                    cairo_glyph_t *glyphs,
  287.                                    int *num_glyphs);
  288.     cairo_int_status_t
  289.         (*composite_glyphs)     (void                           *surface,
  290.                                  cairo_operator_t                op,
  291.                                  cairo_surface_t                *src,
  292.                                  int                             src_x,
  293.                                  int                             src_y,
  294.                                  int                             dst_x,
  295.                                  int                             dst_y,
  296.                                  cairo_composite_glyphs_info_t  *info);
  297. };
  298.  
  299. cairo_private extern const cairo_compositor_t __cairo_no_compositor;
  300. cairo_private extern const cairo_compositor_t _cairo_fallback_compositor;
  301.  
  302. cairo_private void
  303. _cairo_mask_compositor_init (cairo_mask_compositor_t *compositor,
  304.                              const cairo_compositor_t *delegate);
  305.  
  306. cairo_private void
  307. _cairo_shape_mask_compositor_init (cairo_compositor_t *compositor,
  308.                                    const cairo_compositor_t  *delegate);
  309.  
  310. cairo_private void
  311. _cairo_traps_compositor_init (cairo_traps_compositor_t *compositor,
  312.                               const cairo_compositor_t *delegate);
  313.  
  314. cairo_private cairo_int_status_t
  315. _cairo_compositor_paint (const cairo_compositor_t       *compositor,
  316.                          cairo_surface_t                *surface,
  317.                          cairo_operator_t                op,
  318.                          const cairo_pattern_t          *source,
  319.                          const cairo_clip_t             *clip);
  320.  
  321. cairo_private cairo_int_status_t
  322. _cairo_compositor_mask (const cairo_compositor_t        *compositor,
  323.                         cairo_surface_t                 *surface,
  324.                         cairo_operator_t                 op,
  325.                         const cairo_pattern_t           *source,
  326.                         const cairo_pattern_t           *mask,
  327.                         const cairo_clip_t              *clip);
  328.  
  329. cairo_private cairo_int_status_t
  330. _cairo_compositor_stroke (const cairo_compositor_t      *compositor,
  331.                           cairo_surface_t               *surface,
  332.                           cairo_operator_t               op,
  333.                           const cairo_pattern_t         *source,
  334.                           const cairo_path_fixed_t      *path,
  335.                           const cairo_stroke_style_t    *style,
  336.                           const cairo_matrix_t          *ctm,
  337.                           const cairo_matrix_t          *ctm_inverse,
  338.                           double                         tolerance,
  339.                           cairo_antialias_t              antialias,
  340.                           const cairo_clip_t            *clip);
  341.  
  342. cairo_private cairo_int_status_t
  343. _cairo_compositor_fill (const cairo_compositor_t        *compositor,
  344.                         cairo_surface_t                 *surface,
  345.                         cairo_operator_t                 op,
  346.                         const cairo_pattern_t           *source,
  347.                         const cairo_path_fixed_t        *path,
  348.                         cairo_fill_rule_t                fill_rule,
  349.                         double                           tolerance,
  350.                         cairo_antialias_t                antialias,
  351.                         const cairo_clip_t              *clip);
  352.  
  353. cairo_private cairo_int_status_t
  354. _cairo_compositor_glyphs (const cairo_compositor_t              *compositor,
  355.                           cairo_surface_t                       *surface,
  356.                           cairo_operator_t                       op,
  357.                           const cairo_pattern_t                 *source,
  358.                           cairo_glyph_t                         *glyphs,
  359.                           int                                    num_glyphs,
  360.                           cairo_scaled_font_t                   *scaled_font,
  361.                           const cairo_clip_t                    *clip);
  362.  
  363. CAIRO_END_DECLS
  364.  
  365. #endif /* CAIRO_COMPOSITOR_PRIVATE_H */
  366.