FastUIDraw
Classes | Public Member Functions | Static Public Member Functions | List of all members
fastuidraw::Painter Class Reference

Painter implements a canvas rendering interface. More...

#include <painter.hpp>

Inheritance diagram for fastuidraw::Painter:
Inheritance graph
[legend]

Classes

class  GlyphRendererChooser
 A GlyphRendererChooser provides an interface for choosing how to render glyphs depending on the current transformation matrix, Painter::transformation(). More...
 
class  NormalizedCoordRect
 A NormalizedCoordRect is used to specify a rectangle in -normalized- device coordinates. Recall that normalized device coordinates hae that the bottom-left is (-1, 1) and the top right is (+1, +1) ALWAYS. More...
 

Public Member Functions

 Painter (const reference_counted_ptr< PainterEngine > &backend)
 
void begin (const reference_counted_ptr< PainterSurface > &surface, const float3x3 &initial_transformation, bool clear_color_buffer=true)
 
void begin (const reference_counted_ptr< PainterSurface > &surface, enum screen_orientation orientation, bool clear_color_buffer=true)
 
void begin_coverage_buffer (void)
 
void begin_coverage_buffer (const Rect &logical_rect, float additional_pixel_slack=0.0f, float additional_item_slack=0.0f)
 
void begin_coverage_buffer (const NormalizedCoordRect &normalized_rect, float additional_pixel_slack=0.0f)
 
void begin_layer (const reference_counted_ptr< const PainterEffect > &effect, PainterEffectParams &effect_params)
 
void begin_layer (const vec4 &color_modulate)
 
void begin_layer (float alpha)
 
BlendMode blend_mode (void) const
 
PainterBlendShaderblend_shader (void) const
 
void blend_shader (const reference_counted_ptr< PainterBlendShader > &h, BlendMode blend_mode)
 
void blend_shader (const PainterBlendShaderSet &shader_set, enum blend_mode_t m)
 
void blend_shader (enum blend_mode_t m)
 
c_array< const vec3clip_equations (void)
 
void clip_in_path (const Path &path, enum fill_rule_t fill_rule)
 
void clip_in_path (const FilledPath &path, enum fill_rule_t fill_rule)
 
void clip_in_path (const Path &path, const CustomFillRuleBase &fill_rule)
 
void clip_in_path (const FilledPath &path, const CustomFillRuleBase &fill_rule)
 
void clip_in_rect (const Rect &rect)
 
void clip_in_rounded_rect (const RoundedRect &R)
 
void clip_out_convex_polygon (c_array< const vec2 > poly)
 
void clip_out_custom (PainterItemShader *shader, const PainterDataValue< PainterItemShaderData > &shader_data, c_array< const c_array< const PainterAttribute > > attrib_chunks, c_array< const c_array< const PainterIndex > > index_chunks, c_array< const int > index_adjusts, c_array< const unsigned int > attrib_chunk_selector)
 
void clip_out_custom (PainterItemShader *shader, const PainterDataValue< PainterItemShaderData > &shader_data, c_array< const c_array< const PainterAttribute > > attrib_chunks, c_array< const c_array< const PainterIndex > > index_chunks, c_array< const int > index_adjusts)
 
void clip_out_custom (PainterItemShader *shader, const PainterDataValue< PainterItemShaderData > &shader_data, c_array< const PainterAttribute > attrib_chunk, c_array< const PainterIndex > index_chunk, int index_adjust=0)
 
void clip_out_path (const Path &path, enum fill_rule_t fill_rule)
 
void clip_out_path (const FilledPath &path, enum fill_rule_t fill_rule)
 
void clip_out_path (const Path &path, const CustomFillRuleBase &fill_rule)
 
void clip_out_path (const FilledPath &path, const CustomFillRuleBase &fill_rule)
 
void clip_out_rect (const Rect &rect)
 
void clip_out_rounded_rect (const RoundedRect &R)
 
c_array< const vec3clip_polygon (void)
 
bool clip_region_bounds (vec2 *min_pt, vec2 *max_pt)
 
bool clip_region_logical_bounds (vec2 *min_pt, vec2 *max_pt)
 
ColorStopAtlascolorstop_atlas (void) const
 
GlyphRenderer compute_glyph_renderer (float pixel_size)
 
GlyphRenderer compute_glyph_renderer (float pixel_size, const GlyphRendererChooser &chooser)
 
float compute_path_thresh (const Path &path)
 
float compute_path_thresh (const Path &path, const c_array< const uvec4 > shader_data, const reference_counted_ptr< const StrokingDataSelectorBase > &selector, float *out_rounded_thresh)
 
void concat (const float3x3 &tr)
 
void curve_flatness (float thresh)
 
float curve_flatness (void)
 
const GlyphRendererChooserdefault_glyph_renderer_chooser (void) const
 
const PainterShaderSetdefault_shaders (void) const
 
unsigned int draw_data_added_count (void) const
 
void draw_generic (PainterItemShader *shader, const PainterData &draw, c_array< const PainterAttribute > attrib_chunk, c_array< const PainterIndex > index_chunk, int index_adjust=0)
 
void draw_generic (PainterItemShader *shader, const PainterData &draw, c_array< const c_array< const PainterAttribute > > attrib_chunks, c_array< const c_array< const PainterIndex > > index_chunks, c_array< const int > index_adjusts)
 
void draw_generic (PainterItemShader *shader, const PainterData &draw, c_array< const c_array< const PainterAttribute > > attrib_chunks, c_array< const c_array< const PainterIndex > > index_chunks, c_array< const int > index_adjusts, c_array< const unsigned int > attrib_chunk_selector)
 
void draw_generic (PainterItemShader *shader, const PainterData &draw, c_array< const PainterAttribute > attrib_chunk, c_array< const PainterIndex > index_chunk, range_type< int > z_range, int index_adjust=0)
 
void draw_generic (PainterItemShader *shader, const PainterData &draw, c_array< const c_array< const PainterAttribute > > attrib_chunks, c_array< const c_array< const PainterIndex > > index_chunks, c_array< const range_type< int > > z_ranges, c_array< const int > index_adjusts)
 
void draw_generic (PainterItemShader *shader, const PainterData &draw, const PainterAttributeWriter &src)
 
GlyphRenderer draw_glyphs (const PainterGlyphShader &shader, const PainterData &draw, const GlyphSequence &glyph_sequence, GlyphRenderer renderer=GlyphRenderer(banded_rays_glyph))
 
GlyphRenderer draw_glyphs (const PainterData &draw, const GlyphSequence &glyph_sequence, GlyphRenderer renderer=GlyphRenderer(banded_rays_glyph))
 
GlyphRenderer draw_glyphs (const PainterBrush &brush, const GlyphSequence &glyph_sequence, GlyphRenderer renderer=GlyphRenderer(banded_rays_glyph))
 
GlyphRenderer draw_glyphs (const PainterGlyphShader &shader, const PainterData &draw, const GlyphSequence &glyph_sequence, const GlyphRendererChooser &renderer_chooser)
 
GlyphRenderer draw_glyphs (const PainterData &draw, const GlyphSequence &glyph_sequence, const GlyphRendererChooser &renderer_chooser)
 
GlyphRenderer draw_glyphs (const PainterBrush &brush, const GlyphSequence &glyph_sequence, const GlyphRendererChooser &renderer_chooser)
 
GlyphRenderer draw_glyphs (const PainterGlyphShader &shader, const PainterData &draw, const GlyphRun &glyph_run, unsigned int begin, unsigned int count, GlyphRenderer renderer=GlyphRenderer(banded_rays_glyph))
 
GlyphRenderer draw_glyphs (const PainterData &draw, const GlyphRun &glyph_run, unsigned int begin, unsigned int count, GlyphRenderer renderer=GlyphRenderer(banded_rays_glyph))
 
GlyphRenderer draw_glyphs (const PainterBrush &brush, const GlyphRun &glyph_run, unsigned int begin, unsigned int count, GlyphRenderer renderer=GlyphRenderer(banded_rays_glyph))
 
GlyphRenderer draw_glyphs (const PainterGlyphShader &shader, const PainterData &draw, const GlyphRun &glyph_run, GlyphRenderer renderer=GlyphRenderer(banded_rays_glyph))
 
GlyphRenderer draw_glyphs (const PainterData &draw, const GlyphRun &glyph_run, GlyphRenderer renderer=GlyphRenderer(banded_rays_glyph))
 
GlyphRenderer draw_glyphs (const PainterBrush &brush, const GlyphRun &glyph_run, GlyphRenderer renderer=GlyphRenderer(banded_rays_glyph))
 
GlyphRenderer draw_glyphs (const PainterGlyphShader &shader, const PainterData &draw, const GlyphRun &glyph_run, unsigned int begin, unsigned int count, const GlyphRendererChooser &renderer_chooser)
 
GlyphRenderer draw_glyphs (const PainterData &draw, const GlyphRun &glyph_run, unsigned int begin, unsigned int count, const GlyphRendererChooser &renderer_chooser)
 
GlyphRenderer draw_glyphs (const PainterBrush &brush, const GlyphRun &glyph_run, unsigned int begin, unsigned int count, const GlyphRendererChooser &renderer_chooser)
 
GlyphRenderer draw_glyphs (const PainterGlyphShader &shader, const PainterData &draw, const GlyphRun &glyph_run, const GlyphRendererChooser &renderer_chooser)
 
GlyphRenderer draw_glyphs (const PainterData &draw, const GlyphRun &glyph_run, const GlyphRendererChooser &renderer_chooser)
 
GlyphRenderer draw_glyphs (const PainterBrush &brush, const GlyphRun &glyph_run, const GlyphRendererChooser &renderer_chooser)
 
c_array< const PainterSurface *const > end (void)
 
void end_coverage_buffer (void)
 
void end_layer (void)
 
void fill_convex_polygon (const PainterFillShader &shader, const PainterData &draw, c_array< const vec2 > pts, bool apply_shader_anti_aliasing=true)
 
void fill_convex_polygon (const PainterData &draw, c_array< const vec2 > pts, bool apply_shader_anti_aliasing=true)
 
void fill_convex_polygon (const PainterBrush &brush, c_array< const vec2 > pts, bool apply_shader_anti_aliasing=true)
 
void fill_path (const PainterFillShader &shader, const PainterData &draw, const FilledPath &data, enum fill_rule_t fill_rule, bool apply_shader_anti_aliasing=true)
 
void fill_path (const PainterFillShader &shader, const PainterData &draw, const Path &path, enum fill_rule_t fill_rule, bool apply_shader_anti_aliasing=true)
 
void fill_path (const PainterFillShader &shader, const PainterData &draw, const FilledPath &data, const CustomFillRuleBase &fill_rule, bool apply_shader_anti_aliasing=true)
 
void fill_path (const PainterFillShader &shader, const PainterData &draw, const Path &path, const CustomFillRuleBase &fill_rule, bool apply_shader_anti_aliasing=true)
 
void fill_path (const PainterGlyphShader &shader, const PainterData &draw, const ShaderFilledPath &path, enum fill_rule_t fill_rule)
 
void fill_path (const PainterData &draw, const Path &path, enum fill_rule_t fill_rule, bool apply_shader_anti_aliasing=true)
 
void fill_path (const PainterData &draw, const Path &path, const CustomFillRuleBase &fill_rule, bool apply_shader_anti_aliasing=true)
 
void fill_path (const PainterData &draw, const ShaderFilledPath &path, enum fill_rule_t fill_rule)
 
void fill_path (const PainterBrush &brush, const Path &path, enum fill_rule_t fill_rule, bool apply_shader_anti_aliasing=true)
 
void fill_path (const PainterBrush &brush, const Path &path, const CustomFillRuleBase &fill_rule, bool apply_shader_anti_aliasing=true)
 
void fill_rect (const PainterFillShader &shader, const PainterData &draw, const Rect &rect, bool apply_shader_anti_aliasing=true)
 
void fill_rect (const PainterData &draw, const Rect &rect, bool apply_shader_anti_aliasing=true)
 
void fill_rect (const PainterBrush &brush, const Rect &rect, bool apply_shader_anti_aliasing=true)
 
void fill_rounded_rect (const PainterFillShader &shader, const PainterData &draw, const RoundedRect &R, bool apply_shader_anti_aliasing=true)
 
void fill_rounded_rect (const PainterData &draw, const RoundedRect &R, bool apply_shader_anti_aliasing=true)
 
void fill_rounded_rect (const PainterBrush &brush, const RoundedRect &R, bool apply_shader_anti_aliasing=true)
 
enum return_code flush (void)
 
enum return_code flush (const reference_counted_ptr< PainterSurface > &new_surface)
 
GlyphAtlasglyph_atlas (void) const
 
GlyphCacheglyph_cache (void) const
 
ImageAtlasimage_atlas (void) const
 
PainterPackedValuePoolpacked_value_pool (void)
 
PainterShaderRegistrarpainter_shader_registrar (void) const
 
unsigned int query_stat (enum query_stats_t st) const
 
void query_stats (c_array< unsigned int > dst) const
 
void queue_action (const reference_counted_ptr< const PainterDrawBreakAction > &action)
 
void restore (void)
 
void rotate (float angle)
 
void save (void)
 
void scale (float s)
 
unsigned int select_subsets (const FilledPath &path, c_array< unsigned int > dst)
 
void select_subsets (const PartitionedTessellatedPath &path, c_array< const float > geometry_inflation, bool select_miter_joins, fastuidraw::PartitionedTessellatedPath::SubsetSelection &dst, NormalizedCoordRect *nrect)
 
void shear (float sx, float sy)
 
void stroke_dashed_path (const PainterDashedStrokeShaderSet &shader, const PainterData &draw, const Path &path, const StrokingStyle &stroke_style=StrokingStyle(), bool apply_shader_anti_aliasing=true, enum stroking_method_t stroking_method=stroking_method_fastest, const PathEffect *effect=nullptr)
 
void stroke_dashed_path (const PainterData &draw, const Path &path, const StrokingStyle &stroke_style=StrokingStyle(), bool apply_shader_anti_aliasing=true, enum stroking_method_t stroking_method=stroking_method_fastest, const PathEffect *effect=nullptr)
 
void stroke_dashed_path (const PainterBrush &brush, const PainterDashedStrokeParams &stroking_params, const Path &path, const StrokingStyle &stroke_style=StrokingStyle(), bool apply_shader_anti_aliasing=true, enum stroking_method_t stroking_method=stroking_method_fastest, const PathEffect *effect=nullptr)
 
void stroke_path (const PainterStrokeShader &shader, const PainterData &draw, const Path &path, const StrokingStyle &stroke_style=StrokingStyle(), bool apply_shader_anti_aliasing=true, enum stroking_method_t stroking_method=stroking_method_fastest, const PathEffect *effect=nullptr)
 
void stroke_path (const PainterData &draw, const Path &path, const StrokingStyle &stroke_style=StrokingStyle(), bool apply_shader_anti_aliasing=true, enum stroking_method_t stroking_method=stroking_method_fastest, const PathEffect *effect=nullptr)
 
void stroke_path (const PainterBrush &brush, const PainterStrokeParams &stroking_params, const Path &path, const StrokingStyle &stroke_style=StrokingStyle(), bool apply_shader_anti_aliasing=true, enum stroking_method_t stroking_method=stroking_method_fastest, const PathEffect *effect=nullptr)
 
const reference_counted_ptr< PainterSurface > & surface (void) const
 
void transformation (const float3x3 &m)
 
const float3x3transformation (void)
 
void translate (const vec2 &p)
 
- Public Member Functions inherited from fastuidraw::reference_counted_base< T, Counter >
 reference_counted_base (void)
 

Static Public Member Functions

static unsigned int number_stats (void)
 
- Static Public Member Functions inherited from fastuidraw::PainterEnums
static enum fill_rule_t complement_fill_rule (enum fill_rule_t f)
 
static bool is_miter_join (enum join_style js)
 
static c_string label (enum screen_orientation v)
 
static c_string label (enum rotation_orientation_t v)
 
static c_string label (enum glyph_layout_type v)
 
static c_string label (enum cap_style v)
 
static c_string label (enum join_style v)
 
static c_string label (enum fill_rule_t v)
 
static c_string label (enum stroking_method_t v)
 
static c_string label (enum blend_mode_t v)
 
static c_string label (enum query_stats_t v)
 
- Static Public Member Functions inherited from fastuidraw::reference_counted_base< T, Counter >
static void add_reference (const reference_counted_base< T, Counter > *p)
 
static void remove_reference (const reference_counted_base< T, Counter > *p)
 

Additional Inherited Members

- Public Types inherited from fastuidraw::PainterEnums
enum  blend_mode_t {
  blend_porter_duff_clear, blend_porter_duff_src, blend_porter_duff_dst, blend_porter_duff_src_over,
  blend_porter_duff_dst_over, blend_porter_duff_src_in, blend_porter_duff_dst_in, blend_porter_duff_src_out,
  blend_porter_duff_dst_out, blend_porter_duff_src_atop, blend_porter_duff_dst_atop, blend_porter_duff_xor,
  blend_porter_duff_plus, blend_porter_duff_modulate, blend_w3c_screen, blend_w3c_overlay,
  blend_w3c_darken, blend_w3c_lighten, blend_w3c_color_dodge, blend_w3c_color_burn,
  blend_w3c_hardlight, blend_w3c_softlight, blend_w3c_difference, blend_w3c_exclusion,
  blend_w3c_multiply, blend_w3c_hue, blend_w3c_saturation, blend_w3c_color,
  blend_w3c_luminosity, number_blend_mode
}
 Enumeration specifying blend modes. The following function-formulas are used in a number of the blend modes: More...
 
enum  cap_style { flat_caps, rounded_caps, square_caps, number_cap_styles }
 Enumeration specifying if and how to draw caps when stroking. More...
 
enum  fill_rule_t {
  odd_even_fill_rule, complement_odd_even_fill_rule, nonzero_fill_rule, complement_nonzero_fill_rule,
  number_fill_rule
}
 Enumerations specifying common fill rules. More...
 
enum  glyph_layout_type { glyph_layout_horizontal, glyph_layout_vertical, number_glyph_layout }
 Enumeration to indicate if glyph layout is horizontal or vertical. More...
 
enum  join_style {
  no_joins, rounded_joins, bevel_joins, miter_clip_joins,
  miter_bevel_joins, miter_joins, number_join_styles
}
 Enumeration specifying if and how to draw joins when stroking. More...
 
enum  query_stats_t {
  num_attributes, num_indices, num_datas, num_draws,
  num_headers, num_render_targets, num_ends, num_layers,
  num_deferred_coverages
}
 Enumeration to query the statistics of how much data has been packed. More...
 
enum  rotation_orientation_t { clockwise, counter_clockwise, number_rotation_orientation }
 Enumeration to specify orientation of a rotation. More...
 
enum  screen_orientation { y_increases_downwards, y_increases_upwards, number_screen_orientation }
 Enumeration to indicate in what direction the y-coordinate increases. More...
 
enum  stroking_method_t {
  stroking_method_linear, stroking_method_arc, stroking_method_number_precise_choices, stroking_method_fastest = stroking_method_number_precise_choices,
  number_stroking_methods
}
 
- Public Types inherited from fastuidraw::PainterBrushEnums
enum  filter_t { filter_nearest = 1, filter_linear = 2, filter_cubic = 3 }
 Enumeration specifying what filter to apply to an image. More...
 
enum  gradient_type_t {
  gradient_non = 0, gradient_linear, gradient_radial, gradient_sweep,
  number_gradient_types
}
 
enum  mipmap_t { apply_mipmapping, dont_apply_mipmapping }
 
enum  spread_type_t {
  spread_clamp, spread_mirror, spread_repeat, spread_mirror_repeat,
  number_spread_types
}
 

Detailed Description

Painter implements a canvas rendering interface.

Painter implements:

The transformation of a Painter goes from local item coordinate to 3D API clip-coordinates (for example in GL, from item coordinates to gl_Position.xyw). FastUIDraw follows the convention that the top of the window is at normalized y-coordinate -1 and the bottom of the window is at normalized y-coordinate +1. The transformation is to be applied as matrix-vector multiplication, i.e.

ClipCoordinates = transformation() * vec3(x, y, 1.0)

for local coordiante (x, y). Normalized device coordinates are defined as

NormalizedDeviceCoordinates = ClipCoordinates.xy / ClipCoordinates.w

where (-1, -1) corresponds to the bottom-left hand corner of the viewport (see PainterSurface::viewport()) and (+1, +1) is the top right hand corner of the viewport.

The pixel pipeline of Painter is

Painter uses clip-planes and the depth buffer to perform clipping. The depth-buffer clips by occluding elements. For example, the method clip_out_rect() simply draws a rectangle so that it does not affect the color buffer but with a depth value that is infront of the elements that it is to occlude. Painter uses the convention that elements with greater than or equal depth values are visible (for example in GL this corresponds to the depth test being set to GL_GEQUAL). Unless an item occludes (or self occludes), the current active depth value is unaffected. An item's vertex shader will emit a relative z-value (i.e. relative to the item) which is then incremented by the current z-value of the Painter.

A Painter is a HEAVY object (it creates pools of buffers during its lifetime for reuse). As such, one should reuse Painter objects as much as reasonably possible.

Definition at line 120 of file painter.hpp.

Constructor & Destructor Documentation

◆ Painter()

fastuidraw::Painter::Painter ( const reference_counted_ptr< PainterEngine > &  backend)
explicit

Ctor.

Parameters
backendPainterEngine object from which via PainterEngine::create_backend(), the created Painter object will use for its entire lifetime.

Member Function Documentation

◆ begin() [1/2]

void fastuidraw::Painter::begin ( const reference_counted_ptr< PainterSurface > &  surface,
const float3x3 initial_transformation,
bool  clear_color_buffer = true 
)

Indicate to start drawing with methods of this Painter. The transformation matrix will be intialized with given float3x3. Drawing commands sent to 3D hardware are buffered and not sent to the hardware until end() is called. All draw commands must be between a begin()/end() pair.

Parameters
surfacethe PainterSurface to which to render content
initial_transformationvalue to initialize transformation() which is the matrix from logical coordinates to API 3D clip coordinates.
clear_color_bufferif true, clear the color buffer on the viewport of the surface.

◆ begin() [2/2]

void fastuidraw::Painter::begin ( const reference_counted_ptr< PainterSurface > &  surface,
enum screen_orientation  orientation,
bool  clear_color_buffer = true 
)

Indicate to start drawing with methods of this Painter. The ransformation matrix will be intialized with a projection matrix derived from the passed screen_orientation and the viewort of the passed PainterSurface. Drawing commands sent to 3D hardware are buffered and not sent to the hardware until end() is called. All draw commands must be between a begin()/end() pair.

Parameters
surfacethe PainterSurface to which to render content
orientationorientation convention with which to initialize the transformation
clear_color_bufferif true, clear the color buffer on the viewport of the surface.

◆ begin_coverage_buffer() [1/3]

void fastuidraw::Painter::begin_coverage_buffer ( void  )

Begin a deferred coverage buffer layer. A deferred coverage buffer is needed for those PainterItemShader values for which PainterItemShader::coverage_shader() is non-null. When a coverage buffer is active, those PainterItemCoverageShader will render to the current deferred coverage buffer and the PainterItemShader will read from it for its rendering. This starts a coverage buffer layer region of the size of the bounding box of the current clip-region. It is strongly suggested to use begin_coverage_buffer(const Rect&, float, float) or begin_coverage_buffer(const NormalizedCoordRect&, float) to limit the size of the coverage buffer.

◆ begin_coverage_buffer() [2/3]

void fastuidraw::Painter::begin_coverage_buffer ( const Rect logical_rect,
float  additional_pixel_slack = 0.0f,
float  additional_item_slack = 0.0f 
)

Acts the same as begin_coverage_buffer(void), but limits the coverage buffer to the bounding box of the intersection of the current clipping region with the passed rectangle.

Parameters
logical_rectrectangle in LOGICAL coordinates, i.e. before transformation() is applied.
additional_pixel_slackinflate the coverage buffer region by this many pixels on each side
additional_item_slackinflate the coverage buffer region by this amount in logical coordinates

◆ begin_coverage_buffer() [3/3]

void fastuidraw::Painter::begin_coverage_buffer ( const NormalizedCoordRect normalized_rect,
float  additional_pixel_slack = 0.0f 
)

Acts the same as begin_coverage_buffer(void), but limits the coverage buffer to the bounding box of the intersection of the current clipping region with the passed rectangle.

Parameters
normalized_rectrectangle in NORMALIZED DEVICE coordinates, i.e. after transformation() is applied.
additional_pixel_slackinflate the coverage buffer region by this many pixels on each side

◆ begin_layer() [1/3]

void fastuidraw::Painter::begin_layer ( const reference_counted_ptr< const PainterEffect > &  effect,
PainterEffectParams effect_params 
)

Begin an FX layer. This marks first rendering into an offscreen buffer and then blitting the buffer with the passed FX applied. The buffer will be blitted with the blend_shader(), and blend_mode() at the time of the call to begin_layer(). All restore() commands called after a begin_layer() must match a save() from after a begin_layer(). It is acceptable to layer any number of begin_layer() calls as well.

Parameters
effecteffect to apply
effect_paramseffect parameters for the effect

◆ begin_layer() [2/3]

void fastuidraw::Painter::begin_layer ( const vec4 color_modulate)

Begin a transparency layer. This marks first rendering into an offscreen buffer and then blitting the buffer. The buffer will be blitted with the blend_shader(), and blend_mode() at the time of the call to begin_layer(). All restore() commands called after a begin_layer() must match a save() from after a begin_layer(). It is acceptable to layer any number of begin_layer() calls as well.

Parameters
color_modulatecolor value by which to modulate the layer when it is to be blitted

◆ begin_layer() [3/3]

void fastuidraw::Painter::begin_layer ( float  alpha)
inline

Provided as a conveniance, equivalent to

begin_layer(vec4(1.0f, 1.0f, 1.0f, alpha));
Parameters
alphaalpha value for color modulation.

Definition at line 783 of file painter.hpp.

◆ blend_mode()

BlendMode fastuidraw::Painter::blend_mode ( void  ) const

Returns the active 3D API blend mode

◆ blend_shader() [1/4]

PainterBlendShader* fastuidraw::Painter::blend_shader ( void  ) const

Returns the active blend shader

◆ blend_shader() [2/4]

void fastuidraw::Painter::blend_shader ( const reference_counted_ptr< PainterBlendShader > &  h,
BlendMode  blend_mode 
)

Sets the blend shader.

Parameters
hblend shader to use for blending.
blend_mode3D API blend mode

◆ blend_shader() [3/4]

void fastuidraw::Painter::blend_shader ( const PainterBlendShaderSet shader_set,
enum blend_mode_t  m 
)
inline

Equivalent to

blend_shader(shader_set.shader(m), shader_set.blend_mode(m))

It is a crashing error if shader_set does not support the named blend mode.

Parameters
shader_setPainterBlendShaderSet from which to take blend shader
mBlend mode to use

Definition at line 301 of file painter.hpp.

◆ blend_shader() [4/4]

void fastuidraw::Painter::blend_shader ( enum blend_mode_t  m)
inline

Equivalent to

blend_shader(default_shaders().blend_shaders(), m)
Parameters
mBlend mode to use

Definition at line 315 of file painter.hpp.

◆ clip_equations()

c_array<const vec3> fastuidraw::Painter::clip_equations ( void  )

Returns the current clip-equations of the Painter. The clip-equations are updated whenever clip_in_rect() or clip_in_path() or restore() are called, as such the returned c_array then becomes invalid. The equations are in -CLIP- coordinates, thus do not change when the transformation changes.

◆ clip_in_path() [1/4]

void fastuidraw::Painter::clip_in_path ( const Path path,
enum fill_rule_t  fill_rule 
)

Clip-in by a path, i.e. set the clipping to be the intersection of the current clipping against the the fill of a path.

Parameters
pathpath by which to clip out
fill_rulefill rule to apply to path

◆ clip_in_path() [2/4]

void fastuidraw::Painter::clip_in_path ( const FilledPath path,
enum fill_rule_t  fill_rule 
)

Clip-in by a path, i.e. set the clipping to be the intersection of the current clipping against the the fill of a path.

Parameters
pathpath by which to clip out
fill_rulefill rule to apply to path

◆ clip_in_path() [3/4]

void fastuidraw::Painter::clip_in_path ( const Path path,
const CustomFillRuleBase fill_rule 
)

Clip-in by a path, i.e. set the clipping to be the intersection of the current clipping against the the fill of a path.

Parameters
pathpath by which to clip out
fill_rulecustom fill rule to apply to path

◆ clip_in_path() [4/4]

void fastuidraw::Painter::clip_in_path ( const FilledPath path,
const CustomFillRuleBase fill_rule 
)

Clip-in by a path, i.e. set the clipping to be the intersection of the current clipping against the the fill of a path.

Parameters
pathpath by which to clip out
fill_rulecustom fill rule to apply to path

◆ clip_in_rect()

void fastuidraw::Painter::clip_in_rect ( const Rect rect)

Set clipping to the intersection of the current clipping with a rectangle.

Parameters
rectclip-in rectangle

◆ clip_in_rounded_rect()

void fastuidraw::Painter::clip_in_rounded_rect ( const RoundedRect R)

Set clipping to the intersection of the current clipping with a rounded rectangle.

Parameters
Rrounded rectangle

◆ clip_out_convex_polygon()

void fastuidraw::Painter::clip_out_convex_polygon ( c_array< const vec2 poly)

Clipout by a convex polygon

Parameters
polypoints of the convex polygon

◆ clip_out_custom() [1/3]

void fastuidraw::Painter::clip_out_custom ( PainterItemShader shader,
const PainterDataValue< PainterItemShaderData > &  shader_data,
c_array< const c_array< const PainterAttribute > >  attrib_chunks,
c_array< const c_array< const PainterIndex > >  index_chunks,
c_array< const int >  index_adjusts,
c_array< const unsigned int >  attrib_chunk_selector 
)

Clipout by custom data.

Parameters
shadershader with which to draw the attribute/index data
shader_datashader data to pass to shader
attrib_chunksattribute data to draw
index_chunksthe i'th element is index data into attrib_chunks[i]
index_adjustsif non-empty, the i'th element is the value by which to adjust all of index_chunks[i]; if empty the index values are not adjusted.
attrib_chunk_selectorselects which attribute chunk to use for each index chunk

◆ clip_out_custom() [2/3]

void fastuidraw::Painter::clip_out_custom ( PainterItemShader shader,
const PainterDataValue< PainterItemShaderData > &  shader_data,
c_array< const c_array< const PainterAttribute > >  attrib_chunks,
c_array< const c_array< const PainterIndex > >  index_chunks,
c_array< const int >  index_adjusts 
)
inline

Clipout by custom data.

Parameters
shadershader with which to draw the attribute/index data
shader_datashader data to pass to shader
attrib_chunksattribute data to draw
index_chunksthe i'th element is index data into attrib_chunks[i]
index_adjustsif non-empty, the i'th element is the value by which to adjust all of index_chunks[i]; if empty the index values are not adjusted.

Definition at line 662 of file painter.hpp.

◆ clip_out_custom() [3/3]

void fastuidraw::Painter::clip_out_custom ( PainterItemShader shader,
const PainterDataValue< PainterItemShaderData > &  shader_data,
c_array< const PainterAttribute attrib_chunk,
c_array< const PainterIndex index_chunk,
int  index_adjust = 0 
)
inline

Clipout by custom data.

Parameters
shadershader with which to draw the attribute/index data
shader_datashader data to pass to shader
attrib_chunkattribute data to draw
index_chunkindex data into attrib_chunk
index_adjustamount by which to adjust the values in index_chunk

Definition at line 682 of file painter.hpp.

◆ clip_out_path() [1/4]

void fastuidraw::Painter::clip_out_path ( const Path path,
enum fill_rule_t  fill_rule 
)

Clip-out by a path, i.e. set the clipping to be the intersection of the current clipping against the -complement- of the fill of a path.

Parameters
pathpath by which to clip out
fill_rulefill rule to apply to path

◆ clip_out_path() [2/4]

void fastuidraw::Painter::clip_out_path ( const FilledPath path,
enum fill_rule_t  fill_rule 
)

Clip-out by a path, i.e. set the clipping to be the intersection of the current clipping against the -complement- of the fill of a path.

Parameters
pathpath by which to clip out
fill_rulefill rule to apply to path

◆ clip_out_path() [3/4]

void fastuidraw::Painter::clip_out_path ( const Path path,
const CustomFillRuleBase fill_rule 
)

Clip-out by a path, i.e. set the clipping to be the intersection of the current clipping against the -complement- of the fill of a path.

Parameters
pathpath by which to clip out
fill_rulecustom fill rule to apply to path

◆ clip_out_path() [4/4]

void fastuidraw::Painter::clip_out_path ( const FilledPath path,
const CustomFillRuleBase fill_rule 
)

Clip-out by a path, i.e. set the clipping to be the intersection of the current clipping against the -complement- of the fill of a path.

Parameters
pathpath by which to clip out
fill_rulecustom fill rule to apply to path

◆ clip_out_rect()

void fastuidraw::Painter::clip_out_rect ( const Rect rect)

Clipout by a rect

Parameters
rectclip-out rectangle

◆ clip_out_rounded_rect()

void fastuidraw::Painter::clip_out_rounded_rect ( const RoundedRect R)

Set clipping to the intersection of the current clipping with the complement of a rounded rectangle.

Parameters
Rrounded rectangle

◆ clip_polygon()

c_array<const vec3> fastuidraw::Painter::clip_polygon ( void  )

Returns the convex polygon embodied by clip_equations(). The value changes whenever clip_in_rect(), clip_in_path() or restore() are called, as such the returned c_array then becomes invalid. The coordinates are in -CLIP- coordinates, thus do not change when the transformation changes.

◆ clip_region_bounds()

bool fastuidraw::Painter::clip_region_bounds ( vec2 min_pt,
vec2 max_pt 
)

If the clipping region is non-empty, returns true and writes the min and max corner of the bounding box in normalized device coordinates of the clipping region.

Parameters
min_ptlocation to which to write the minimum corner point
max_ptlocation to which to write the maximum corner point

◆ clip_region_logical_bounds()

bool fastuidraw::Painter::clip_region_logical_bounds ( vec2 min_pt,
vec2 max_pt 
)

If the clipping region is non-empty, returns true and writes the min and max corner of the bounding box in local coordinates of the clipping region.

Parameters
min_ptlocation to which to write the minimum corner point
max_ptlocation to which to write the maximum corner point

◆ colorstop_atlas()

ColorStopAtlas& fastuidraw::Painter::colorstop_atlas ( void  ) const

Returns a reference to the ColorStopAtlas of this Painter. All color stops used by all brushes of this Painter must live on colorstop_atlas().

◆ compute_glyph_renderer() [1/2]

GlyphRenderer fastuidraw::Painter::compute_glyph_renderer ( float  pixel_size)

Feed a logical pixel size and the current transformation to default_glyph_renderer_chooser() to compute how to render glyphs.

Parameters
pixel_sizesize of text to render BEFORE applying the transformation matrix.

◆ compute_glyph_renderer() [2/2]

GlyphRenderer fastuidraw::Painter::compute_glyph_renderer ( float  pixel_size,
const GlyphRendererChooser chooser 
)

Feed a logical pixel size and the current transformation to a GlyphRendererChooser to compute how to render glyphs.

Parameters
pixel_sizesize of text to render BEFORE applying the transformation matrix.
chooserobject that chooses how to render glyphs

◆ compute_path_thresh() [1/2]

float fastuidraw::Painter::compute_path_thresh ( const Path path)

Returns what value Painter currently uses for Path::tessellation(float) const to fetch the TessellatedPath from which it will fetch the FilledPath to perform a path fill.

Parameters
pathPath to choose the thresh for

◆ compute_path_thresh() [2/2]

float fastuidraw::Painter::compute_path_thresh ( const Path path,
const c_array< const uvec4 shader_data,
const reference_counted_ptr< const StrokingDataSelectorBase > &  selector,
float *  out_rounded_thresh 
)

Returns what value Painter currently uses for Path::tessellation(float) const to fetch the TessellatedPath use to perform stroking and filling.

Parameters
pathPath to choose the thresh for
shader_datadata sent to stroking shader
selectorobject (see PainterStrokeShader::stroking_data_selector()) to use stroking parameters to help compute necessary thresh
[out]out_rounded_threshlocation to which to write threshhold to be used for rounded caps and joins of StrokedPath.

◆ concat()

void fastuidraw::Painter::concat ( const float3x3 tr)

Concats the current transformation matrix by a given matrix.

Parameters
trtransformation by which to concat

◆ curve_flatness() [1/2]

void fastuidraw::Painter::curve_flatness ( float  thresh)

Set the curve flatness requirement for TessellatedPath selection when stroking or filling paths when passing to drawing methods a Path object. The value represents the distance, in pixels, requested for between the approximated curve (realized in TessellatedPath) and the true curve (realized in Path). This value is combined with a value derived from the current transformation matrix to pass to Path::tessellation(float) to fetch a TessellatedPath. Default value is 0.5.

◆ curve_flatness() [2/2]

float fastuidraw::Painter::curve_flatness ( void  )

Returns the value set by curve_flatness(float).

◆ default_glyph_renderer_chooser()

const GlyphRendererChooser& fastuidraw::Painter::default_glyph_renderer_chooser ( void  ) const

Returns the default GlyphRendererChooser object that Painter uses.

◆ default_shaders()

const PainterShaderSet& fastuidraw::Painter::default_shaders ( void  ) const

Return the default shaders for common drawing types.

◆ draw_data_added_count()

unsigned int fastuidraw::Painter::draw_data_added_count ( void  ) const

Everytime Painter generates attribute/index data to be sent to the 3D API, this counter is incremented. The value is essentially equivalent to the number of times draw_generic() is called (directly or indirectly through other methods). The counter is reset when begin() is called.

◆ draw_generic() [1/6]

void fastuidraw::Painter::draw_generic ( PainterItemShader shader,
const PainterData draw,
c_array< const PainterAttribute attrib_chunk,
c_array< const PainterIndex index_chunk,
int  index_adjust = 0 
)
inline

Draw generic attribute data.

Parameters
shadershader with which to draw data
drawdata for how to draw
attrib_chunkattribute data to draw
index_chunkindex data into attrib_chunk
index_adjustamount by which to adjust the values in index_chunk

Definition at line 1626 of file painter.hpp.

◆ draw_generic() [2/6]

void fastuidraw::Painter::draw_generic ( PainterItemShader shader,
const PainterData draw,
c_array< const c_array< const PainterAttribute > >  attrib_chunks,
c_array< const c_array< const PainterIndex > >  index_chunks,
c_array< const int >  index_adjusts 
)

Draw generic attribute data.

Parameters
shadershader with which to draw data
drawdata for how to draw
attrib_chunksattribute data to draw
index_chunksthe i'th element is index data into attrib_chunks[i]
index_adjustsif non-empty, the i'th element is the value by which to adjust all of index_chunks[i]; if empty the index values are not adjusted.

◆ draw_generic() [3/6]

void fastuidraw::Painter::draw_generic ( PainterItemShader shader,
const PainterData draw,
c_array< const c_array< const PainterAttribute > >  attrib_chunks,
c_array< const c_array< const PainterIndex > >  index_chunks,
c_array< const int >  index_adjusts,
c_array< const unsigned int >  attrib_chunk_selector 
)

Draw generic attribute data

Parameters
shadershader with which to draw data
drawdata for how to draw
attrib_chunksattribute data to draw
index_chunksthe i'th element is index data into attrib_chunks[K] where K = attrib_chunk_selector[i]
index_adjustsif non-empty, the i'th element is the value by which to adjust all of index_chunks[i]; if empty the index values are not adjusted.
attrib_chunk_selectorselects which attribute chunk to use for each index chunk

◆ draw_generic() [4/6]

void fastuidraw::Painter::draw_generic ( PainterItemShader shader,
const PainterData draw,
c_array< const PainterAttribute attrib_chunk,
c_array< const PainterIndex index_chunk,
range_type< int >  z_range,
int  index_adjust = 0 
)

Draw generic attribute data where the item self occludes

Parameters
shadershader with which to draw data
drawdata for how to draw
attrib_chunkattribute data to draw
index_chunkindex data into attrib_chunk
index_adjustamount by which to adjust the values in index_chunk
z_rangez-range of item's attribute data

◆ draw_generic() [5/6]

void fastuidraw::Painter::draw_generic ( PainterItemShader shader,
const PainterData draw,
c_array< const c_array< const PainterAttribute > >  attrib_chunks,
c_array< const c_array< const PainterIndex > >  index_chunks,
c_array< const range_type< int > >  z_ranges,
c_array< const int >  index_adjusts 
)

Draw generic attribute data where the item self occludes

Parameters
shadershader with which to draw data
drawdata for how to draw
attrib_chunksattribute data to draw
index_chunksindex data into attrib_chunk
z_rangesz-ranges of item's attribute data
index_adjustsif non-empty, the i'th element is the value by which to adjust all of index_chunks[i]; if empty the index values are not adjusted.

◆ draw_generic() [6/6]

void fastuidraw::Painter::draw_generic ( PainterItemShader shader,
const PainterData draw,
const PainterAttributeWriter src 
)

Draw generic attribute data

Parameters
shadershader with which to draw data
drawdata for how to draw
srcgenerator of attribute and index data

◆ draw_glyphs() [1/18]

GlyphRenderer fastuidraw::Painter::draw_glyphs ( const PainterGlyphShader shader,
const PainterData draw,
const GlyphSequence glyph_sequence,
GlyphRenderer  renderer = GlyphRenderer(banded_rays_glyph) 
)

Draw glyphs from a GlyphSequence.

Parameters
shaderPainterGlyphShader to draw the glyphs
drawdata for how to draw
glyph_sequenceGlyphSequence providing glyphs
rendererhow to render the glyphs. If GlyphRenderer::valid() is false, then the Painter will use default_glyph_renderer_chooser() to choose the renderer
Returns
Returns what GlyphRenderer value used

◆ draw_glyphs() [2/18]

GlyphRenderer fastuidraw::Painter::draw_glyphs ( const PainterData draw,
const GlyphSequence glyph_sequence,
GlyphRenderer  renderer = GlyphRenderer(banded_rays_glyph) 
)

Draw glyphs from a GlyphSequence.

Parameters
drawdata for how to draw
glyph_sequenceGlyphSequence providing glyphs
rendererhow to render the glyphs. If GlyphRenderer::valid() is false, then the Painter will use default_glyph_renderer_chooser() to choose the renderer
Returns
Returns what GlyphRenderer value used

◆ draw_glyphs() [3/18]

GlyphRenderer fastuidraw::Painter::draw_glyphs ( const PainterBrush brush,
const GlyphSequence glyph_sequence,
GlyphRenderer  renderer = GlyphRenderer(banded_rays_glyph) 
)
inline

Draw glyphs from a GlyphSequence.

draw_glyphs(PainterData(&brush), glyph_sequence, renderer);
Parameters
brushbrush to apply to stroking
glyph_sequenceGlyphSequence providing glyphs
rendererhow to render the glyphs. If GlyphRenderer::valid() is false, then the Painter will use default_glyph_renderer_chooser() to choose the renderer
Returns
Returns what GlyphRenderer value used

Definition at line 931 of file painter.hpp.

◆ draw_glyphs() [4/18]

GlyphRenderer fastuidraw::Painter::draw_glyphs ( const PainterGlyphShader shader,
const PainterData draw,
const GlyphSequence glyph_sequence,
const GlyphRendererChooser renderer_chooser 
)

Draw glyphs from a GlyphSequence.

Parameters
shaderPainterGlyphShader to draw the glyphs
drawdata for how to draw
glyph_sequenceGlyphSequence providing glyphs
renderer_chooserGlyphRendererChooser to use to choose how to render the glyphs.
Returns
Returns what GlyphRenderer value used

◆ draw_glyphs() [5/18]

GlyphRenderer fastuidraw::Painter::draw_glyphs ( const PainterData draw,
const GlyphSequence glyph_sequence,
const GlyphRendererChooser renderer_chooser 
)

Draw glyphs from a GlyphSequence. and the data of the passed GlyphSequence.

Parameters
drawdata for how to draw
glyph_sequenceGlyphSequence providing glyphs
renderer_chooserGlyphRendererChooser to use to choose how to render the glyphs.
Returns
Returns what GlyphRenderer value used

◆ draw_glyphs() [6/18]

GlyphRenderer fastuidraw::Painter::draw_glyphs ( const PainterBrush brush,
const GlyphSequence glyph_sequence,
const GlyphRendererChooser renderer_chooser 
)
inline

Draw glyphs from a GlyphSequence.

draw_glyphs(PainterData(&brush), glyph_sequence, renderer_chooser);
Parameters
brushbrush to apply to text
glyph_sequenceGlyphSequence providing glyphs
renderer_chooserGlyphRendererChooser to use to choose how to render the glyphs.
Returns
Returns what GlyphRenderer value used

Definition at line 976 of file painter.hpp.

◆ draw_glyphs() [7/18]

GlyphRenderer fastuidraw::Painter::draw_glyphs ( const PainterGlyphShader shader,
const PainterData draw,
const GlyphRun glyph_run,
unsigned int  begin,
unsigned int  count,
GlyphRenderer  renderer = GlyphRenderer(banded_rays_glyph) 
)

Draw glyphs from a GlyphRun.

Parameters
shaderPainterGlyphShader to draw the glyphs
drawdata for how to draw
glyph_runGlyphRun providing glyphs
rendererhow to render the glyphs. If GlyphRenderer::valid() is false, then the Painter will use default_glyph_renderer_chooser() to choose the renderer
beginfirst character of GlyphRun to draw
countnumber of characters, startng at begin, of the GlyphRun to draw
Returns
Returns what GlyphRenderer value used

◆ draw_glyphs() [8/18]

GlyphRenderer fastuidraw::Painter::draw_glyphs ( const PainterData draw,
const GlyphRun glyph_run,
unsigned int  begin,
unsigned int  count,
GlyphRenderer  renderer = GlyphRenderer(banded_rays_glyph) 
)

Draw glyphs from a GlyphRun. and the data of the passed GlyphRun.

Parameters
drawdata for how to draw
glyph_runGlyphRun providing glyphs
rendererhow to render the glyphs. If GlyphRenderer::valid() is false, then the Painter will use default_glyph_renderer_chooser() to choose the renderer
beginfirst character of GlyphRun to draw
countnumber of characters, startng at begin, of the GlyphRun to draw
Returns
Returns what GlyphRenderer value used

◆ draw_glyphs() [9/18]

GlyphRenderer fastuidraw::Painter::draw_glyphs ( const PainterBrush brush,
const GlyphRun glyph_run,
unsigned int  begin,
unsigned int  count,
GlyphRenderer  renderer = GlyphRenderer(banded_rays_glyph) 
)
inline

Draw glyphs from a GlyphRun. and the data of the passed GlyphRun.

draw_glyphs(PainterData(&brush), glyph_run, begin, count, renderer);
Parameters
brushbrush to apply to text
glyph_runGlyphRun providing glyphs
rendererhow to render the glyphs. If GlyphRenderer::valid() is false, then the Painter will use default_glyph_renderer_chooser() to choose the renderer
beginfirst character of GlyphRun to draw
countnumber of characters, startng at begin, of the GlyphRun to draw
Returns
Returns what GlyphRenderer value used

Definition at line 1033 of file painter.hpp.

◆ draw_glyphs() [10/18]

GlyphRenderer fastuidraw::Painter::draw_glyphs ( const PainterGlyphShader shader,
const PainterData draw,
const GlyphRun glyph_run,
GlyphRenderer  renderer = GlyphRenderer(banded_rays_glyph) 
)

Draw all glyphs from a GlyphRun.

Parameters
shaderPainterGlyphShader to draw the glyphs
drawdata for how to draw
glyph_runGlyphRun providing glyphs
rendererhow to render the glyphs. If GlyphRenderer::valid() is false, then the Painter will use default_glyph_renderer_chooser() to choose the renderer
Returns
Returns what GlyphRenderer value used

◆ draw_glyphs() [11/18]

GlyphRenderer fastuidraw::Painter::draw_glyphs ( const PainterData draw,
const GlyphRun glyph_run,
GlyphRenderer  renderer = GlyphRenderer(banded_rays_glyph) 
)

Draw all glyphs from a GlyphRun. and the data of the passed GlyphRun.

Parameters
drawdata for how to draw
glyph_runGlyphRun providing glyphs
rendererhow to render the glyphs. If GlyphRenderer::valid() is false, then the Painter will use default_glyph_renderer_chooser() to choose the renderer
Returns
Returns what GlyphRenderer value used

◆ draw_glyphs() [12/18]

GlyphRenderer fastuidraw::Painter::draw_glyphs ( const PainterBrush brush,
const GlyphRun glyph_run,
GlyphRenderer  renderer = GlyphRenderer(banded_rays_glyph) 
)
inline

Draw glyphs from a GlyphRun.

draw_glyphs(PainterData(&brush), glyph_run, renderer);
Parameters
brushbrush to apply to text
glyph_runGlyphRun providing glyphs
rendererhow to render the glyphs. If GlyphRenderer::valid() is false, then the Painter will use default_glyph_renderer_chooser() to choose the renderer
Returns
Returns what GlyphRenderer value used

Definition at line 1082 of file painter.hpp.

◆ draw_glyphs() [13/18]

GlyphRenderer fastuidraw::Painter::draw_glyphs ( const PainterGlyphShader shader,
const PainterData draw,
const GlyphRun glyph_run,
unsigned int  begin,
unsigned int  count,
const GlyphRendererChooser renderer_chooser 
)

Draw glyphs from a GlyphRun.

Parameters
shaderPainterGlyphShader to draw the glyphs
drawdata for how to draw
glyph_runGlyphRun providing glyphs
renderer_chooserGlyphRendererChooser to use to choose how to render the glyphs.
beginfirst character of GlyphRun to draw
countnumber of characters, startng at begin, of the GlyphRun to draw
Returns
Returns what GlyphRenderer value used

◆ draw_glyphs() [14/18]

GlyphRenderer fastuidraw::Painter::draw_glyphs ( const PainterData draw,
const GlyphRun glyph_run,
unsigned int  begin,
unsigned int  count,
const GlyphRendererChooser renderer_chooser 
)

Draw glyphs from a GlyphRun. and the data of the passed GlyphRun.

Parameters
drawdata for how to draw
glyph_runGlyphRun providing glyphs
renderer_chooserGlyphRendererChooser to use to choose how to render the glyphs.
beginfirst character of GlyphRun to draw
countnumber of characters, startng at begin, of the GlyphRun to draw
Returns
Returns what GlyphRenderer value used

◆ draw_glyphs() [15/18]

GlyphRenderer fastuidraw::Painter::draw_glyphs ( const PainterBrush brush,
const GlyphRun glyph_run,
unsigned int  begin,
unsigned int  count,
const GlyphRendererChooser renderer_chooser 
)
inline

Draw glyphs from a GlyphRun.

draw_glyphs(PainterData(&brush), glyph_run, begin, count, renderer_chooser);
Parameters
brushbrush to apply to text
glyph_runGlyphRun providing glyphs
beginfirst character of GlyphRun to draw
countnumber of characters, startng at begin, of the GlyphRun to draw
renderer_chooserGlyphRendererChooser to use to choose how to render the glyphs.
Returns
Returns what GlyphRenderer value used

Definition at line 1134 of file painter.hpp.

◆ draw_glyphs() [16/18]

GlyphRenderer fastuidraw::Painter::draw_glyphs ( const PainterGlyphShader shader,
const PainterData draw,
const GlyphRun glyph_run,
const GlyphRendererChooser renderer_chooser 
)

Draw all glyphs from a GlyphRun.

Parameters
shaderPainterGlyphShader to draw the glyphs
drawdata for how to draw
glyph_runGlyphRun providing glyphs
renderer_chooserGlyphRendererChooser to use to choose how to render the glyphs.
Returns
Returns what GlyphRenderer value used

◆ draw_glyphs() [17/18]

GlyphRenderer fastuidraw::Painter::draw_glyphs ( const PainterData draw,
const GlyphRun glyph_run,
const GlyphRendererChooser renderer_chooser 
)

Draw all glyphs from a GlyphRun. and the data of the passed GlyphRun.

Parameters
drawdata for how to draw
glyph_runGlyphRun providing glyphs
renderer_chooserGlyphRendererChooser to use to choose how to render the glyphs.
Returns
Returns what GlyphRenderer value used

◆ draw_glyphs() [18/18]

GlyphRenderer fastuidraw::Painter::draw_glyphs ( const PainterBrush brush,
const GlyphRun glyph_run,
const GlyphRendererChooser renderer_chooser 
)
inline

Draw glyphs from a GlyphRun.

draw_glyphs(PainterData(&brush), glyph_run, renderer);
Parameters
brushbrush to apply to text
glyph_runGlyphRun providing glyphs
renderer_chooserGlyphRendererChooser to use to choose how to render the glyphs.
Returns
Returns what GlyphRenderer value used

Definition at line 1180 of file painter.hpp.

◆ end()

c_array<const PainterSurface* const> fastuidraw::Painter::end ( void  )

Indicate to end drawing with methods of this Painter. Drawing commands sent to 3D hardware are buffered and not sent to hardware until end() is called. Returns the list of surfaces used for offscreen rendering within the begin()/end() pair; these surfaces are -owned- by the Painter and their contents are potentially changed (or even the object destroyed) on the next call to begin(). All draw commands must be between a begin()/end() pair.

◆ end_coverage_buffer()

void fastuidraw::Painter::end_coverage_buffer ( void  )

End the current coverage buffer.

◆ end_layer()

void fastuidraw::Painter::end_layer ( void  )

End the current transparency layer and blit the layer.

◆ fill_convex_polygon() [1/3]

void fastuidraw::Painter::fill_convex_polygon ( const PainterFillShader shader,
const PainterData draw,
c_array< const vec2 pts,
bool  apply_shader_anti_aliasing = true 
)

Fill a convex polygon using a custom shader.

Parameters
shadershader with which to draw the convex polygon
drawdata for how to draw
ptspoints of the polygon so that neighboring points (modulo pts.size()) are the edges of the polygon.
apply_shader_anti_aliasingif true, fill with shader based anti-aliasing

◆ fill_convex_polygon() [2/3]

void fastuidraw::Painter::fill_convex_polygon ( const PainterData draw,
c_array< const vec2 pts,
bool  apply_shader_anti_aliasing = true 
)

Fill a convex polygon using the default fill shader.

Parameters
drawdata for how to draw
ptspoints of the polygon so that neighboring points (modulo pts.size()) are the edges of the polygon.
apply_shader_anti_aliasingif true, fill with shader based anti-aliasing

◆ fill_convex_polygon() [3/3]

void fastuidraw::Painter::fill_convex_polygon ( const PainterBrush brush,
c_array< const vec2 pts,
bool  apply_shader_anti_aliasing = true 
)
inline

Fill a convex polygon using the default fill shader.

fill_convex_polygon(PainterData(&brush), pts, apply_shader_anti_aliasing);
Parameters
brushPainterBrush to apply to fill
ptspoints of the polygon so that neighboring points (modulo pts.size()) are the edges of the polygon.
apply_shader_anti_aliasingif true, fill with shader based anti-aliasing

Definition at line 1535 of file painter.hpp.

◆ fill_path() [1/10]

void fastuidraw::Painter::fill_path ( const PainterFillShader shader,
const PainterData draw,
const FilledPath data,
enum fill_rule_t  fill_rule,
bool  apply_shader_anti_aliasing = true 
)

Fill a path.

Parameters
shadershader with which to fill the attribute data
drawdata for how to draw
dataattribute and index data with which to fill a path
fill_rulefill rule with which to fill the path
apply_shader_anti_aliasingif true, fill with shader based anti-aliasing

◆ fill_path() [2/10]

void fastuidraw::Painter::fill_path ( const PainterFillShader shader,
const PainterData draw,
const Path path,
enum fill_rule_t  fill_rule,
bool  apply_shader_anti_aliasing = true 
)

Fill a path.

Parameters
shadershader with which to fill the attribute data
drawdata for how to draw
pathto fill
fill_rulefill rule with which to fill the path
apply_shader_anti_aliasingif true, fill with shader based anti-aliasing

◆ fill_path() [3/10]

void fastuidraw::Painter::fill_path ( const PainterFillShader shader,
const PainterData draw,
const FilledPath data,
const CustomFillRuleBase fill_rule,
bool  apply_shader_anti_aliasing = true 
)

Fill a path.

Parameters
shadershader with which to fill the attribute data
drawdata for how to draw
dataattribute and index data with which to fill a path
fill_rulecustom fill rule with which to fill the path
apply_shader_anti_aliasingif true, fill with shader based anti-aliasing

◆ fill_path() [4/10]

void fastuidraw::Painter::fill_path ( const PainterFillShader shader,
const PainterData draw,
const Path path,
const CustomFillRuleBase fill_rule,
bool  apply_shader_anti_aliasing = true 
)

Fill a path.

Parameters
shadershader with which to fill the attribute data
drawdata for how to draw
pathto fill
fill_rulecustom fill rule with which to fill the path
apply_shader_anti_aliasingif true, fill with shader based anti-aliasing

◆ fill_path() [5/10]

void fastuidraw::Painter::fill_path ( const PainterGlyphShader shader,
const PainterData draw,
const ShaderFilledPath path,
enum fill_rule_t  fill_rule 
)

Fill a path via ShaderFilledPath

Parameters
shadershader with which to draw the ShaderFilledPath
drawdata for how to draw
pathShaderFilledPath to fill
fill_rulefill rule to apply to fill

◆ fill_path() [6/10]

void fastuidraw::Painter::fill_path ( const PainterData draw,
const Path path,
enum fill_rule_t  fill_rule,
bool  apply_shader_anti_aliasing = true 
)

Fill a path using the default shader to draw the fill.

Parameters
drawdata for how to draw
pathpath to fill
fill_rulefill rule with which to fill the path
apply_shader_anti_aliasingif true, fill with shader based anti-aliasing

◆ fill_path() [7/10]

void fastuidraw::Painter::fill_path ( const PainterData draw,
const Path path,
const CustomFillRuleBase fill_rule,
bool  apply_shader_anti_aliasing = true 
)

Fill a path using the default shader to draw the fill.

Parameters
drawdata for how to draw
pathpath to fill
fill_rulecustom fill rule with which to fill the path
apply_shader_anti_aliasingif true, fill with shader based anti-aliasing

◆ fill_path() [8/10]

void fastuidraw::Painter::fill_path ( const PainterData draw,
const ShaderFilledPath path,
enum fill_rule_t  fill_rule 
)

Fill a path via ShaderFilledPath using the default shader to draw the fill.

Parameters
drawdata for how to draw
pathShaderFilledPath to fill
fill_rulefill rule to apply to fill

◆ fill_path() [9/10]

void fastuidraw::Painter::fill_path ( const PainterBrush brush,
const Path path,
enum fill_rule_t  fill_rule,
bool  apply_shader_anti_aliasing = true 
)
inline

Fill a path using the default shader to draw the fill. Provided as a conveniance, equivalent to

fill_path(PainterData(&brush), path, fill_rule, apply_shader_anti_aliasing);
Parameters
brushPainterBrush to apply to fill
pathpath to fill
fill_rulefill rule with which to fill the path
apply_shader_anti_aliasingif true, fill with shader based anti-aliasing

Definition at line 1477 of file painter.hpp.

◆ fill_path() [10/10]

void fastuidraw::Painter::fill_path ( const PainterBrush brush,
const Path path,
const CustomFillRuleBase fill_rule,
bool  apply_shader_anti_aliasing = true 
)
inline

Fill a path using the default shader to draw the fill.

fill_path(PainterData(&brush), path, fill_rule, apply_shader_anti_aliasing);
Parameters
brushPainterBrush to apply to fill
pathpath to fill
fill_rulecustom fill rule with which to fill the path
apply_shader_anti_aliasingif true, fill with shader based anti-aliasing

Definition at line 1494 of file painter.hpp.

◆ fill_rect() [1/3]

void fastuidraw::Painter::fill_rect ( const PainterFillShader shader,
const PainterData draw,
const Rect rect,
bool  apply_shader_anti_aliasing = true 
)

Fill a rect using a custom shader.

Parameters
shadershader with which to draw the rect
drawdata for how to draw
rectrectangle to fill
apply_shader_anti_aliasingif true, fill with shader based anti-aliasing

◆ fill_rect() [2/3]

void fastuidraw::Painter::fill_rect ( const PainterData draw,
const Rect rect,
bool  apply_shader_anti_aliasing = true 
)

Fill a rect using the default fill shader.

Parameters
drawdata for how to draw
rectrectangle to fill
apply_shader_anti_aliasingif true, fill with shader based anti-aliasing

◆ fill_rect() [3/3]

void fastuidraw::Painter::fill_rect ( const PainterBrush brush,
const Rect rect,
bool  apply_shader_anti_aliasing = true 
)
inline

Fill a rect using the default fill shader.

fill_convex_polygon(PainterData(&brush), rect, apply_shader_anti_aliasing);
Parameters
brushPainterBrush to apply to fill
rectrectangle to fill
apply_shader_anti_aliasingif true, fill with shader based anti-aliasing

Definition at line 1573 of file painter.hpp.

◆ fill_rounded_rect() [1/3]

void fastuidraw::Painter::fill_rounded_rect ( const PainterFillShader shader,
const PainterData draw,
const RoundedRect R,
bool  apply_shader_anti_aliasing = true 
)

Fill a rounded rect using a fill shader

Parameters
shadershader with which to draw the rounded rectangle
drawdata for how to draw
RRoundedRect to draw
apply_shader_anti_aliasingif true, fill with shader based anti-aliasing

◆ fill_rounded_rect() [2/3]

void fastuidraw::Painter::fill_rounded_rect ( const PainterData draw,
const RoundedRect R,
bool  apply_shader_anti_aliasing = true 
)

Fill a rounded rect using the default fill shader

Parameters
drawdata for how to draw
RRoundedRect to draw
apply_shader_anti_aliasingif true, fill with shader based anti-aliasing

◆ fill_rounded_rect() [3/3]

void fastuidraw::Painter::fill_rounded_rect ( const PainterBrush brush,
const RoundedRect R,
bool  apply_shader_anti_aliasing = true 
)
inline

Fill a rounded rect using the default fill shader

fill_rounded_rect(PainterData(&brush), R, apply_shader_anti_aliasing);
Parameters
brushbrush to apply to filling
RRoundedRect to draw
apply_shader_anti_aliasingif true, fill with shader based anti-aliasing

Definition at line 1611 of file painter.hpp.

◆ flush() [1/2]

enum return_code fastuidraw::Painter::flush ( const reference_counted_ptr< PainterSurface > &  new_surface)

Flushes the rendering and flushes the rendering commands to the 3D API and shift to using a the passed surface; the surface's viewport dimensions MUST match the current surface's viewport dimensions, i.e. the value of PainterSurface::viewport().m_dimensions surface() and the passed PainterSurface must match. It is not possible if the Painter is within a begin_layer()/end_layer() pair or if it is within a begin_coverage_buffer()/end_coverage_buffer() pair. Returns routine_success if flush was executed and routine_fail if not.

◆ flush() [2/2]

enum return_code fastuidraw::Painter::flush ( void  )

Flushes the rendering and flushes the rendering commands to the 3D API and maintain using the current PainterSurface. It is not possible to flush if the Painter is within a begin_layer()/end_layer() pair or if it is within a begin_coverage_buffer()/end_coverage_buffer() pair. Returns routine_success if flush was executed and routine_fail if not.

◆ glyph_atlas()

GlyphAtlas& fastuidraw::Painter::glyph_atlas ( void  ) const

Returns a reference to the GlyphAtlas of this Painter. All glyphs used by this Painter must live on glyph_atlas().

◆ glyph_cache()

GlyphCache& fastuidraw::Painter::glyph_cache ( void  ) const

Returns a handle to the GlyphCache made from glyph_atlas().

◆ image_atlas()

ImageAtlas& fastuidraw::Painter::image_atlas ( void  ) const

Returns a reference to the ImageAtlas of of this Painter. All images used by this Painter must live on image_atlas().

◆ number_stats()

static unsigned int fastuidraw::Painter::number_stats ( void  )
static

Returns the number of stats the Painter type supports.

◆ packed_value_pool()

PainterPackedValuePool& fastuidraw::Painter::packed_value_pool ( void  )

Returns the PainterPackedValuePool used to construct PainterPackedValue objects.

◆ painter_shader_registrar()

PainterShaderRegistrar& fastuidraw::Painter::painter_shader_registrar ( void  ) const

Returns the PainterShaderRegistrar of the PainterBackend used by this Painter object. Use this return value to add custom shaders. NOTE: shaders added within a thread are not useable within that thread until the next call to begin().

◆ query_stat()

unsigned int fastuidraw::Painter::query_stat ( enum query_stats_t  st) const

Returns a stat on how much data the Packer has handled in the last begin()/end() pair. Calling query_stat() within a begin()/end() pair gives unreliable results.

Parameters
ststat to query

◆ query_stats()

void fastuidraw::Painter::query_stats ( c_array< unsigned int >  dst) const

Write into a c_array<> all the stats from the last begin()/end() pair. The number of stats can be fetched with number_stats(). The values written into are indexed by query_stats_t. Calling query_stats() within a begin()/end() pair gives unreliable results.

◆ queue_action()

void fastuidraw::Painter::queue_action ( const reference_counted_ptr< const PainterDrawBreakAction > &  action)

Queue an action that uses (or affects) the GPU. Through these actions, one can mix FastUIDraw::Painter with native API calls on a surface. However, adding an action induces a draw-break (and state restore) after each such action. Also, the action is not called until end() is called.

Parameters
actionaction to execute within a draw-stream.

◆ restore()

void fastuidraw::Painter::restore ( void  )

Restore the state of this Painter to the state it had from the last call to save().

◆ rotate()

void fastuidraw::Painter::rotate ( float  angle)

Concats the current transformation matrix with a rotation.

Parameters
angleangle by which to rotate in radians.

◆ save()

void fastuidraw::Painter::save ( void  )

Save the current state of this Painter onto the save state stack. The state is restored (and the stack popped) by called restore(). The state saved is:

◆ scale()

void fastuidraw::Painter::scale ( float  s)

Concats the current transformation matrix with a scaleing.

Parameters
sscaling factor by which to scale

◆ select_subsets() [1/2]

unsigned int fastuidraw::Painter::select_subsets ( const FilledPath path,
c_array< unsigned int >  dst 
)

Calls FilledPath::select_subsets() passing arguments derived from the current state of the Painter.

Parameters
pathFilledPath from which to compute subset selection
[out]dstlocation to which to write the FilledPath::Subset ID values
Returns
the number of Subset object ID's written to dst, that number is guaranteed to be no more than FilledPath::number_subsets().

◆ select_subsets() [2/2]

void fastuidraw::Painter::select_subsets ( const PartitionedTessellatedPath path,
c_array< const float >  geometry_inflation,
bool  select_miter_joins,
fastuidraw::PartitionedTessellatedPath::SubsetSelection dst,
NormalizedCoordRect nrect 
)

Calls PartitionedTessellatedPath::select_subsets() passing arguments derived from the current state of the Painter.

Parameters
pathPartitionedTessellatedPath from which to compute subset selection
geometry_inflationamount path geometry is inflated, array is indexed by the enumeration PathEnums::path_geometry_inflation_index_t
select_miter_joinsif true, when selecting what joins are in the area, enlarge the join footprint for if the joins are stroked as a type of miter join.
[out]dstlocation to which to write the selection
[out]nrectif non-null, location to which to write the bounding box of the selection. NOTE: if the selection is empty, then the value writen will be an empty-rect point at (0, 0).

◆ shear()

void fastuidraw::Painter::shear ( float  sx,
float  sy 
)

Concats the current transformation matrix with a shear.

Parameters
sxscaling factor in x-direction to apply
syscaling factor in y-direction to apply

◆ stroke_dashed_path() [1/3]

void fastuidraw::Painter::stroke_dashed_path ( const PainterDashedStrokeShaderSet shader,
const PainterData draw,
const Path path,
const StrokingStyle stroke_style = StrokingStyle(),
bool  apply_shader_anti_aliasing = true,
enum stroking_method_t  stroking_method = stroking_method_fastest,
const PathEffect effect = nullptr 
)

Stroke a path dashed.

Parameters
shadershader with which to draw
drawdata for how to draw
pathPath to stroke
stroke_stylehow to stroke the path
apply_shader_anti_aliasingif true, stroke with shader-based anti-aliasing
stroking_methodstroking method to use
effectif non-null, apply the given PathEffect on stroking

◆ stroke_dashed_path() [2/3]

void fastuidraw::Painter::stroke_dashed_path ( const PainterData draw,
const Path path,
const StrokingStyle stroke_style = StrokingStyle(),
bool  apply_shader_anti_aliasing = true,
enum stroking_method_t  stroking_method = stroking_method_fastest,
const PathEffect effect = nullptr 
)

Stroke a path using PainterShaderSet::dashed_stroke_shader() of default_shaders().

Parameters
drawdata for how to draw
pathPath to stroke
stroke_stylehow to stroke the path
apply_shader_anti_aliasingif true, stroke with shader-based anti-aliasing
stroking_methodstroking method to use
effectif non-null, apply the given PathEffect on stroking

◆ stroke_dashed_path() [3/3]

void fastuidraw::Painter::stroke_dashed_path ( const PainterBrush brush,
const PainterDashedStrokeParams stroking_params,
const Path path,
const StrokingStyle stroke_style = StrokingStyle(),
bool  apply_shader_anti_aliasing = true,
enum stroking_method_t  stroking_method = stroking_method_fastest,
const PathEffect effect = nullptr 
)
inline

Provided as a conveniance, equivalent to

stroke_dashed_path(PainterData(&brush, &stroking_params), path,
stroke_style, apply_shader_anti_aliasing,
stroking_method, effect);
Parameters
brushbrush to apply to stroking
stroking_paramsstroking parameters to apply to stroking
pathPath to stroke
stroke_stylehow to stroke the path
apply_shader_anti_aliasingif true, stroke with shader-based anti-aliasing
stroking_methodstroking method to use
effectif non-null, apply the given PathEffect on stroking

Definition at line 1357 of file painter.hpp.

◆ stroke_path() [1/3]

void fastuidraw::Painter::stroke_path ( const PainterStrokeShader shader,
const PainterData draw,
const Path path,
const StrokingStyle stroke_style = StrokingStyle(),
bool  apply_shader_anti_aliasing = true,
enum stroking_method_t  stroking_method = stroking_method_fastest,
const PathEffect effect = nullptr 
)

Stroke a path.

Parameters
shadershader with which to stroke the attribute data
drawdata for how to draw
pathPath to stroke
stroke_stylehow to stroke the path
apply_shader_anti_aliasingif true, stroke with shader-based anti-aliasing
stroking_methodstroking method to use
effectif non-null, apply the given PathEffect on stroking

◆ stroke_path() [2/3]

void fastuidraw::Painter::stroke_path ( const PainterData draw,
const Path path,
const StrokingStyle stroke_style = StrokingStyle(),
bool  apply_shader_anti_aliasing = true,
enum stroking_method_t  stroking_method = stroking_method_fastest,
const PathEffect effect = nullptr 
)

Stroke a path using PainterShaderSet::stroke_shader() of default_shaders().

Parameters
drawdata for how to draw
pathPath to stroke
stroke_stylehow to stroke the path
apply_shader_anti_aliasingif true, stroke with shader-based anti-aliasing
stroking_methodstroking method to use
effectif non-null, apply the given PathEffect on stroking

◆ stroke_path() [3/3]

void fastuidraw::Painter::stroke_path ( const PainterBrush brush,
const PainterStrokeParams stroking_params,
const Path path,
const StrokingStyle stroke_style = StrokingStyle(),
bool  apply_shader_anti_aliasing = true,
enum stroking_method_t  stroking_method = stroking_method_fastest,
const PathEffect effect = nullptr 
)
inline

Provided as a conveniance, equivalent to

stroke_path(PainterData(&brush, &stroking_params), path,
stroke_style, apply_shader_anti_aliasing,
stroking_method, effect);
Parameters
brushbrush to apply to stroking
stroking_paramsstroking parameters to apply to stroking
pathPath to stroke
stroke_stylehow to stroke the path
apply_shader_anti_aliasingif true, stroke with shader-based anti-aliasing
stroking_methodstroking method to use
effectif non-null, apply the given PathEffect on stroking

Definition at line 1296 of file painter.hpp.

◆ surface()

const reference_counted_ptr<PainterSurface>& fastuidraw::Painter::surface ( void  ) const

Returns the PainterSurface to which the Painter is drawing. If there is no active surface, then returns a null reference.

◆ transformation() [1/2]

void fastuidraw::Painter::transformation ( const float3x3 m)

Sets the transformation matrix

Parameters
mnew value for transformation matrix

◆ transformation() [2/2]

const float3x3& fastuidraw::Painter::transformation ( void  )

Returns the value of the current transformation.

◆ translate()

void fastuidraw::Painter::translate ( const vec2 p)

Concats the current transformation matrix with a translation

Parameters
ptranslation by which to translate

The documentation for this class was generated from the following file: