Home | History | Annotate | Download | only in vega
      1 /**************************************************************************
      2  *
      3  * Copyright 2009 VMware, Inc.  All Rights Reserved.
      4  *
      5  * Permission is hereby granted, free of charge, to any person obtaining a
      6  * copy of this software and associated documentation files (the
      7  * "Software"), to deal in the Software without restriction, including
      8  * without limitation the rights to use, copy, modify, merge, publish,
      9  * distribute, sub license, and/or sell copies of the Software, and to
     10  * permit persons to whom the Software is furnished to do so, subject to
     11  * the following conditions:
     12  *
     13  * The above copyright notice and this permission notice (including the
     14  * next paragraph) shall be included in all copies or substantial portions
     15  * of the Software.
     16  *
     17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
     18  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
     20  * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
     21  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
     22  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
     23  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     24  *
     25  **************************************************************************/
     26 
     27 #ifndef VG_STATE_H
     28 #define VG_STATE_H
     29 
     30 #include "VG/openvg.h"
     31 
     32 #include "api_consts.h"
     33 #include "matrix.h"
     34 
     35 struct vg_value
     36 {
     37    VGfloat f;
     38    VGint   i;
     39 };
     40 
     41 struct vg_state {
     42    /* Mode settings */
     43    VGMatrixMode matrix_mode;
     44    VGFillRule fill_rule;
     45    VGImageQuality image_quality;
     46    VGRenderingQuality rendering_quality;
     47    VGBlendMode blend_mode;
     48    VGImageMode image_mode;
     49 
     50    /* Scissoring rectangles */
     51    struct vg_value  scissor_rects[32*4];
     52    VGint  scissor_rects_num;
     53 
     54    /* Color Transformation */
     55    VGboolean color_transform;
     56    VGfloat color_transform_values[8];
     57 
     58    /* Stroke parameters */
     59    struct {
     60       struct vg_value line_width;
     61       VGCapStyle cap_style;
     62       VGJoinStyle join_style;
     63       struct vg_value miter_limit;
     64       struct vg_value dash_pattern[VEGA_MAX_DASH_COUNT];
     65       VGint   dash_pattern_num;
     66       struct vg_value dash_phase;
     67       VGboolean dash_phase_reset;
     68    } stroke;
     69 
     70    /* Edge fill color for VG_TILE_FILL tiling mode */
     71    VGfloat tile_fill_color[4];
     72    VGint tile_fill_colori[4];
     73 
     74    /* Color for vgClear */
     75    VGfloat clear_color[4];
     76    VGint clear_colori[4];
     77 
     78    /* Glyph origin */
     79    struct vg_value glyph_origin[2];
     80 
     81    /* Enable/disable alpha masking and scissoring */
     82    VGboolean masking;
     83    VGboolean scissoring;
     84 
     85    /* Pixel layout information */
     86    VGPixelLayout pixel_layout;
     87    VGPixelLayout screen_layout;
     88 
     89    /* Source format selection for image filters */
     90    VGboolean filter_format_linear;
     91    VGboolean filter_format_premultiplied;
     92 
     93    /* Destination write enable mask for image filters */
     94    VGbitfield filter_channel_mask;
     95 
     96    struct matrix path_user_to_surface_matrix;
     97    struct matrix image_user_to_surface_matrix;
     98    struct matrix fill_paint_to_user_matrix;
     99    struct matrix stroke_paint_to_user_matrix;
    100    struct matrix glyph_user_to_surface_matrix;
    101 
    102    struct vg_paint *stroke_paint;
    103    struct vg_paint *fill_paint;
    104 };
    105 
    106 void vg_init_state(struct vg_state *state);
    107 struct matrix * vg_state_matrix(struct vg_state *state);
    108 
    109 #endif
    110