FastUIDraw
painter.hpp
Go to the documentation of this file.
1 /*!
2  * \file painter.hpp
3  * \brief file painter.hpp
4  *
5  * Copyright 2016 by Intel.
6  *
7  * Contact: kevin.rogovin@gmail.com
8  *
9  * This Source Code Form is subject to the
10  * terms of the Mozilla Public License, v. 2.0.
11  * If a copy of the MPL was not distributed with
12  * this file, You can obtain one at
13  * http://mozilla.org/MPL/2.0/.
14  *
15  * \author Kevin Rogovin <kevin.rogovin@gmail.com>
16  *
17  */
18 
19 
20 #ifndef FASTUIDRAW_PAINTER_HPP
21 #define FASTUIDRAW_PAINTER_HPP
22 
24 #include <fastuidraw/util/vecN.hpp>
28 
31 #include <fastuidraw/image.hpp>
32 #include <fastuidraw/path.hpp>
34 
42 
49 
52 
54 
55 namespace fastuidraw
56 {
57 /*!\addtogroup Painter
58  * @{
59  */
60 
61  /*!
62  * \brief
63  * Painter implements a canvas rendering interface.
64  *
65  * Painter implements:
66  * - stroking
67  * - filling
68  * - drawing text
69  * - applying a brush (see \ref PainterBrush)
70  * - blending (see \ref PainterEnums::blend_mode_t)
71  * - single 3x3 transformation
72  * - save and restore state
73  * - transparency layers
74  * - clipIn against Path, rectangle or rounded rectangle
75  * - clipOut against Path, rectangle or rounded rectangle
76  *
77  * The transformation of a Painter goes from local item coordinate
78  * to 3D API clip-coordinates (for example in GL, from item coordinates
79  * to gl_Position.xyw). FastUIDraw follows the convention that the top
80  * of the window is at normalized y-coordinate -1 and the bottom of the
81  * window is at normalized y-coordinate +1. The transformation is to be
82  * applied as matrix-vector multiplication, i.e.
83  * \code
84  * ClipCoordinates = transformation() * vec3(x, y, 1.0)
85  * \endcode
86  * for local coordiante (x, y). Normalized device coordinates are
87  * defined as
88  * \code
89  * NormalizedDeviceCoordinates = ClipCoordinates.xy / ClipCoordinates.w
90  * \endcode
91  * where (-1, -1) corresponds to the bottom-left hand corner of the
92  * viewport (see PainterSurface::viewport()) and (+1, +1)
93  * is the top right hand corner of the viewport.
94  *
95  * The pixel pipeline of Painter is
96  * - Compute RGBA value from item shader (typically this is (0, 0, 0, alpha)
97  * where alpha is a coverage value
98  * - Modulate by the PainterBrush passing the item coordinates
99  * of the pixel to the \ref PainterBrush
100  * - Apply blending (see PainterEnums::blend_mode_t and
101  * Painter::blend_shader()) to the RGBA value against the
102  * current value in the framebuffer
103  *
104  * Painter uses clip-planes and the depth buffer to perform clipping.
105  * The depth-buffer clips by occluding elements. For example, the
106  * method clip_out_rect() simply draws a rectangle so that it does
107  * not affect the color buffer but with a depth value that is infront
108  * of the elements that it is to occlude. Painter uses the convention
109  * that elements with greater than or equal depth values are visible
110  * (for example in GL this corresponds to the depth test being set to
111  * GL_GEQUAL). Unless an item occludes (or self occludes), the current
112  * active depth value is unaffected. An item's vertex shader will emit
113  * a relative z-value (i.e. relative to the item) which is then
114  * incremented by the current z-value of the \ref Painter.
115  *
116  * A Painter is a HEAVY object (it creates pools of buffers during its
117  * lifetime for reuse). As such, one should reuse Painter objects as
118  * much as reasonably possible.
119  */
120  class Painter:
121  public PainterEnums,
122  public reference_counted<Painter>::concurrent
123  {
124  public:
125  /*!
126  * \brief
127  * A \ref GlyphRendererChooser provides an interface for
128  * choosing how to render glyphs depending on the current
129  * transformation matrix, \ref Painter::transformation().
130  */
132  {
133  public:
134  virtual
136  {}
137 
138  /*!
139  * To be implemented by a derived class to choose
140  * what GlyphRender to use when the transformation
141  * matrix (see Painter::transformation()) does not
142  * have perspective.
143  * \param logical_format_size the format size at which
144  * the glyphs of a GlyphRun
145  * or GlyphSequence are
146  * formatted
147  * \param transformation the transformation matrix from
148  * logical (i.e. item) coordinates
149  * to normalized device coordinates,
150  * i.e. the value of \ref
151  * Painter::transformation().
152  * \param viewport_size width and height of the
153  * \param max_singular_value the largest singluar value
154  * the transformation matrix
155  * concacted with the viewport
156  * transformation
157  * \param min_singular_value the smallest singluar value
158  * the transformation matrix
159  * concacted with the viewport
160  * transformation
161  */
162  virtual
164  choose_glyph_render(float logical_format_size,
165  const float3x3 &transformation,
166  vec2 viewport_size,
167  float max_singular_value,
168  float min_singular_value) const = 0;
169 
170  /*!
171  * To be implemented by a derived class to choose
172  * what GlyphRender to use when the transformation
173  * matrix (see Painter::transformation()) has
174  * perspective.
175  * \param logical_format_size the pixel size at which
176  * the glyphs of a GlyphRun
177  * or GlyphSequence are
178  * formatted
179  * \param transformation the transformation matrix from
180  * logical (i.e. item) coordinates
181  * to normalized device coordinates,
182  * i.e. the value of \ref
183  * Painter::transformation().
184  * \param viewport_size width and height of the
185  */
186  virtual
188  choose_glyph_render(float logical_format_size,
189  const float3x3 &transformation,
190  vec2 viewport_size) const = 0;
191  };
192 
193  /*!
194  * \brief
195  * A \ref NormalizedCoordRect is used to specify a rectangle
196  * in -normalized- device coordinates. Recall that normalized
197  * device coordinates hae that the bottom-left is (-1, 1) and
198  * the top right is (+1, +1) ALWAYS.
199  */
201  {
202  public:
203  /*!
204  * The actual values of the rect.
205  */
207  };
208 
209  /*!
210  * Ctor.
211  * \param backend \ref PainterEngine object from which via
212  * \ref PainterEngine::create_backend(), the
213  * created \ref Painter object will use for its
214  * entire lifetime.
215  */
216  explicit
218 
219  ~Painter(void);
220 
221  /*!
222  * Returns a reference to the \ref GlyphAtlas of
223  * this \ref Painter. All glyphs used by this \ref
224  * Painter must live on glyph_atlas().
225  */
226  GlyphAtlas&
227  glyph_atlas(void) const;
228 
229  /*!
230  * Returns a reference to the \ref ImageAtlas of of
231  * this \ref Painter. All images used by this \ref
232  * Painter must live on image_atlas().
233  */
234  ImageAtlas&
235  image_atlas(void) const;
236 
237  /*!
238  * Returns a reference to the ColorStopAtlas of this
239  * \ref Painter. All color stops used by all brushes
240  * of this \ref Painter must live on colorstop_atlas().
241  */
243  colorstop_atlas(void) const;
244 
245  /*!
246  * Returns a handle to the \ref GlyphCache made
247  * from glyph_atlas().
248  */
249  GlyphCache&
250  glyph_cache(void) const;
251 
252  /*!
253  * Returns the PainterShaderRegistrar of the PainterBackend
254  * used by this Painter object. Use this return value to add
255  * custom shaders. NOTE: shaders added within a thread are
256  * not useable within that thread until the next call to
257  * begin().
258  */
260  painter_shader_registrar(void) const;
261 
262  /*!
263  * Returns the PainterPackedValuePool used to construct
264  * PainterPackedValue objects.
265  */
267  packed_value_pool(void);
268 
269  /*!
270  * Returns the active blend shader
271  */
273  blend_shader(void) const;
274 
275  /*!
276  * Returns the active 3D API blend mode
277  */
278  BlendMode
279  blend_mode(void) const;
280 
281  /*!
282  * Sets the blend shader.
283  * \param h blend shader to use for blending.
284  * \param blend_mode 3D API blend mode
285  */
286  void
289 
290  /*!
291  * Equivalent to
292  * \code
293  * blend_shader(shader_set.shader(m), shader_set.blend_mode(m))
294  * \endcode
295  * It is a crashing error if shader_set does not support
296  * the named blend mode.
297  * \param shader_set PainterBlendShaderSet from which to take blend shader
298  * \param m Blend mode to use
299  */
300  void
302  enum blend_mode_t m)
303  {
304  blend_shader(shader_set.shader(m), shader_set.blend_mode(m));
305  }
306 
307  /*!
308  * Equivalent to
309  * \code
310  * blend_shader(default_shaders().blend_shaders(), m)
311  * \endcode
312  * \param m Blend mode to use
313  */
314  void
316  {
317  blend_shader(default_shaders().blend_shaders(), m);
318  }
319 
320  /*!
321  * Indicate to start drawing with methods of this Painter. The
322  * transformation matrix will be intialized with given float3x3.
323  * Drawing commands sent to 3D hardware are buffered and not sent
324  * to the hardware until end() is called. All draw commands must
325  * be between a begin()/end() pair.
326  * \param surface the \ref PainterSurface to which to render content
327  * \param initial_transformation value to initialize transformation() which
328  * is the matrix from logical coordinates to
329  * API 3D clip coordinates.
330  * \param clear_color_buffer if true, clear the color buffer on the viewport
331  * of the surface.
332  */
333  void
335  const float3x3 &initial_transformation,
336  bool clear_color_buffer = true);
337 
338  /*!
339  * Indicate to start drawing with methods of this Painter. The
340  * ransformation matrix will be intialized with a projection
341  * matrix derived from the passed screen_orientation
342  * and the viewort of the passed PainterSurface. Drawing
343  * commands sent to 3D hardware are buffered and not sent to the
344  * hardware until end() is called. All draw commands must be between
345  * a begin()/end() pair.
346  * \param surface the \ref PainterSurface to which to render content
347  * \param orientation orientation convention with which to initialize the
348  * transformation
349  * \param clear_color_buffer if true, clear the color buffer on the viewport
350  * of the surface.
351  */
352  void
354  enum screen_orientation orientation,
355  bool clear_color_buffer = true);
356 
357  /*!
358  * Indicate to end drawing with methods of this Painter.
359  * Drawing commands sent to 3D hardware are buffered and not
360  * sent to hardware until end() is called. Returns the
361  * list of surfaces used for offscreen rendering within
362  * the begin()/end() pair; these surfaces are -owned- by
363  * the Painter and their contents are potentially changed
364  * (or even the object destroyed) on the next call to
365  * begin(). All draw commands must be between a begin()/end()
366  * pair.
367  */
369  end(void);
370 
371  /*!
372  * Flushes the rendering and flushes the rendering commands
373  * to the 3D API and maintain using the current PainterSurface.
374  * It is not possible to flush if the Painter is within a
375  * begin_layer()/end_layer() pair or if it is within a
376  * begin_coverage_buffer()/end_coverage_buffer() pair.
377  * Returns \ref routine_success if flush was executed and
378  * \ref routine_fail if not.
379  */
380  enum return_code
381  flush(void);
382 
383  /*!
384  * Flushes the rendering and flushes the rendering commands
385  * to the 3D API and shift to using a the passed surface;
386  * the surface's viewport dimensions MUST match the
387  * current surface's viewport dimensions, i.e. the value
388  * of PainterSurface::viewport().m_dimensions surface() and
389  * the passed PainterSurface must match. It is not possible
390  * if the Painter is within a begin_layer()/end_layer() pair
391  * or if it is within a begin_coverage_buffer()/end_coverage_buffer()
392  * pair. Returns \ref routine_success if flush was executed
393  * and \ref routine_fail if not.
394  */
395  enum return_code
396  flush(const reference_counted_ptr<PainterSurface> &new_surface);
397 
398  /*!
399  * Everytime Painter generates attribute/index data to
400  * be sent to the 3D API, this counter is incremented.
401  * The value is essentially equivalent to the number of
402  * times draw_generic() is called (directly or indirectly
403  * through other methods). The counter is reset when
404  * begin() is called.
405  */
406  unsigned int
407  draw_data_added_count(void) const;
408 
409  /*!
410  * Returns the PainterSurface to which the Painter
411  * is drawing. If there is no active surface, then returns
412  * a null reference.
413  */
415  surface(void) const;
416 
417  /*!
418  * Concats the current transformation matrix
419  * by a given matrix.
420  * \param tr transformation by which to concat
421  */
422  void
423  concat(const float3x3 &tr);
424 
425  /*!
426  * Sets the transformation matrix
427  * \param m new value for transformation matrix
428  */
429  void
430  transformation(const float3x3 &m);
431 
432  /*!
433  * Concats the current transformation matrix
434  * with a translation
435  * \param p translation by which to translate
436  */
437  void
438  translate(const vec2 &p);
439 
440  /*!
441  * Concats the current transformation matrix
442  * with a scaleing.
443  * \param s scaling factor by which to scale
444  */
445  void
446  scale(float s);
447 
448  /*!
449  * Concats the current transformation matrix
450  * with a rotation.
451  * \param angle angle by which to rotate in radians.
452  */
453  void
454  rotate(float angle);
455 
456  /*!
457  * Concats the current transformation matrix
458  * with a shear.
459  * \param sx scaling factor in x-direction to apply
460  * \param sy scaling factor in y-direction to apply
461  */
462  void
463  shear(float sx, float sy);
464 
465  /*!
466  * Returns the value of the current transformation.
467  */
468  const float3x3&
469  transformation(void);
470 
471  /*!
472  * Returns the current clip-equations of the Painter.
473  * The clip-equations are updated whenever clip_in_rect()
474  * or clip_in_path() or restore() are called, as such
475  * the returned c_array then becomes invalid. The equations
476  * are in -CLIP- coordinates, thus do not change when
477  * the transformation changes.
478  */
480  clip_equations(void);
481 
482  /*!
483  * Returns the convex polygon embodied by clip_equations().
484  * The value changes whenever clip_in_rect(), clip_in_path()
485  * or restore() are called, as such the returned c_array
486  * then becomes invalid. The coordinates are in -CLIP-
487  * coordinates, thus do not change when the transformation
488  * changes.
489  */
491  clip_polygon(void);
492 
493  /*!
494  * If the clipping region is non-empty, returns true
495  * and writes the min and max corner of the bounding box
496  * in normalized device coordinates of the clipping region.
497  * \param min_pt location to which to write the minimum corner point
498  * \param max_pt location to which to write the maximum corner point
499  */
500  bool
501  clip_region_bounds(vec2 *min_pt, vec2 *max_pt);
502 
503  /*!
504  * If the clipping region is non-empty, returns true
505  * and writes the min and max corner of the bounding box
506  * in local coordinates of the clipping region.
507  * \param min_pt location to which to write the minimum corner point
508  * \param max_pt location to which to write the maximum corner point
509  */
510  bool
511  clip_region_logical_bounds(vec2 *min_pt, vec2 *max_pt);
512 
513  /*!
514  * Set clipping to the intersection of the current
515  * clipping with a rectangle.
516  * \param rect clip-in rectangle
517  */
518  void
519  clip_in_rect(const Rect &rect);
520 
521  /*!
522  * Set clipping to the intersection of the current
523  * clipping with a rounded rectangle.
524  * \param R rounded rectangle
525  */
526  void
528 
529  /*!
530  * Clip-out by a path, i.e. set the clipping to be
531  * the intersection of the current clipping against
532  * the -complement- of the fill of a path.
533  * \param path path by which to clip out
534  * \param fill_rule fill rule to apply to path
535  */
536  void
537  clip_out_path(const Path &path, enum fill_rule_t fill_rule);
538 
539  /*!
540  * Clip-out by a path, i.e. set the clipping to be
541  * the intersection of the current clipping against
542  * the -complement- of the fill of a path.
543  * \param path path by which to clip out
544  * \param fill_rule fill rule to apply to path
545  */
546  void
547  clip_out_path(const FilledPath &path, enum fill_rule_t fill_rule);
548 
549  /*!
550  * Clip-in by a path, i.e. set the clipping to be
551  * the intersection of the current clipping against
552  * the the fill of a path.
553  * \param path path by which to clip out
554  * \param fill_rule fill rule to apply to path
555  */
556  void
557  clip_in_path(const Path &path, enum fill_rule_t fill_rule);
558 
559  /*!
560  * Clip-in by a path, i.e. set the clipping to be
561  * the intersection of the current clipping against
562  * the the fill of a path.
563  * \param path path by which to clip out
564  * \param fill_rule fill rule to apply to path
565  */
566  void
567  clip_in_path(const FilledPath &path, enum fill_rule_t fill_rule);
568 
569  /*!
570  * Clip-out by a path, i.e. set the clipping to be
571  * the intersection of the current clipping against
572  * the -complement- of the fill of a path.
573  * \param path path by which to clip out
574  * \param fill_rule custom fill rule to apply to path
575  */
576  void
577  clip_out_path(const Path &path, const CustomFillRuleBase &fill_rule);
578 
579  /*!
580  * Clip-out by a path, i.e. set the clipping to be
581  * the intersection of the current clipping against
582  * the -complement- of the fill of a path.
583  * \param path path by which to clip out
584  * \param fill_rule custom fill rule to apply to path
585  */
586  void
587  clip_out_path(const FilledPath &path, const CustomFillRuleBase &fill_rule);
588 
589  /*!
590  * Clip-in by a path, i.e. set the clipping to be
591  * the intersection of the current clipping against
592  * the the fill of a path.
593  * \param path path by which to clip out
594  * \param fill_rule custom fill rule to apply to path
595  */
596  void
597  clip_in_path(const Path &path, const CustomFillRuleBase &fill_rule);
598 
599  /*!
600  * Clip-in by a path, i.e. set the clipping to be
601  * the intersection of the current clipping against
602  * the the fill of a path.
603  * \param path path by which to clip out
604  * \param fill_rule custom fill rule to apply to path
605  */
606  void
607  clip_in_path(const FilledPath &path, const CustomFillRuleBase &fill_rule);
608 
609  /*!
610  * Clipout by a rect
611  * \param rect clip-out rectangle
612  */
613  void
614  clip_out_rect(const Rect &rect);
615 
616  /*!
617  * Set clipping to the intersection of the current
618  * clipping with the complement of a rounded rectangle.
619  * \param R rounded rectangle
620  */
621  void
623 
624  /*!
625  * Clipout by a convex polygon
626  * \param poly points of the convex polygon
627  */
628  void
630 
631  /*!
632  * Clipout by custom data.
633  * \param shader shader with which to draw the attribute/index data
634  * \param shader_data shader data to pass to shader
635  * \param attrib_chunks attribute data to draw
636  * \param index_chunks the i'th element is index data into attrib_chunks[i]
637  * \param index_adjusts if non-empty, the i'th element is the value by which
638  * to adjust all of index_chunks[i]; if empty the index
639  * values are not adjusted.
640  * \param attrib_chunk_selector selects which attribute chunk to use for
641  * each index chunk
642  */
643  void
645  const PainterDataValue<PainterItemShaderData> &shader_data,
646  c_array<const c_array<const PainterAttribute> > attrib_chunks,
647  c_array<const c_array<const PainterIndex> > index_chunks,
648  c_array<const int> index_adjusts,
649  c_array<const unsigned int> attrib_chunk_selector);
650 
651  /*!
652  * Clipout by custom data.
653  * \param shader shader with which to draw the attribute/index data
654  * \param shader_data shader data to pass to shader
655  * \param attrib_chunks attribute data to draw
656  * \param index_chunks the i'th element is index data into attrib_chunks[i]
657  * \param index_adjusts if non-empty, the i'th element is the value by which
658  * to adjust all of index_chunks[i]; if empty the index
659  * values are not adjusted.
660  */
661  void
663  const PainterDataValue<PainterItemShaderData> &shader_data,
664  c_array<const c_array<const PainterAttribute> > attrib_chunks,
665  c_array<const c_array<const PainterIndex> > index_chunks,
666  c_array<const int> index_adjusts)
667  {
668  clip_out_custom(shader, shader_data,
669  attrib_chunks, index_chunks, index_adjusts,
671  }
672 
673  /*!
674  * Clipout by custom data.
675  * \param shader shader with which to draw the attribute/index data
676  * \param shader_data shader data to pass to shader
677  * \param attrib_chunk attribute data to draw
678  * \param index_chunk index data into attrib_chunk
679  * \param index_adjust amount by which to adjust the values in index_chunk
680  */
681  void
683  const PainterDataValue<PainterItemShaderData> &shader_data,
684  c_array<const PainterAttribute> attrib_chunk,
685  c_array<const PainterIndex> index_chunk,
686  int index_adjust = 0)
687  {
688  vecN<c_array<const PainterAttribute>, 1> aa(attrib_chunk);
689  vecN<c_array<const PainterIndex>, 1> ii(index_chunk);
690  vecN<int, 1> ia(index_adjust);
691  clip_out_custom(shader, shader_data, aa, ii, ia);
692  }
693 
694  /*!
695  * Set the curve flatness requirement for TessellatedPath
696  * selection when stroking or filling paths when passing
697  * to drawing methods a Path object. The value represents
698  * the distance, in pixels, requested for between the
699  * approximated curve (realized in TessellatedPath) and
700  * the true curve (realized in Path). This value is combined
701  * with a value derived from the current transformation
702  * matrix to pass to Path::tessellation(float) to fetch a
703  * \ref TessellatedPath. Default value is 0.5.
704  */
705  void
706  curve_flatness(float thresh);
707 
708  /*!
709  * Returns the value set by curve_flatness(float).
710  */
711  float
712  curve_flatness(void);
713 
714  /*!
715  * Save the current state of this Painter onto the save state stack.
716  * The state is restored (and the stack popped) by called restore().
717  * The state saved is:
718  * - transformation state (see concat(), transformation(), translate(),
719  * shear(), scale(), rotate())
720  * - clip state (see clip_in_rect(), clip_out_path(), clip_in_path())
721  * - curve flatness requirement (see curve_flatness(float))
722  * - blend shader (see blend_shader())
723  * - blend mode (see blend_mode())
724  * NOTE: it is an error (that is silently ignored) to end a
725  * transparency layer (see begin_layer() and end_layer())
726  * within a save()/restore() pair that was not started within
727  * that same save()/restore() pair. In addition, it is also
728  * an error to not end a layer within a save()/restore() pair
729  * that was started in the that same save()/restore() pair.
730  * The same rules apply to coverage buffers (see begin_coverage_buffer()
731  * and end_coverage_buffer()).
732  */
733  void
734  save(void);
735 
736  /*!
737  * Restore the state of this Painter to the state
738  * it had from the last call to save().
739  */
740  void
741  restore(void);
742 
743  /*!
744  * Begin an FX layer. This marks first rendering into an
745  * offscreen buffer and then blitting the buffer with the
746  * passed FX applied. The buffer will be blitted with the
747  * blend_shader(), and blend_mode() at the time of the call
748  * to begin_layer(). All restore() commands called after a
749  * begin_layer() must match a save() from after a begin_layer().
750  * It is acceptable to layer any number of begin_layer() calls
751  * as well.
752  * \param effect effect to apply
753  * \param effect_params effect parameters for the effect
754  */
755  void
757  PainterEffectParams &effect_params);
758 
759  /*!
760  * Begin a transparency layer. This marks first
761  * rendering into an offscreen buffer and then
762  * blitting the buffer. The buffer will be blitted
763  * with the blend_shader(), and blend_mode()
764  * at the time of the call to begin_layer(). All
765  * restore() commands called after a begin_layer()
766  * must match a save() from after a begin_layer().
767  * It is acceptable to layer any number of begin_layer()
768  * calls as well.
769  * \param color_modulate color value by which to modulate
770  * the layer when it is to be blitted
771  */
772  void
773  begin_layer(const vec4 &color_modulate);
774 
775  /*!
776  * Provided as a conveniance, equivalent to
777  * \code
778  * begin_layer(vec4(1.0f, 1.0f, 1.0f, alpha));
779  * \endcode
780  * \param alpha alpha value for color modulation.
781  */
782  void
783  begin_layer(float alpha)
784  {
785  begin_layer(vec4(1.0f, 1.0f, 1.0f, alpha));
786  }
787 
788  /*!
789  * End the current transparency layer and blit
790  * the layer.
791  */
792  void
793  end_layer(void);
794 
795  /*!
796  * Begin a deferred coverage buffer layer. A deferred
797  * coverage buffer is needed for those \ref PainterItemShader
798  * values for which PainterItemShader::coverage_shader()
799  * is non-null. When a coverage buffer is active, those
800  * \ref PainterItemCoverageShader will render to the
801  * current deferred coverage buffer and the \ref
802  * PainterItemShader will read from it for its rendering.
803  * This starts a coverage buffer layer region of the
804  * size of the bounding box of the current clip-region.
805  * It is strongly suggested to use
806  * begin_coverage_buffer(const Rect&, float, float) or \ref
807  * begin_coverage_buffer(const NormalizedCoordRect&, float)
808  * to limit the size of the coverage buffer.
809  */
810  void
811  begin_coverage_buffer(void);
812 
813  /*!
814  * Acts the same as begin_coverage_buffer(void), but
815  * limits the coverage buffer to the bounding box
816  * of the intersection of the current clipping region
817  * with the passed rectangle.
818  * \param logical_rect rectangle in LOGICAL coordinates,
819  * i.e. before transformation() is
820  * applied.
821  * \param additional_pixel_slack inflate the coverage buffer
822  * region by this many pixels on
823  * each side
824  * \param additional_item_slack inflate the coverage buffer
825  * region by this amount in logical
826  * coordinates
827  */
828  void
829  begin_coverage_buffer(const Rect &logical_rect,
830  float additional_pixel_slack = 0.0f,
831  float additional_item_slack = 0.0f);
832 
833  /*!
834  * Acts the same as begin_coverage_buffer(void), but
835  * limits the coverage buffer to the bounding box
836  * of the intersection of the current clipping region
837  * with the passed rectangle.
838  * \param normalized_rect rectangle in NORMALIZED DEVICE
839  * coordinates, i.e. after \ref
840  * transformation() is applied.
841  * \param additional_pixel_slack inflate the coverage buffer
842  * region by this many pixels on
843  * each side
844  */
845  void
846  begin_coverage_buffer(const NormalizedCoordRect &normalized_rect,
847  float additional_pixel_slack = 0.0f);
848 
849  /*!
850  * End the current coverage buffer.
851  */
852  void
853  end_coverage_buffer(void);
854 
855  /*!
856  * Return the default shaders for common drawing types.
857  */
858  const PainterShaderSet&
859  default_shaders(void) const;
860 
861  /*!
862  * Returns the default \ref GlyphRendererChooser
863  * object that Painter uses.
864  */
865  const GlyphRendererChooser&
866  default_glyph_renderer_chooser(void) const;
867 
868  /*!
869  * Feed a logical pixel size and the current transformation
870  * to default_glyph_renderer_chooser() to compute how to
871  * render glyphs.
872  * \param pixel_size size of text to render BEFORE
873  * applying the transformation matrix.
874  */
876  compute_glyph_renderer(float pixel_size);
877 
878  /*!
879  * Feed a logical pixel size and the current transformation
880  * to a \ref GlyphRendererChooser to compute how to render
881  * glyphs.
882  * \param pixel_size size of text to render BEFORE
883  * applying the transformation matrix.
884  * \param chooser object that chooses how to render glyphs
885  */
887  compute_glyph_renderer(float pixel_size,
888  const GlyphRendererChooser &chooser);
889 
890  /*!
891  * Draw glyphs from a \ref GlyphSequence.
892  * \param shader \ref PainterGlyphShader to draw the glyphs
893  * \param draw data for how to draw
894  * \param glyph_sequence \ref GlyphSequence providing glyphs
895  * \param renderer how to render the glyphs. If GlyphRenderer::valid() is false,
896  * then the Painter will use default_glyph_renderer_chooser()
897  * to choose the renderer
898  * \return Returns what \ref GlyphRenderer value used
899  */
901  draw_glyphs(const PainterGlyphShader &shader, const PainterData &draw,
902  const GlyphSequence &glyph_sequence,
904 
905  /*!
906  * Draw glyphs from a \ref GlyphSequence.
907  * \param draw data for how to draw
908  * \param glyph_sequence \ref GlyphSequence providing glyphs
909  * \param renderer how to render the glyphs. If GlyphRenderer::valid() is false,
910  * then the Painter will use default_glyph_renderer_chooser()
911  * to choose the renderer
912  * \return Returns what \ref GlyphRenderer value used
913  */
915  draw_glyphs(const PainterData &draw, const GlyphSequence &glyph_sequence,
917 
918  /*!
919  * Draw glyphs from a \ref GlyphSequence.
920  * \code
921  * draw_glyphs(PainterData(&brush), glyph_sequence, renderer);
922  * \endcode
923  * \param brush brush to apply to stroking
924  * \param glyph_sequence \ref GlyphSequence providing glyphs
925  * \param renderer how to render the glyphs. If GlyphRenderer::valid() is false,
926  * then the Painter will use default_glyph_renderer_chooser()
927  * to choose the renderer
928  * \return Returns what \ref GlyphRenderer value used
929  */
931  draw_glyphs(const PainterBrush &brush, const GlyphSequence &glyph_sequence,
933  {
934  return draw_glyphs(PainterData(&brush), glyph_sequence, renderer);
935  }
936 
937  /*!
938  * Draw glyphs from a \ref GlyphSequence.
939  * \param shader \ref PainterGlyphShader to draw the glyphs
940  * \param draw data for how to draw
941  * \param glyph_sequence \ref GlyphSequence providing glyphs
942  * \param renderer_chooser \ref GlyphRendererChooser to use to choose how
943  * to render the glyphs.
944  * \return Returns what \ref GlyphRenderer value used
945  */
947  draw_glyphs(const PainterGlyphShader &shader, const PainterData &draw,
948  const GlyphSequence &glyph_sequence,
949  const GlyphRendererChooser &renderer_chooser);
950 
951  /*!
952  * Draw glyphs from a \ref GlyphSequence.
953  * and the data of the passed \ref GlyphSequence.
954  * \param draw data for how to draw
955  * \param glyph_sequence \ref GlyphSequence providing glyphs
956  * \param renderer_chooser \ref GlyphRendererChooser to use to choose how
957  * to render the glyphs.
958  * \return Returns what \ref GlyphRenderer value used
959  */
961  draw_glyphs(const PainterData &draw, const GlyphSequence &glyph_sequence,
962  const GlyphRendererChooser &renderer_chooser);
963 
964  /*!
965  * Draw glyphs from a \ref GlyphSequence.
966  * \code
967  * draw_glyphs(PainterData(&brush), glyph_sequence, renderer_chooser);
968  * \endcode
969  * \param brush brush to apply to text
970  * \param glyph_sequence \ref GlyphSequence providing glyphs
971  * \param renderer_chooser \ref GlyphRendererChooser to use to choose how
972  * to render the glyphs.
973  * \return Returns what \ref GlyphRenderer value used
974  */
976  draw_glyphs(const PainterBrush &brush, const GlyphSequence &glyph_sequence,
977  const GlyphRendererChooser &renderer_chooser)
978  {
979  return draw_glyphs(PainterData(&brush), glyph_sequence, renderer_chooser);
980  }
981 
982  /*!
983  * Draw glyphs from a \ref GlyphRun.
984  * \param shader \ref PainterGlyphShader to draw the glyphs
985  * \param draw data for how to draw
986  * \param glyph_run \ref GlyphRun providing glyphs
987  * \param renderer how to render the glyphs. If GlyphRenderer::valid() is false,
988  * then the Painter will use default_glyph_renderer_chooser()
989  * to choose the renderer
990  * \param begin first character of GlyphRun to draw
991  * \param count number of characters, startng at begin, of the GlyphRun to draw
992  * \return Returns what \ref GlyphRenderer value used
993  */
995  draw_glyphs(const PainterGlyphShader &shader, const PainterData &draw,
996  const GlyphRun &glyph_run,
997  unsigned int begin, unsigned int count,
999 
1000  /*!
1001  * Draw glyphs from a \ref GlyphRun.
1002  * and the data of the passed \ref GlyphRun.
1003  * \param draw data for how to draw
1004  * \param glyph_run \ref GlyphRun providing glyphs
1005  * \param renderer how to render the glyphs. If GlyphRenderer::valid() is false,
1006  * then the Painter will use default_glyph_renderer_chooser()
1007  * to choose the renderer
1008  * \param begin first character of GlyphRun to draw
1009  * \param count number of characters, startng at begin, of the GlyphRun to draw
1010  * \return Returns what \ref GlyphRenderer value used
1011  */
1013  draw_glyphs(const PainterData &draw, const GlyphRun &glyph_run,
1014  unsigned int begin, unsigned int count,
1016 
1017  /*!
1018  * Draw glyphs from a \ref GlyphRun.
1019  * and the data of the passed \ref GlyphRun.
1020  * \code
1021  * draw_glyphs(PainterData(&brush), glyph_run, begin, count, renderer);
1022  * \endcode
1023  * \param brush brush to apply to text
1024  * \param glyph_run \ref GlyphRun providing glyphs
1025  * \param renderer how to render the glyphs. If GlyphRenderer::valid() is false,
1026  * then the Painter will use default_glyph_renderer_chooser()
1027  * to choose the renderer
1028  * \param begin first character of GlyphRun to draw
1029  * \param count number of characters, startng at begin, of the GlyphRun to draw
1030  * \return Returns what \ref GlyphRenderer value used
1031  */
1033  draw_glyphs(const PainterBrush &brush, const GlyphRun &glyph_run,
1034  unsigned int begin, unsigned int count,
1036  {
1037  return draw_glyphs(PainterData(&brush), glyph_run, begin, count, renderer);
1038  }
1039 
1040  /*!
1041  * Draw all glyphs from a \ref GlyphRun.
1042  * \param shader \ref PainterGlyphShader to draw the glyphs
1043  * \param draw data for how to draw
1044  * \param glyph_run \ref GlyphRun providing glyphs
1045  * \param renderer how to render the glyphs. If GlyphRenderer::valid() is false,
1046  * then the Painter will use default_glyph_renderer_chooser()
1047  * to choose the renderer
1048  * \return Returns what \ref GlyphRenderer value used
1049  */
1051  draw_glyphs(const PainterGlyphShader &shader, const PainterData &draw,
1052  const GlyphRun &glyph_run,
1054 
1055  /*!
1056  * Draw all glyphs from a \ref GlyphRun.
1057  * and the data of the passed \ref GlyphRun.
1058  * \param draw data for how to draw
1059  * \param glyph_run \ref GlyphRun providing glyphs
1060  * \param renderer how to render the glyphs. If GlyphRenderer::valid() is false,
1061  * then the Painter will use default_glyph_renderer_chooser()
1062  * to choose the renderer
1063  * \return Returns what \ref GlyphRenderer value used
1064  */
1066  draw_glyphs(const PainterData &draw, const GlyphRun &glyph_run,
1068 
1069  /*!
1070  * Draw glyphs from a \ref GlyphRun.
1071  * \code
1072  * draw_glyphs(PainterData(&brush), glyph_run, renderer);
1073  * \endcode
1074  * \param brush brush to apply to text
1075  * \param glyph_run \ref GlyphRun providing glyphs
1076  * \param renderer how to render the glyphs. If GlyphRenderer::valid() is false,
1077  * then the Painter will use default_glyph_renderer_chooser()
1078  * to choose the renderer
1079  * \return Returns what \ref GlyphRenderer value used
1080  */
1082  draw_glyphs(const PainterBrush &brush, const GlyphRun &glyph_run,
1084  {
1085  return draw_glyphs(PainterData(&brush), glyph_run, renderer);
1086  }
1087 
1088  /*!
1089  * Draw glyphs from a \ref GlyphRun.
1090  * \param shader \ref PainterGlyphShader to draw the glyphs
1091  * \param draw data for how to draw
1092  * \param glyph_run \ref GlyphRun providing glyphs
1093  * \param renderer_chooser \ref GlyphRendererChooser to use to choose how
1094  * to render the glyphs.
1095  * \param begin first character of GlyphRun to draw
1096  * \param count number of characters, startng at begin, of the GlyphRun to draw
1097  * \return Returns what \ref GlyphRenderer value used
1098  */
1100  draw_glyphs(const PainterGlyphShader &shader, const PainterData &draw,
1101  const GlyphRun &glyph_run,
1102  unsigned int begin, unsigned int count,
1103  const GlyphRendererChooser &renderer_chooser);
1104 
1105  /*!
1106  * Draw glyphs from a \ref GlyphRun.
1107  * and the data of the passed \ref GlyphRun.
1108  * \param draw data for how to draw
1109  * \param glyph_run \ref GlyphRun providing glyphs
1110  * \param renderer_chooser \ref GlyphRendererChooser to use to choose how
1111  * to render the glyphs.
1112  * \param begin first character of GlyphRun to draw
1113  * \param count number of characters, startng at begin, of the GlyphRun to draw
1114  * \return Returns what \ref GlyphRenderer value used
1115  */
1117  draw_glyphs(const PainterData &draw, const GlyphRun &glyph_run,
1118  unsigned int begin, unsigned int count,
1119  const GlyphRendererChooser &renderer_chooser);
1120  /*!
1121  * Draw glyphs from a \ref GlyphRun.
1122  * \code
1123  * draw_glyphs(PainterData(&brush), glyph_run, begin, count, renderer_chooser);
1124  * \endcode
1125  * \param brush brush to apply to text
1126  * \param glyph_run \ref GlyphRun providing glyphs
1127  * \param begin first character of GlyphRun to draw
1128  * \param count number of characters, startng at begin, of the GlyphRun to draw
1129  * \param renderer_chooser \ref GlyphRendererChooser to use to choose how
1130  * to render the glyphs.
1131  * \return Returns what \ref GlyphRenderer value used
1132  */
1134  draw_glyphs(const PainterBrush &brush, const GlyphRun &glyph_run,
1135  unsigned int begin, unsigned int count,
1136  const GlyphRendererChooser &renderer_chooser)
1137  {
1138  return draw_glyphs(PainterData(&brush), glyph_run, begin, count, renderer_chooser);
1139  }
1140 
1141  /*!
1142  * Draw all glyphs from a \ref GlyphRun.
1143  * \param shader \ref PainterGlyphShader to draw the glyphs
1144  * \param draw data for how to draw
1145  * \param glyph_run \ref GlyphRun providing glyphs
1146  * \param renderer_chooser \ref GlyphRendererChooser to use to choose how
1147  * to render the glyphs.
1148  * \return Returns what \ref GlyphRenderer value used
1149  */
1151  draw_glyphs(const PainterGlyphShader &shader, const PainterData &draw,
1152  const GlyphRun &glyph_run,
1153  const GlyphRendererChooser &renderer_chooser);
1154 
1155  /*!
1156  * Draw all glyphs from a \ref GlyphRun.
1157  * and the data of the passed \ref GlyphRun.
1158  * \param draw data for how to draw
1159  * \param glyph_run \ref GlyphRun providing glyphs
1160  * \param renderer_chooser \ref GlyphRendererChooser to use to choose how
1161  * to render the glyphs.
1162  * \return Returns what \ref GlyphRenderer value used
1163  */
1165  draw_glyphs(const PainterData &draw, const GlyphRun &glyph_run,
1166  const GlyphRendererChooser &renderer_chooser);
1167 
1168  /*!
1169  * Draw glyphs from a \ref GlyphRun.
1170  * \code
1171  * draw_glyphs(PainterData(&brush), glyph_run, renderer);
1172  * \endcode
1173  * \param brush brush to apply to text
1174  * \param glyph_run \ref GlyphRun providing glyphs
1175  * \param renderer_chooser \ref GlyphRendererChooser to use to choose how
1176  * to render the glyphs.
1177  * \return Returns what \ref GlyphRenderer value used
1178  */
1180  draw_glyphs(const PainterBrush &brush, const GlyphRun &glyph_run,
1181  const GlyphRendererChooser &renderer_chooser)
1182  {
1183  return draw_glyphs(PainterData(&brush), glyph_run, renderer_chooser);
1184  }
1185 
1186  /*!
1187  * Returns what value Painter currently uses for Path::tessellation(float) const
1188  * to fetch the \ref TessellatedPath from which it will fetch the \ref FilledPath
1189  * to perform a path fill.
1190  * \param path \ref Path to choose the thresh for
1191  */
1192  float
1193  compute_path_thresh(const Path &path);
1194 
1195  /*!
1196  * Returns what value Painter currently uses for Path::tessellation(float) const
1197  * to fetch the \ref TessellatedPath use to perform stroking and filling.
1198  * \param path \ref Path to choose the thresh for
1199  * \param shader_data data sent to stroking shader
1200  * \param selector object (see PainterStrokeShader::stroking_data_selector())
1201  * to use stroking parameters to help compute necessary thresh
1202  * \param[out] out_rounded_thresh location to which to write threshhold to be
1203  * used for rounded caps and joins of \ref
1204  * StrokedPath.
1205  */
1206  float
1207  compute_path_thresh(const Path &path,
1208  const c_array<const uvec4 > shader_data,
1210  float *out_rounded_thresh);
1211 
1212  /*!
1213  * Calls FilledPath::select_subsets() passing arguments derived from the
1214  * current state of the Painter.
1215  * \param path \ref FilledPath from which to compute subset selection
1216  * \param[out] dst location to which to write the FilledPath::Subset ID values
1217  * \returns the number of Subset object ID's written to dst, that
1218  * number is guaranteed to be no more than FilledPath::number_subsets().
1219  */
1220  unsigned int
1222 
1223  /*!
1224  * Calls PartitionedTessellatedPath::select_subsets() passing arguments
1225  * derived from the current state of the Painter.
1226  * \param path \ref PartitionedTessellatedPath from which to compute
1227  * subset selection
1228  * \param geometry_inflation amount path geometry is inflated, array
1229  * is indexed by the enumeration \ref
1230  * PathEnums::path_geometry_inflation_index_t
1231  * \param select_miter_joins if true, when selecting what joins are in
1232  * the area, enlarge the join footprint for if
1233  * the joins are stroked as a type of miter join.
1234  * \param[out] dst location to which to write the selection
1235  * \param[out] nrect if non-null, location to which to write the bounding
1236  * box of the selection. NOTE: if the selection is empty,
1237  * then the value writen will be an empty-rect point at
1238  * (0, 0).
1239  */
1240  void
1242  c_array<const float> geometry_inflation,
1243  bool select_miter_joins,
1245  NormalizedCoordRect *nrect);
1246 
1247  /*!
1248  * Stroke a path.
1249  * \param shader shader with which to stroke the attribute data
1250  * \param draw data for how to draw
1251  * \param path Path to stroke
1252  * \param stroke_style how to stroke the path
1253  * \param apply_shader_anti_aliasing if true, stroke with shader-based anti-aliasing
1254  * \param stroking_method stroking method to use
1255  * \param effect if non-null, apply the given \ref PathEffect on stroking
1256  */
1257  void
1258  stroke_path(const PainterStrokeShader &shader, const PainterData &draw, const Path &path,
1259  const StrokingStyle &stroke_style = StrokingStyle(),
1260  bool apply_shader_anti_aliasing = true,
1261  enum stroking_method_t stroking_method = stroking_method_fastest,
1262  const PathEffect *effect = nullptr);
1263 
1264  /*!
1265  * Stroke a path using PainterShaderSet::stroke_shader() of default_shaders().
1266  * \param draw data for how to draw
1267  * \param path Path to stroke
1268  * \param stroke_style how to stroke the path
1269  * \param apply_shader_anti_aliasing if true, stroke with shader-based anti-aliasing
1270  * \param stroking_method stroking method to use
1271  * \param effect if non-null, apply the given \ref PathEffect on stroking
1272  */
1273  void
1274  stroke_path(const PainterData &draw, const Path &path,
1275  const StrokingStyle &stroke_style = StrokingStyle(),
1276  bool apply_shader_anti_aliasing = true,
1277  enum stroking_method_t stroking_method = stroking_method_fastest,
1278  const PathEffect *effect = nullptr);
1279 
1280  /*!
1281  * Provided as a conveniance, equivalent to
1282  * \code
1283  * stroke_path(PainterData(&brush, &stroking_params), path,
1284  * stroke_style, apply_shader_anti_aliasing,
1285  * stroking_method, effect);
1286  * \endcode
1287  * \param brush brush to apply to stroking
1288  * \param stroking_params stroking parameters to apply to stroking
1289  * \param path Path to stroke
1290  * \param stroke_style how to stroke the path
1291  * \param apply_shader_anti_aliasing if true, stroke with shader-based anti-aliasing
1292  * \param stroking_method stroking method to use
1293  * \param effect if non-null, apply the given \ref PathEffect on stroking
1294  */
1295  void
1297  const PainterStrokeParams &stroking_params,
1298  const Path &path, const StrokingStyle &stroke_style = StrokingStyle(),
1299  bool apply_shader_anti_aliasing = true,
1300  enum stroking_method_t stroking_method = stroking_method_fastest,
1301  const PathEffect *effect = nullptr)
1302  {
1303  stroke_path(PainterData(&brush, &stroking_params), path,
1304  stroke_style, apply_shader_anti_aliasing,
1305  stroking_method, effect);
1306  }
1307 
1308  /*!
1309  * Stroke a path dashed.
1310  * \param shader shader with which to draw
1311  * \param draw data for how to draw
1312  * \param path Path to stroke
1313  * \param stroke_style how to stroke the path
1314  * \param apply_shader_anti_aliasing if true, stroke with shader-based anti-aliasing
1315  * \param stroking_method stroking method to use
1316  * \param effect if non-null, apply the given \ref PathEffect on stroking
1317  */
1318  void
1319  stroke_dashed_path(const PainterDashedStrokeShaderSet &shader, const PainterData &draw, const Path &path,
1320  const StrokingStyle &stroke_style = StrokingStyle(),
1321  bool apply_shader_anti_aliasing = true,
1322  enum stroking_method_t stroking_method = stroking_method_fastest,
1323  const PathEffect *effect = nullptr);
1324 
1325  /*!
1326  * Stroke a path using PainterShaderSet::dashed_stroke_shader() of default_shaders().
1327  * \param draw data for how to draw
1328  * \param path Path to stroke
1329  * \param stroke_style how to stroke the path
1330  * \param apply_shader_anti_aliasing if true, stroke with shader-based anti-aliasing
1331  * \param stroking_method stroking method to use
1332  * \param effect if non-null, apply the given \ref PathEffect on stroking
1333  */
1334  void
1335  stroke_dashed_path(const PainterData &draw, const Path &path,
1336  const StrokingStyle &stroke_style = StrokingStyle(),
1337  bool apply_shader_anti_aliasing = true,
1338  enum stroking_method_t stroking_method = stroking_method_fastest,
1339  const PathEffect *effect = nullptr);
1340 
1341  /*!
1342  * Provided as a conveniance, equivalent to
1343  * \code
1344  * stroke_dashed_path(PainterData(&brush, &stroking_params), path,
1345  * stroke_style, apply_shader_anti_aliasing,
1346  * stroking_method, effect);
1347  * \endcode
1348  * \param brush brush to apply to stroking
1349  * \param stroking_params stroking parameters to apply to stroking
1350  * \param path Path to stroke
1351  * \param stroke_style how to stroke the path
1352  * \param apply_shader_anti_aliasing if true, stroke with shader-based anti-aliasing
1353  * \param stroking_method stroking method to use
1354  * \param effect if non-null, apply the given \ref PathEffect on stroking
1355  */
1356  void
1358  const PainterDashedStrokeParams &stroking_params,
1359  const Path &path, const StrokingStyle &stroke_style = StrokingStyle(),
1360  bool apply_shader_anti_aliasing = true,
1361  enum stroking_method_t stroking_method = stroking_method_fastest,
1362  const PathEffect *effect = nullptr)
1363  {
1364  stroke_dashed_path(PainterData(&brush, &stroking_params), path,
1365  stroke_style, apply_shader_anti_aliasing,
1366  stroking_method, effect);
1367  }
1368 
1369  /*!
1370  * Fill a path.
1371  * \param shader shader with which to fill the attribute data
1372  * \param draw data for how to draw
1373  * \param data attribute and index data with which to fill a path
1374  * \param fill_rule fill rule with which to fill the path
1375  * \param apply_shader_anti_aliasing if true, fill with shader based anti-aliasing
1376  */
1377  void
1378  fill_path(const PainterFillShader &shader, const PainterData &draw,
1379  const FilledPath &data, enum fill_rule_t fill_rule,
1380  bool apply_shader_anti_aliasing = true);
1381 
1382  /*!
1383  * Fill a path.
1384  * \param shader shader with which to fill the attribute data
1385  * \param draw data for how to draw
1386  * \param path to fill
1387  * \param fill_rule fill rule with which to fill the path
1388  * \param apply_shader_anti_aliasing if true, fill with shader based anti-aliasing
1389  */
1390  void
1391  fill_path(const PainterFillShader &shader, const PainterData &draw,
1392  const Path &path, enum fill_rule_t fill_rule,
1393  bool apply_shader_anti_aliasing = true);
1394 
1395  /*!
1396  * Fill a path.
1397  * \param shader shader with which to fill the attribute data
1398  * \param draw data for how to draw
1399  * \param data attribute and index data with which to fill a path
1400  * \param fill_rule custom fill rule with which to fill the path
1401  * \param apply_shader_anti_aliasing if true, fill with shader based anti-aliasing
1402  */
1403  void
1404  fill_path(const PainterFillShader &shader, const PainterData &draw,
1405  const FilledPath &data, const CustomFillRuleBase &fill_rule,
1406  bool apply_shader_anti_aliasing = true);
1407 
1408  /*!
1409  * Fill a path.
1410  * \param shader shader with which to fill the attribute data
1411  * \param draw data for how to draw
1412  * \param path to fill
1413  * \param fill_rule custom fill rule with which to fill the path
1414  * \param apply_shader_anti_aliasing if true, fill with shader based anti-aliasing
1415  */
1416  void
1417  fill_path(const PainterFillShader &shader, const PainterData &draw,
1418  const Path &path, const CustomFillRuleBase &fill_rule,
1419  bool apply_shader_anti_aliasing = true);
1420 
1421  /*!
1422  * Fill a path via \ref ShaderFilledPath
1423  * \param shader shader with which to draw the \ref ShaderFilledPath
1424  * \param draw data for how to draw
1425  * \param path \ref ShaderFilledPath to fill
1426  * \param fill_rule fill rule to apply to fill
1427  */
1428  void
1429  fill_path(const PainterGlyphShader &shader, const PainterData &draw,
1430  const ShaderFilledPath &path, enum fill_rule_t fill_rule);
1431 
1432  /*!
1433  * Fill a path using the default shader to draw the fill.
1434  * \param draw data for how to draw
1435  * \param path path to fill
1436  * \param fill_rule fill rule with which to fill the path
1437  * \param apply_shader_anti_aliasing if true, fill with shader based anti-aliasing
1438  */
1439  void
1440  fill_path(const PainterData &draw, const Path &path, enum fill_rule_t fill_rule,
1441  bool apply_shader_anti_aliasing = true);
1442 
1443  /*!
1444  * Fill a path using the default shader to draw the fill.
1445  * \param draw data for how to draw
1446  * \param path path to fill
1447  * \param fill_rule custom fill rule with which to fill the path
1448  * \param apply_shader_anti_aliasing if true, fill with shader based anti-aliasing
1449  */
1450  void
1451  fill_path(const PainterData &draw, const Path &path, const CustomFillRuleBase &fill_rule,
1452  bool apply_shader_anti_aliasing = true);
1453 
1454  /*!
1455  * Fill a path via \ref ShaderFilledPath using the default shader
1456  * to draw the fill.
1457  * \param draw data for how to draw
1458  * \param path \ref ShaderFilledPath to fill
1459  * \param fill_rule fill rule to apply to fill
1460  */
1461  void
1462  fill_path(const PainterData &draw, const ShaderFilledPath &path,
1463  enum fill_rule_t fill_rule);
1464 
1465  /*!
1466  * Fill a path using the default shader to draw the fill.
1467  * Provided as a conveniance, equivalent to
1468  * \code
1469  * fill_path(PainterData(&brush), path, fill_rule, apply_shader_anti_aliasing);
1470  * \endcode
1471  * \param brush \ref PainterBrush to apply to fill
1472  * \param path path to fill
1473  * \param fill_rule fill rule with which to fill the path
1474  * \param apply_shader_anti_aliasing if true, fill with shader based anti-aliasing
1475  */
1476  void
1477  fill_path(const PainterBrush &brush, const Path &path, enum fill_rule_t fill_rule,
1478  bool apply_shader_anti_aliasing = true)
1479  {
1480  fill_path(PainterData(&brush), path, fill_rule, apply_shader_anti_aliasing);
1481  }
1482 
1483  /*!
1484  * Fill a path using the default shader to draw the fill.
1485  * \code
1486  * fill_path(PainterData(&brush), path, fill_rule, apply_shader_anti_aliasing);
1487  * \endcode
1488  * \param brush \ref PainterBrush to apply to fill
1489  * \param path path to fill
1490  * \param fill_rule custom fill rule with which to fill the path
1491  * \param apply_shader_anti_aliasing if true, fill with shader based anti-aliasing
1492  */
1493  void
1494  fill_path(const PainterBrush &brush, const Path &path, const CustomFillRuleBase &fill_rule,
1495  bool apply_shader_anti_aliasing = true)
1496  {
1497  fill_path(PainterData(&brush), path, fill_rule, apply_shader_anti_aliasing);
1498  }
1499 
1500  /*!
1501  * Fill a convex polygon using a custom shader.
1502  * \param shader shader with which to draw the convex polygon
1503  * \param draw data for how to draw
1504  * \param pts points of the polygon so that neighboring points (modulo pts.size())
1505  * are the edges of the polygon.
1506  * \param apply_shader_anti_aliasing if true, fill with shader based anti-aliasing
1507  */
1508  void
1509  fill_convex_polygon(const PainterFillShader &shader, const PainterData &draw,
1510  c_array<const vec2> pts,
1511  bool apply_shader_anti_aliasing = true);
1512 
1513  /*!
1514  * Fill a convex polygon using the default fill shader.
1515  * \param draw data for how to draw
1516  * \param pts points of the polygon so that neighboring points (modulo pts.size())
1517  * are the edges of the polygon.
1518  * \param apply_shader_anti_aliasing if true, fill with shader based anti-aliasing
1519  */
1520  void
1522  bool apply_shader_anti_aliasing = true);
1523 
1524  /*!
1525  * Fill a convex polygon using the default fill shader.
1526  * \code
1527  * fill_convex_polygon(PainterData(&brush), pts, apply_shader_anti_aliasing);
1528  * \endcode
1529  * \param brush \ref PainterBrush to apply to fill
1530  * \param pts points of the polygon so that neighboring points (modulo pts.size())
1531  * are the edges of the polygon.
1532  * \param apply_shader_anti_aliasing if true, fill with shader based anti-aliasing
1533  */
1534  void
1536  bool apply_shader_anti_aliasing = true)
1537  {
1538  fill_convex_polygon(PainterData(&brush), pts, apply_shader_anti_aliasing);
1539  }
1540 
1541  /*!
1542  * Fill a rect using a custom shader.
1543  * \param shader shader with which to draw the rect
1544  * \param draw data for how to draw
1545  * \param rect rectangle to fill
1546  * \param apply_shader_anti_aliasing if true, fill with shader based anti-aliasing
1547  */
1548  void
1549  fill_rect(const PainterFillShader &shader, const PainterData &draw,
1550  const Rect &rect,
1551  bool apply_shader_anti_aliasing = true);
1552 
1553  /*!
1554  * Fill a rect using the default fill shader.
1555  * \param draw data for how to draw
1556  * \param rect rectangle to fill
1557  * \param apply_shader_anti_aliasing if true, fill with shader based anti-aliasing
1558  */
1559  void
1560  fill_rect(const PainterData &draw, const Rect &rect,
1561  bool apply_shader_anti_aliasing = true);
1562 
1563  /*!
1564  * Fill a rect using the default fill shader.
1565  * \code
1566  * fill_convex_polygon(PainterData(&brush), rect, apply_shader_anti_aliasing);
1567  * \endcode
1568  * \param brush \ref PainterBrush to apply to fill
1569  * \param rect rectangle to fill
1570  * \param apply_shader_anti_aliasing if true, fill with shader based anti-aliasing
1571  */
1572  void
1573  fill_rect(const PainterBrush &brush, const Rect &rect,
1574  bool apply_shader_anti_aliasing = true)
1575  {
1576  fill_rect(PainterData(&brush), rect, apply_shader_anti_aliasing);
1577  }
1578 
1579  /*!
1580  * Fill a rounded rect using a fill shader
1581  * \param shader shader with which to draw the rounded rectangle
1582  * \param draw data for how to draw
1583  * \param R \ref RoundedRect to draw
1584  * \param apply_shader_anti_aliasing if true, fill with shader based anti-aliasing
1585  */
1586  void
1587  fill_rounded_rect(const PainterFillShader &shader, const PainterData &draw,
1588  const RoundedRect &R,
1589  bool apply_shader_anti_aliasing = true);
1590 
1591  /*!
1592  * Fill a rounded rect using the default fill shader
1593  * \param draw data for how to draw
1594  * \param R \ref RoundedRect to draw
1595  * \param apply_shader_anti_aliasing if true, fill with shader based anti-aliasing
1596  */
1597  void
1598  fill_rounded_rect(const PainterData &draw, const RoundedRect &R,
1599  bool apply_shader_anti_aliasing = true);
1600 
1601  /*!
1602  * Fill a rounded rect using the default fill shader
1603  * \code
1604  * fill_rounded_rect(PainterData(&brush), R, apply_shader_anti_aliasing);
1605  * \endcode
1606  * \param brush brush to apply to filling
1607  * \param R \ref RoundedRect to draw
1608  * \param apply_shader_anti_aliasing if true, fill with shader based anti-aliasing
1609  */
1610  void
1612  bool apply_shader_anti_aliasing = true)
1613  {
1614  fill_rounded_rect(PainterData(&brush), R, apply_shader_anti_aliasing);
1615  }
1616 
1617  /*!
1618  * Draw generic attribute data.
1619  * \param shader shader with which to draw data
1620  * \param draw data for how to draw
1621  * \param attrib_chunk attribute data to draw
1622  * \param index_chunk index data into attrib_chunk
1623  * \param index_adjust amount by which to adjust the values in index_chunk
1624  */
1625  void
1627  const PainterData &draw,
1628  c_array<const PainterAttribute> attrib_chunk,
1629  c_array<const PainterIndex> index_chunk,
1630  int index_adjust = 0)
1631  {
1632  vecN<c_array<const PainterAttribute>, 1> aa(attrib_chunk);
1633  vecN<c_array<const PainterIndex>, 1> ii(index_chunk);
1634  vecN<int, 1> ia(index_adjust);
1635  draw_generic(shader, draw, aa, ii, ia);
1636  }
1637 
1638  /*!
1639  * Draw generic attribute data.
1640  * \param shader shader with which to draw data
1641  * \param draw data for how to draw
1642  * \param attrib_chunks attribute data to draw
1643  * \param index_chunks the i'th element is index data into attrib_chunks[i]
1644  * \param index_adjusts if non-empty, the i'th element is the value by which
1645  * to adjust all of index_chunks[i]; if empty the index
1646  * values are not adjusted.
1647  */
1648  void
1650  const PainterData &draw,
1651  c_array<const c_array<const PainterAttribute> > attrib_chunks,
1652  c_array<const c_array<const PainterIndex> > index_chunks,
1653  c_array<const int> index_adjusts);
1654 
1655  /*!
1656  * Draw generic attribute data
1657  * \param shader shader with which to draw data
1658  * \param draw data for how to draw
1659  * \param attrib_chunks attribute data to draw
1660  * \param index_chunks the i'th element is index data into attrib_chunks[K]
1661  * where K = attrib_chunk_selector[i]
1662  * \param index_adjusts if non-empty, the i'th element is the value by which
1663  * to adjust all of index_chunks[i]; if empty the index
1664  * values are not adjusted.
1665  * \param attrib_chunk_selector selects which attribute chunk to use for
1666  * each index chunk
1667  */
1668  void
1670  const PainterData &draw,
1671  c_array<const c_array<const PainterAttribute> > attrib_chunks,
1672  c_array<const c_array<const PainterIndex> > index_chunks,
1673  c_array<const int> index_adjusts,
1674  c_array<const unsigned int> attrib_chunk_selector);
1675 
1676  /*!
1677  * Draw generic attribute data where the item self occludes
1678  * \param shader shader with which to draw data
1679  * \param draw data for how to draw
1680  * \param attrib_chunk attribute data to draw
1681  * \param index_chunk index data into attrib_chunk
1682  * \param index_adjust amount by which to adjust the values in index_chunk
1683  * \param z_range z-range of item's attribute data
1684  */
1685  void
1687  const PainterData &draw,
1688  c_array<const PainterAttribute> attrib_chunk,
1689  c_array<const PainterIndex> index_chunk,
1690  range_type<int> z_range,
1691  int index_adjust = 0);
1692 
1693  /*!
1694  * Draw generic attribute data where the item self occludes
1695  * \param shader shader with which to draw data
1696  * \param draw data for how to draw
1697  * \param attrib_chunks attribute data to draw
1698  * \param index_chunks index data into attrib_chunk
1699  * \param z_ranges z-ranges of item's attribute data
1700  * \param index_adjusts if non-empty, the i'th element is the value by which
1701  * to adjust all of index_chunks[i]; if empty the index
1702  * values are not adjusted.
1703  */
1704  void
1706  const PainterData &draw,
1707  c_array<const c_array<const PainterAttribute> > attrib_chunks,
1708  c_array<const c_array<const PainterIndex> > index_chunks,
1709  c_array<const range_type<int> > z_ranges,
1710  c_array<const int> index_adjusts);
1711 
1712  /*!
1713  * Draw generic attribute data
1714  * \param shader shader with which to draw data
1715  * \param draw data for how to draw
1716  * \param src generator of attribute and index data
1717  */
1718  void
1720  const PainterData &draw,
1721  const PainterAttributeWriter &src);
1722 
1723  /*!
1724  * Queue an action that uses (or affects) the GPU. Through these actions,
1725  * one can mix FastUIDraw::Painter with native API calls on a surface.
1726  * However, adding an action induces a draw-break (and state restore)
1727  * after each such action. Also, the action is not called until end()
1728  * is called.
1729  * \param action action to execute within a draw-stream.
1730  */
1731  void
1733 
1734  /*!
1735  * Returns a stat on how much data the Packer has
1736  * handled in the last begin()/end() pair. Calling
1737  * query_stat() within a begin()/end() pair gives
1738  * unreliable results.
1739  * \param st stat to query
1740  */
1741  unsigned int
1742  query_stat(enum query_stats_t st) const;
1743 
1744  /*!
1745  * Write into a c_array<> all the stats from the
1746  * last begin()/end() pair. The number of stats
1747  * can be fetched with number_stats(). The values
1748  * written into are indexed by \ref query_stats_t.
1749  * Calling query_stats() within a begin()/end()
1750  * pair gives unreliable results.
1751  */
1752  void
1754 
1755  /*!
1756  * Returns the number of stats the Painter type
1757  * supports.
1758  */
1759  static
1760  unsigned int
1761  number_stats(void);
1762 
1763  private:
1764 
1765  void *m_d;
1766  };
1767 /*! @} */
1768 }
1769 
1770 #endif
static unsigned int number_stats(void)
A GlyphSequence represents a sequence of glyph codes with positions. A GlyphSequence provides an inte...
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)
Definition: painter.hpp:1296
A PainterPackedValuePool can be used to create PainterPackedValue objects.
void fill_rounded_rect(const PainterFillShader &shader, const PainterData &draw, const RoundedRect &R, bool apply_shader_anti_aliasing=true)
A GlyphAtlas is a common location to place glyph data of an application. Ideally, all glyph data is p...
file stroking_style.hpp
file stroked_path.hpp
A PainterBlendShader represents a shader for performing blending operations.
void begin_coverage_buffer(void)
GlyphRenderer draw_glyphs(const PainterBrush &brush, const GlyphRun &glyph_run, const GlyphRendererChooser &renderer_chooser)
Definition: painter.hpp:1180
A PainterDashedStrokeShaderSet holds a collection of PainterStrokeShaderSet objects for the purpose o...
virtual GlyphRenderer choose_glyph_render(float logical_format_size, const float3x3 &transformation, vec2 viewport_size, float max_singular_value, float min_singular_value) const =0
PainterPackedValuePool & packed_value_pool(void)
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)
Definition: painter.hpp:1357
A PainterData provides the data for how for a Painter to draw content.
screen_orientation
Enumeration to indicate in what direction the y-coordinate increases.
void begin(const reference_counted_ptr< PainterSurface > &surface, const float3x3 &initial_transformation, bool clear_color_buffer=true)
file rounded_rect.hpp
void begin_layer(float alpha)
Definition: painter.hpp:783
file matrix.hpp
all classes and functions of FastUIDraw are in the namespace fastuidraw.
Definition: colorstop.hpp:28
void fill_path(const PainterBrush &brush, const Path &path, const CustomFillRuleBase &fill_rule, bool apply_shader_anti_aliasing=true)
Definition: painter.hpp:1494
void queue_action(const reference_counted_ptr< const PainterDrawBreakAction > &action)
A PainterFillShader holds the shaders for drawing filled paths. Anti-aliasing is accomplished by draw...
query_stats_t
Enumeration to query the statistics of how much data has been packed.
void fill_path(const PainterFillShader &shader, const PainterData &draw, const FilledPath &data, enum fill_rule_t fill_rule, bool apply_shader_anti_aliasing=true)
blend_mode_t
Enumeration specifying blend modes. The following function-formulas are used in a number of the blend...
bool clip_region_bounds(vec2 *min_pt, vec2 *max_pt)
A wrapper over a pointer to implement reference counting.
GlyphRenderer draw_glyphs(const PainterBrush &brush, const GlyphRun &glyph_run, unsigned int begin, unsigned int count, GlyphRenderer renderer=GlyphRenderer(banded_rays_glyph))
Definition: painter.hpp:1033
void clip_in_rect(const Rect &rect)
return_code
Enumeration for simple return codes for functions for success or failure.
Definition: util.hpp:142
const GlyphRendererChooser & default_glyph_renderer_chooser(void) const
const reference_counted_ptr< PainterBlendShader > & shader(enum PainterEnums::blend_mode_t tp) const
file filled_path.hpp
A GlyphCache represents a cache of glyphs and manages the uploading of the data to a GlyphAtlas...
Definition: glyph_cache.hpp:43
A PainterStrokeShader holds shaders for stroking. It is to hold shaders for stroking paths linearly o...
PainterBlendShader * blend_shader(void) const
A PainterBlendShaderSet represents a set of shaders for the blend modes enumerated by PainterEnums::b...
A ShaderFilledPath represents a path that is drawn as a rectangle where the fragment shader acting on...
ImageAtlas & image_atlas(void) const
GlyphRenderer draw_glyphs(const PainterGlyphShader &shader, const PainterData &draw, const GlyphSequence &glyph_sequence, GlyphRenderer renderer=GlyphRenderer(banded_rays_glyph))
void fill_convex_polygon(const PainterBrush &brush, c_array< const vec2 > pts, bool apply_shader_anti_aliasing=true)
Definition: painter.hpp:1535
void query_stats(c_array< unsigned int > dst) const
file painter_engine.hpp
void fill_rect(const PainterFillShader &shader, const PainterData &draw, const Rect &rect, bool apply_shader_anti_aliasing=true)
A GlyphRun represents a sequence of glyph codes with positions. A GlyphRun provides an interface to g...
Definition: glyph_run.hpp:54
enum return_code flush(void)
void clip_out_convex_polygon(c_array< const vec2 > poly)
void fill_rect(const PainterBrush &brush, const Rect &rect, bool apply_shader_anti_aliasing=true)
Definition: painter.hpp:1573
unsigned int query_stat(enum query_stats_t st) const
file glyph_run.hpp
file c_array.hpp
Class to encapsulate enumerations used in Painter interface, part of the main library libFastUIDraw...
void clip_out_path(const Path &path, enum fill_rule_t fill_rule)
file glyph_atlas.hpp
c_array< const PainterSurface *const > end(void)
GlyphRenderer draw_glyphs(const PainterBrush &brush, const GlyphSequence &glyph_sequence, GlyphRenderer renderer=GlyphRenderer(banded_rays_glyph))
Definition: painter.hpp:931
BlendMode blend_mode(void) const
void blend_shader(const PainterBlendShaderSet &shader_set, enum blend_mode_t m)
Definition: painter.hpp:301
const float3x3 & transformation(void)
file path.hpp
void translate(const vec2 &p)
Provides an interface to write attribute and index data when a simple copy of data from c_array objec...
A ColorStopAtlas is a common location to all color stop data of an application. Ideally, all color stop sequences are placed into a single ColorStopAtlas (changes of ColorStopAtlas force draw-call breaks).
Painter implements a canvas rendering interface.
Definition: painter.hpp:120
ColorStopAtlas & colorstop_atlas(void) const
file painter_brush.hpp
void concat(const float3x3 &tr)
GlyphRenderer draw_glyphs(const PainterBrush &brush, const GlyphSequence &glyph_sequence, const GlyphRendererChooser &renderer_chooser)
Definition: painter.hpp:976
float compute_path_thresh(const Path &path)
const reference_counted_ptr< PainterSurface > & surface(void) const
file painter_attribute_data.hpp
A FilledPath represents the data needed to draw a path filled. It contains -all- the data needed to f...
Definition: filled_path.hpp:52
A PainterShaderRegistrar is an interface that defines the assigning of PainterShader::ID() to a Paint...
void draw_generic(PainterItemShader *shader, const PainterData &draw, c_array< const PainterAttribute > attrib_chunk, c_array< const PainterIndex > index_chunk, int index_adjust=0)
Definition: painter.hpp:1626
Class to specify dashed stroking parameters, data is packed as according to PainterDashedStrokeParams...
GlyphRenderer draw_glyphs(const PainterBrush &brush, const GlyphRun &glyph_run, GlyphRenderer renderer=GlyphRenderer(banded_rays_glyph))
Definition: painter.hpp:1082
void begin_layer(const reference_counted_ptr< const PainterEffect > &effect, PainterEffectParams &effect_params)
A PainterShaderSet provides shaders for blending and drawing each of the item types glyphs...
A c_array is a wrapper over a C pointer with a size parameter to facilitate bounds checking and provi...
Definition: c_array.hpp:43
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)
Definition: painter.hpp:682
file painter_enums.hpp
A PathEffect allows one to process a sequence of TessellatedPath::segment_chain, TessellatedPath::joi...
Definition: path_effect.hpp:39
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 end_layer(void)
A PainterBrush defines a brush for painting via Painter.
file vecN.hpp
Painter(const reference_counted_ptr< PainterEngine > &backend)
fill_rule_t
Enumerations specifying common fill rules.
void scale(float s)
file path_effect.hpp
file painter_packed_value_pool.hpp
Defines default reference counting base classes.
A GlyphRendererChooser provides an interface for choosing how to render glyphs depending on the curre...
Definition: painter.hpp:131
GlyphRenderer compute_glyph_renderer(float pixel_size)
void clip_out_rect(const Rect &rect)
file painter_effect.hpp
file colorstop_atlas.hpp
An ImageAtlas is a common location to place images of an application.
A PainterGlyphShader holds a shader for each glyph_type. The shaders are to handle attribute data as ...
void clip_out_rounded_rect(const RoundedRect &R)
A PartitionedTessellatedPath represents partitioning a TessellatedPath for quick computation of what ...
vecN< float, 4 > vec4
Definition: vecN.hpp:1239
void fill_rounded_rect(const PainterBrush &brush, const RoundedRect &R, bool apply_shader_anti_aliasing=true)
Definition: painter.hpp:1611
file painter_shader_set.hpp
const PainterShaderSet & default_shaders(void) const
file painter_stroke_params.hpp
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)
Definition: painter.hpp:662
A Path represents a collection of PathContour objects.
Definition: path.hpp:668
PainterShaderRegistrar & painter_shader_registrar(void) const
GlyphCache & glyph_cache(void) const
void blend_shader(enum blend_mode_t m)
Definition: painter.hpp:315
void shear(float sx, float sy)
void clip_in_path(const Path &path, enum fill_rule_t fill_rule)
BlendMode blend_mode(enum PainterEnums::blend_mode_t tp) const
void clip_in_rounded_rect(const RoundedRect &R)
c_array< const vec3 > clip_equations(void)
Element of PainterData to hold shader data either reference directly to unpacked data or to reuseable...
file painter_attribute_writer.hpp
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)
Base class to specify a custom fill rule.
Definition: fill_rule.hpp:33
void rotate(float angle)
float curve_flatness(void)
GlyphAtlas & glyph_atlas(void) const
void fill_path(const PainterBrush &brush, const Path &path, enum fill_rule_t fill_rule, bool apply_shader_anti_aliasing=true)
Definition: painter.hpp:1477
Specifies how to render a glyph.
A PainterItemShader represents a shader to draw an item (typically a vertex and fragment shader pair)...
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.
Definition: painter.hpp:200
Class to specify stroking parameters, data is packed as according to PainterStrokeParams::stroke_data...
file painter_dashed_stroke_params.hpp
Class to hold the blend mode as exposed by typical 3D APIs.
Definition: blend_mode.hpp:37
void end_coverage_buffer(void)
void fill_convex_polygon(const PainterFillShader &shader, const PainterData &draw, c_array< const vec2 > pts, bool apply_shader_anti_aliasing=true)
unsigned int draw_data_added_count(void) const
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)
bool clip_region_logical_bounds(vec2 *min_pt, vec2 *max_pt)
c_array< const vec3 > clip_polygon(void)
file fill_rule.hpp
GlyphRenderer draw_glyphs(const PainterBrush &brush, const GlyphRun &glyph_run, unsigned int begin, unsigned int count, const GlyphRendererChooser &renderer_chooser)
Definition: painter.hpp:1134
unsigned int select_subsets(const FilledPath &path, c_array< unsigned int > dst)
file glyph_sequence.hpp
file image.hpp
file reference_counted.hpp