FastUIDraw
stroked_point.hpp
Go to the documentation of this file.
1 /*!
2  * \file stroked_point.hpp
3  * \brief file stroked_point.hpp
4  *
5  * Copyright 2018 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_STROKED_POINT_HPP
21 #define FASTUIDRAW_STROKED_POINT_HPP
22 
23 #include <fastuidraw/util/vecN.hpp>
24 #include <fastuidraw/util/util.hpp>
29 
30 namespace fastuidraw {
31 
32 /*!\addtogroup Paths
33  * @{
34  */
35 
36 /*!
37  * \brief
38  * A StrokedPoint holds the data for a point of stroking
39  * where all segments are line segments (coming from
40  * curve tessellation). The upshot is that the fragment
41  * shader does NOT perform any coverage computation for
42  * non-dashed stroking. In addition, the data is so that
43  * changing the stroking width or miter limit does not
44  * change the stroking data.
45  */
47 {
48 public:
49  /*!
50  * \brief
51  * Enumeration for specifing the point type which in turn
52  * determines the meaning of the fields \ref m_pre_offset
53  * and \ref m_auxiliary_offset
54  */
56  {
57  /*!
58  * The point is for an edge of the path, point signifies the start
59  * or end of a sub-edge (quad) of drawing an edge. The meanings of
60  * \ref m_pre_offset and \ref m_auxiliary_offset are:
61  * - \ref m_pre_offset the normal vector to the edge in which
62  * move the point by when stroking
63  * - \ref m_auxiliary_offset when added to \ref m_position, gives
64  * the position of the point on the other
65  * side of the edge.
66  */
68 
69  /*!
70  * The point is at a position that has the same value as point on
71  * an edge but the point itself is part of a cap or join. The
72  * meanings of the members \ref m_pre_offset and \ref
73  * m_auxiliary_offset are:
74  * - \ref m_pre_offset the normal vector to the edge in which move
75  * the point by the stroking width when stroking;
76  * this vector can be (0, 0).
77  * - \ref m_auxiliary_offset unused (set to (0, 0))
78  */
80 
81  /*!
82  * The point is for a boundary point of a rounded join of the path.
83  * The meanings of the members \ref m_pre_offset and and \ref
84  * m_auxiliary_offset are:
85  * - \ref m_pre_offset the .x() component holds the unit normal vector
86  * between the join point and the edge going into
87  * the join. The .y() component holds the unit
88  * normal vector between the join point and the edge
89  * leaving the join. The packing is that the
90  * x-coordinate value is given and the y-coordinate
91  * magnitude is \f$ sqrt(1 - x^2) \f$. If the bit
92  * \ref normal0_y_sign_bit is up, then the y-coordinate
93  * for the normal vector of going into the join,
94  * then the y-value is negative. If the bit \ref
95  * normal1_y_sign_bit is up, then the y-coordinate
96  * for the normal vector of leaving the join, then
97  * the y-value is negative.
98  * - \ref m_auxiliary_offset the .x() component gives an interpolation
99  * in the range [0, 1] to interpolate between
100  * the normal vectors packed in \ref m_pre_offset.
101  * The .y() value gives the normal vector directly
102  * but packed (as in \ref m_pre_offset) where the
103  * y-coordinate sign is negative if the bit \ref
104  * sin_sign_mask is up.
105  */
107 
108  /*!
109  * Point type for miter-clip join point whose position depends on the
110  * stroking radius and the miter-limit. The meanings of \ref m_pre_offset
111  * and \ref m_auxiliary_offset are:
112  * - \ref m_pre_offset gives the unit normal vector of the edge going
113  * into the join
114  * - \ref m_auxiliary_offset gives the unit normal vector of the edge
115  * leaving the join
116  */
118 
119  /*!
120  * Point type for miter-bevel join point whose position depends on the
121  * stroking radius and the miter-limit. The meanings of \ref m_pre_offset
122  * and \ref m_auxiliary_offset are:
123  * - \ref m_pre_offset gives the unit normal vector of the edge going
124  * into the join
125  * - \ref m_auxiliary_offset gives the unit normal vector of the edge
126  * leaving the join
127  */
129 
130  /*!
131  * Point type for miter join whose position position depends on the
132  * stroking radius and the miter-limit. The meanings of \ref m_pre_offset
133  * and \ref m_auxiliary_offset are:
134  * - \ref m_pre_offset gives the unit normal vector of the edge going
135  * into the join
136  * - \ref m_auxiliary_offset gives the unit normal vector of the edge
137  * leaving the join
138  */
140 
141  /*!
142  * The point is for a boundary point of a rounded cap of the path.
143  * The meanings of \ref m_pre_offset and \ref m_auxiliary_offset
144  * are:
145  * - \ref m_pre_offset is the normal vector to the path to start
146  * drawing the rounded cap
147  * - \ref m_auxiliary_offset gives the the unit vector (cos, sin)
148  * of the angle to make with the vector
149  * given by \ref m_pre_offset
150  */
152 
153  /*!
154  * The point is for a boundary point of a square cap of the path,
155  * the meanings of \ref m_pre_offset and \ref m_auxiliary_offset are:
156  * - \ref m_pre_offset is the normal vector to the path by which
157  * to move the point
158  * - \ref m_auxiliary_offset is the tangent vector to the path
159  * by which to move the point
160  */
162 
163  /*!
164  * The point is a point of an adjustable cap. These points are for
165  * dashed stroking with caps; they contain data to allow one from a
166  * vertex shader to extend or shrink the cap area correctly to implement
167  * dashed stroking. The meanings of \ref m_pre_offset and \ref
168  * m_auxiliary_offset are:
169  * - \ref m_pre_offset is the normal vector to the path by which
170  * to move the point; this value can be (0, 0)
171  * to indicate to not move perpindicular to the
172  * path
173  * - \ref m_auxiliary_offset is the tangent vector to the path
174  * by which to move the point; this value
175  * can be (0, 0) to indicate to not move
176  * parallel to the path
177  */
179 
180  /*!
181  * The point is a point of a flat cap. These points are for doing
182  * anti-aliasing at the starting and ending of an open contour.
183  * The meanings of \ref m_pre_offset and \ref m_auxiliary_offset
184  * are:
185  * - \ref m_pre_offset is the normal vector to the path by which
186  * to move the point; this value can be (0, 0)
187  * to indicate to not move perpindicular to the
188  * path
189  * - \ref m_auxiliary_offset is the tangent vector to the path
190  * by which to move the point; this value
191  * can be (0, 0) to indicate to not move
192  * parallel to the path
193  */
195 
196  /*!
197  * Number different point types with respect to rendering
198  */
200  };
201 
202  /*!
203  * \brief
204  * Enumeration encoding of bits of \ref m_packed_data
205  * common to all offset types.
206  */
208  {
209  /*!
210  * Bit0 for holding the offset_type() value
211  * of the point.
212  */
214 
215  /*!
216  * number of bits needed to hold the
217  * offset_type() value of the point.
218  */
220 
221  /*!
222  * Bit for holding boundary() value
223  * of the point
224  */
226 
227  /*!
228  * Bit0 for holding the depth() value
229  * of the point
230  */
232 
233  /*!
234  * number of bits needed to hold the
235  * depth() value of the point.
236  */
238 
239  /*!
240  * Bit to indicate point is from a join. For these
241  * points, during dashed stroking. For joins, one is
242  * guaranteed that the distance values for all points
243  * of a fixed join are the same.
244  */
246 
247  /*!
248  * Number of bits used on common packed data
249  */
251  };
252 
253  /*!\brief
254  * Enumeration encoding of bits of \ref m_packed_data
255  * for those with offset type \ref offset_sub_edge
256  */
258  {
259  /*!
260  * If this bit is down indicates the point is the
261  * start of a sub-edge; if the bit is up, indicates
262  * that the point is the end of a subedge.
263  */
265 
266  /*!
267  * The bit is up if the point is for the
268  * geometry of a bevel between two sub-edges.
269  */
271  };
272 
273  /*!
274  * \brief
275  * Enumeration encoding of bits of \ref m_packed_data
276  * for those with offset type \ref offset_rounded_join
277  */
279  {
280  /*!
281  * Bit for holding the the sign of
282  * the y-coordinate of the normal 0
283  * for the offset_type() \ref
284  * offset_rounded_join.
285  */
287 
288  /*!
289  * Bit for holding the the sign of
290  * the y-coordinate of the normal 1
291  * for the offset_type() \ref
292  * offset_rounded_join.
293  */
295 
296  /*!
297  * Bit for holding the the sign of
298  * sin() value for the offset_type()
299  * \ref offset_rounded_join.
300  */
302  };
303 
304  /*!
305  * \brief
306  * Enumeration encoding of bits of \ref m_packed_data
307  * for those with offset type \ref offset_miter_clip_join.
308  */
310  {
311  /*!
312  * Indicates that the lambda of the miter-join
313  * computation should be negated.
314  */
316  };
317 
318  /*!
319  * \brief
320  * Enumeration encoding of bits of \ref m_packed_data for
321  * those with offset type \ref offset_adjustable_cap
322  */
324  {
325  /*!
326  * The bit is up if the point is for end of point
327  * of a cap (i.e. the side to be extended to make
328  * sure the entire cap near the end of edge is drawn).
329  */
331 
332  /*!
333  * The bit is up if the point is for cap at the
334  * end of the contour.
335  */
337  };
338 
339  /*!
340  * \brief
341  * Enumeration encoding of bits of \ref m_packed_data for
342  * those with offset type \ref offset_flat_cap
343  */
345  {
346  /*!
347  * The bit is up if the point is for end of point
348  * of a cap (i.e. the side to be extended to make
349  * sure the entire cap near the end of edge is drawn).
350  */
352 
353  /*!
354  * The bit is up if the point is for cap at the
355  * end of the contour.
356  */
358  };
359 
360  /*!
361  * \brief
362  * Enumeration holding bit masks.
363  */
365  {
366  /*!
367  * Mask generated for \ref offset_type_bit0 and
368  * \ref offset_type_num_bits
369  */
371 
372  /*!
373  * Mask generated for \ref boundary_bit
374  */
376 
377  /*!
378  * Mask generated for \ref depth_bit0 and \ref depth_num_bits
379  */
381 
382  /*!
383  * Mask generated for \ref end_sub_edge_bit
384  */
386 
387  /*!
388  * Mask generated for \ref bevel_edge_bit
389  */
391 
392  /*!
393  * Mask generated for \ref normal0_y_sign_bit
394  */
396 
397  /*!
398  * Mask generated for \ref normal1_y_sign_bit
399  */
401 
402  /*!
403  * Mask generated for \ref sin_sign_bit sin_sign_bit
404  */
406 
407  /*!
408  * Mask generated for \ref lambda_negated_mask
409  */
411 
412  /*!
413  * Mask generated for \ref join_bit
414  */
416 
417  /*!
418  * Mask generated for \ref adjustable_cap_ending_bit
419  */
421 
422  /*!
423  * Mask generated for \ref adjustable_cap_is_end_contour_bit
424  */
426 
427  /*!
428  * Mask generated for \ref flat_cap_ending_bit
429  */
431 
432  /*!
433  * Mask generated for \ref adjustable_cap_is_end_contour_bit
434  */
436  };
437 
438  /*!
439  * The base position of a point before applying the stroking width
440  * to the position.
441  */
443 
444  /*!
445  * Gives values to help compute the location of the point after
446  * applying the stroking width. See the descriptions to the
447  * elements of \ref offset_type_t for its meaning for different
448  * offset types.
449  */
451 
452  /*!
453  * Gives values to help compute the location of the point after
454  * applying the stroking width. See the descriptions to the
455  * elements of \ref offset_type_t for its meaning for different
456  * offset types.
457  */
459 
460  /*!
461  * Gives the distance of the point from the start
462  * of the -edge- on which the point resides.
463  */
465 
466  /*!
467  * Gives the distance of the point from the start
468  * of the -contour- on which the point resides.
469  */
471 
472  /*!
473  * Gives the length of the edge on which the
474  * point lies. This value is the same for all
475  * points along a fixed edge.
476  */
478 
479  /*!
480  * Gives the length of the contour on which the
481  * point lies. This value is the same for all
482  * points along a fixed contour.
483  */
485 
486  /*!
487  * Bit field with data packed as according to
488  * \ref packed_data_bit_layout_common_t, \ref
489  * packed_data_bit_layout_rounded_join_t, \ref
490  * packed_data_bit_adjustable_cap_t and \ref
491  * packed_data_bit_sub_edge_t. See also,
492  * \ref packed_data_bit_masks_t for bit masks
493  * generated.
494  */
495  uint32_t m_packed_data;
496 
497  /*!
498  * Provides the point type from a value of \ref m_packed_data.
499  * The return value is one of the enumerations of
500  * \ref offset_type_t.
501  * \param packed_data_value value suitable for \ref m_packed_data
502  */
503  static
504  enum offset_type_t
505  offset_type(uint32_t packed_data_value)
506  {
507  uint32_t v;
508  v = unpack_bits(offset_type_bit0, offset_type_num_bits, packed_data_value);
509  return static_cast<enum offset_type_t>(v);
510  }
511 
512  /*!
513  * Provides the point type for the point. The return value
514  * is one of the enumerations of \ref offset_type_t.
515  */
516  enum offset_type_t
517  offset_type(void) const
518  {
519  return offset_type(m_packed_data);
520  }
521 
522  /*!
523  * When stroking the data, the depth test to only
524  * pass when the depth value is -strictly- larger
525  * so that a fixed pixel is not stroked twice by
526  * a single path. The value returned by depth() is
527  * a relative z-value for a vertex. The points
528  * drawn first have the largest z-values.
529  */
530  uint32_t
531  depth(void) const
532  {
533  return unpack_bits(depth_bit0, depth_num_bits, m_packed_data);
534  }
535 
536  /*!
537  * Set the value returned by depth().
538  */
539  void
540  depth(const uint32_t v)
541  {
542  m_packed_data &= ~depth_mask;
543  m_packed_data |= pack_bits(depth_bit0, depth_num_bits, v);
544  }
545 
546  /*!
547  * Has value 0 or 1. If the value is 0, then the
548  * point is on the path. If the value has value 1,
549  * then indicates a point that is on the boundary
550  * of the stroked path.
551  */
552  int
553  on_boundary(void) const
554  {
555  return unpack_bits(boundary_bit, 1u, m_packed_data);
556  }
557 
558  /*!
559  * Pack the data of this \ref StrokedPoint into a \ref
560  * PainterAttribute. The packing is as follows:
561  * - PainterAttribute::m_attrib0 .xy -> \ref m_position (float)
562  * - PainterAttribute::m_attrib0 .zw -> \ref m_pre_offset (float)
563  * - PainterAttribute::m_attrib1 .x -> \ref m_distance_from_edge_start (float)
564  * - PainterAttribute::m_attrib1 .y -> \ref m_distance_from_contour_start (float)
565  * - PainterAttribute::m_attrib1 .zw -> \ref m_auxiliary_offset (float)
566  * - PainterAttribute::m_attrib2 .x -> \ref m_packed_data (uint)
567  * - PainterAttribute::m_attrib2 .y -> \ref m_edge_length (float)
568  * - PainterAttribute::m_attrib2 .z -> \ref m_contour_length (float)
569  * - PainterAttribute::m_attrib2 .w (free)
570  *
571  * \param dst PainterAttribute to which to pack
572  */
573  void
574  pack_point(PainterAttribute *dst) const;
575 
576  /*!
577  * Unpack a \ref StrokedPoint from a \ref PainterAttribute.
578  * \param dst point to which to unpack data
579  * \param src PainterAttribute from which to unpack data
580  */
581  static
582  void
583  unpack_point(StrokedPoint *dst, const PainterAttribute &src);
584 };
585 
586 /*!
587  * \brief
588  * Namespace to encompass packing values and functions of
589  * path data for stroking using \ref StrokedPoint.
590  */
591 namespace StrokedPointPacking
592 {
593  /*!
594  * Enumeration to specify how to pack attribute and index
595  * data for a cap.
596  */
598  {
599  /*!
600  * Pack cap for stroking cap with the style \ref
601  * PainterEnums::flat_caps with non-dashed stroking.
602  */
604 
605  /*!
606  * Pack cap for stroking cap with the style \ref
607  * PainterEnums::square_caps with non-dashed stroking.
608  */
610 
611  /*!
612  * Pack cap for stroking cap with dashed stroking
613  * (regardless of \ref PainterEnums::cap_style).
614  */
616 
617  /*!
618  * Pack cap for stroking cap with the style \ref
619  * PainterEnums::rounded_caps with non-dashed stroking.
620  */
622  };
623 
624  /*!
625  * \brief
626  * Template class taking as argument a \ref PainterEnums::join_style
627  * or \ref cap_type_t which defines two enumerations:
628  * - number_attributes gives the number of attributes needed to pack a join or cap
629  * - number_indices gives the number of attributes needed to pack a join or cap
630  * NOTE: this is NOT defined for \ref PainterEnums::rounded_joins or \ref rounded_cap
631  * because the number of attributes and indices depends on the join or cap and the
632  * threshold used to realize the join or cap. To get the number of indices and
633  * attributes needed to pack a rounded join use \ref pack_rounded_join_size().
634  * To get the number of indices and attributes needed to pack a rounded cap use \ref
635  * pack_rounded_cap_size().
636  */
637  template<typename T, T>
639  {};
640 
641  ///@cond
642  template<>
643  class packing_size<enum PainterEnums::join_style, PainterEnums::no_joins>
644  {
645  public:
646  enum
647  {
648  number_attributes = 0,
649  number_indices = 0
650  };
651  };
652 
653  template<>
654  class packing_size<enum PainterEnums::join_style, PainterEnums::bevel_joins>
655  {
656  public:
657  enum
658  {
659  number_attributes = 3,
660  number_indices = 3
661  };
662  };
663 
664  template<>
665  class packing_size<enum PainterEnums::join_style, PainterEnums::miter_clip_joins>
666  {
667  public:
668  enum
669  {
670  number_attributes = 5,
671  number_indices = 9
672  };
673  };
674 
675  template<>
676  class packing_size<enum PainterEnums::join_style, PainterEnums::miter_bevel_joins>
677  {
678  public:
679  enum
680  {
681  number_attributes = 4,
682  number_indices = 6
683  };
684  };
685 
686  template<>
687  class packing_size<enum PainterEnums::join_style, PainterEnums::miter_joins>
688  {
689  public:
690  enum
691  {
692  number_attributes = 4,
693  number_indices = 6
694  };
695  };
696 
697  template<>
698  class packing_size<enum cap_type_t, flat_cap>
699  {
700  public:
701  enum
702  {
703  number_attributes = 6,
704  number_indices = 12
705  };
706  };
707 
708  template<>
709  class packing_size<enum cap_type_t, adjustable_cap>
710  {
711  public:
712  enum
713  {
714  number_attributes = 6,
715  number_indices = 12
716  };
717  };
718 
719  template<>
720  class packing_size<enum cap_type_t, square_cap>
721  {
722  public:
723  enum
724  {
725  number_attributes = 5,
726  number_indices = 9
727  };
728  };
729  ///@endcond
730 
731  /*!
732  * Returns the value for \ref cap_type_t given a
733  * \ref PainterEnums::cap_style value
734  * \param cp \ref PainterEnums::cap_style value
735  * \param for_dashed_stroking if true, return a cap-value suitable
736  * for dashed stroking.
737  */
738  enum cap_type_t
740  bool for_dashed_stroking);
741 
742  /*!
743  * Returns the number of attributes realized with \ref
744  * StrokedPoint needed to pack a rounded join.
745  * \param join join to realize a packed data
746  * \param thresh the maximum distance allowed from the
747  * approximation of the rounded join realized
748  * as triangles when the join is stroked
749  * with a stroking width of one.
750  * \param num_attributes location to which to write the needed
751  * number of attributes
752  * \param num_indices location to which to write the needed
753  * number of indices
754  */
755  void
757  float thresh,
758  unsigned int *num_attributes,
759  unsigned int *num_indices);
760 
761  /*!
762  * Pack a join into attribute data and index data
763  * realized with \ref StrokedPoint.
764  * \param js join style to pack for
765  * \param join join data to pack
766  * \param depth the value for \ref StrokedPoint::depth() of the
767  * packed \ref StrokedPoint values
768  * \param dst_attribs location to which to place the attributes,
769  * when js is \ref PainterEnums::rounded_joins,
770  * the size of dst_attribs must be as indicated
771  * by \ref pack_rounded_join_size().
772  * \param dst_indices location to which to place the indices,
773  * when js is \ref PainterEnums::rounded_joins,
774  * the size of dst_indices must be as indicated
775  * by \ref pack_rounded_join_size().
776  * \param index_adjust value by which to increment the written
777  * index values
778  */
779  void
781  const TessellatedPath::join &join,
782  unsigned int depth,
783  c_array<PainterAttribute> dst_attribs,
784  c_array<PainterIndex> dst_indices,
785  unsigned int index_adjust);
786 
787  /*!
788  * Returns the number of attributes realized with \ref
789  * StrokedPoint needed to pack a rounded cap.
790  * \param thresh the maximum distance allowed from the
791  * approximation of the rounded cap realized
792  * as triangles when the cap is stroked
793  * with a stroking width of one.
794  * \param num_attributes location to which to write the needed
795  * number of attributes
796  * \param num_indices location to which to write the needed
797  * number of indices
798  */
799  void
800  pack_rounded_cap_size(float thresh,
801  unsigned int *num_attributes,
802  unsigned int *num_indices);
803 
804  /*!
805  * Pack a cap into attribute data and index data
806  * realized with \ref StrokedPoint.
807  * \param cp join style to pack for
808  * \param cap cap data to pack
809  * \param depth the value for \ref StrokedPoint::depth() of
810  * the packed \ref StrokedPoint values
811  * \param dst_attribs location to which to place the attributes,
812  * when cp is \ref rounded_cap, the size
813  * of dst_attribs must be as indicated by
814  * \ref pack_rounded_cap_size().
815  * \param dst_indices location to which to place the indices,
816  * when cp is \ref rounded_cap, the size
817  * of dst_indices must be as indicated by
818  * \ref pack_rounded_cap_size().
819  * \param index_adjust value by which to increment the written
820  * index values
821  */
822  void
823  pack_cap(enum cap_type_t cp,
824  const TessellatedPath::cap &cap,
825  unsigned int depth,
826  c_array<PainterAttribute> dst_attribs,
827  c_array<PainterIndex> dst_indices,
828  unsigned int index_adjust);
829 
830  /*!
831  * Computes the number of indices and attributes necessary to pack
832  * an array of \ref TessellatedPath::segment_chain values.
833  * Each \ref TessellatedPath::segment of each \ref
834  * TessellatedPath::segment_chain must have that \ref
835  * TessellatedPath::segment::m_type is the value \ref
836  * TessellatedPath::line_segment.
837  * \param chains segment chain to query amount room needed to pack
838  * realized by \ref StrokedPoint
839  * \param depth_range_size location to which to write the depth range needed
840  * to pack the segment chain.
841  * \param num_attributes location to which to write the needed
842  * number of attributes
843  * \param num_indices location to which to write the needed
844  * number of indices
845  */
846  void
848  unsigned int *depth_range_size,
849  unsigned int *num_attributes,
850  unsigned int *num_indices);
851 
852  /*!
853  * Computes the number of indices and attributes necessary to pack
854  * a single \ref TessellatedPath::segment_chain value.
855  * The \ref TessellatedPath::segment of the \ref
856  * TessellatedPath::segment_chain must have that \ref
857  * TessellatedPath::segment::m_type is the value \ref
858  * TessellatedPath::line_segment.
859  * \param chain segment chain to query amount room needed to pack
860  * realized by \ref StrokedPoint
861  * \param depth_range_size location to which to write the depth range needed
862  * to pack the segment chain.
863  * \param num_attributes location to which to write the needed
864  * number of attributes
865  * \param num_indices location to which to write the needed
866  * number of indices
867  */
868  void
870  unsigned int *depth_range_size,
871  unsigned int *num_attributes,
872  unsigned int *num_indices);
873 
874  /*!
875  * Pack an array of segments chains realized as \ref StrokedPoint
876  * \param chains segment chain to pack
877  * \param depth_start value the lowest depth value for the attributes;
878  * the packed \ref StrokedPoint values will have
879  * depth_start <= \ref StrokedPoint::depth() and \ref
880  * StrokedPoint::depth() < depth_start + depth_range_size
881  * where depth_range_size is as indicated by
882  * \ref pack_segment_chain_size().
883  * \param dst_attribs location to which to place the attributes, the
884  * size of dst_attribs must be as indicated by \ref
885  * pack_segment_chain_size().
886  * \param dst_indices location to which to place the indices, the
887  * size of dst_indices must be as indicated by \ref
888  * pack_segment_chain_size().
889  * \param index_adjust value by which to increment the written
890  * index values
891  */
892  void
894  unsigned int depth_start,
895  c_array<PainterAttribute> dst_attribs,
896  c_array<PainterIndex> dst_indices,
897  unsigned int index_adjust);
898 
899  /*!
900  * Pack a single segment chain realized as \ref StrokedPoint
901  * \param chain segment chain to pack
902  * \param depth_start value the lowest depth value for the attributes;
903  * the packed \ref StrokedPoint values will have
904  * depth_start <= \ref StrokedPoint::depth() and \ref
905  * StrokedPoint::depth() < depth_start + depth_range_size
906  * where depth_range_size is as indicated by
907  * \ref pack_segment_chain_size().
908  * \param dst_attribs location to which to place the attributes, the
909  * size of dst_attribs must be as indicated by \ref
910  * pack_segment_chain_size().
911  * \param dst_indices location to which to place the indices, the
912  * size of dst_indices must be as indicated by \ref
913  * pack_segment_chain_size().
914  * \param index_adjust value by which to increment the written
915  * index values
916  */
917  void
919  unsigned int depth_start,
920  c_array<PainterAttribute> dst_attribs,
921  c_array<PainterIndex> dst_indices,
922  unsigned int index_adjust);
923 }
924 
925 /*! @} */
926 
927 }
928 
929 #endif
A StrokedPoint holds the data for a point of stroking where all segments are line segments (coming fr...
#define FASTUIDRAW_MASK(BIT0, NUMBITS)
Definition: util.hpp:59
uint32_t unpack_bits(uint32_t bit0, uint32_t num_bits, uint32_t value)
Definition: util.hpp:328
enum cap_type_t cap_type(enum PainterEnums::cap_style cp, bool for_dashed_stroking)
uint32_t depth(void) const
void pack_join(enum PainterEnums::join_style js, const TessellatedPath::join &join, unsigned int depth, c_array< PainterAttribute > dst_attribs, c_array< PainterIndex > dst_indices, unsigned int index_adjust)
packed_data_bit_layout_rounded_join_t
Enumeration encoding of bits of m_packed_data for those with offset type offset_rounded_join.
int on_boundary(void) const
all classes and functions of FastUIDraw are in the namespace fastuidraw.
Definition: colorstop.hpp:28
Represents the geometric data for a join.
file tessellated_path.hpp
Represents the geometric data for a cap.
void depth(const uint32_t v)
Template class taking as argument a PainterEnums::join_style or cap_type_t which defines two enumerat...
void pack_segment_chain(const TessellatedPath::segment_chain &chain, unsigned int depth_start, c_array< PainterAttribute > dst_attribs, c_array< PainterIndex > dst_indices, unsigned int index_adjust)
void pack_rounded_join_size(const TessellatedPath::join &join, float thresh, unsigned int *num_attributes, unsigned int *num_indices)
cap_style
Enumeration specifying if and how to draw caps when stroking.
file c_array.hpp
void pack_rounded_cap_size(float thresh, unsigned int *num_attributes, unsigned int *num_indices)
packed_data_bit_flat_cap_t
Enumeration encoding of bits of m_packed_data for those with offset type offset_flat_cap.
packed_data_bit_sub_edge_t
Enumeration encoding of bits of m_packed_data for those with offset type offset_sub_edge.
packed_data_bit_layout_common_t
Enumeration encoding of bits of m_packed_data common to all offset types.
The attribute data generated/filled by Painter. Attribute data is sent to 3D API as raw bits with the...
offset_type_t
Enumeration for specifing the point type which in turn determines the meaning of the fields m_pre_off...
file util.hpp
void pack_point(PainterAttribute *dst) const
enum offset_type_t offset_type(void) const
join_style
Enumeration specifying if and how to draw joins when stroking.
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
file painter_enums.hpp
file vecN.hpp
void pack_segment_chain_size(const TessellatedPath::segment_chain &chain, unsigned int *depth_range_size, unsigned int *num_attributes, unsigned int *num_indices)
static void unpack_point(StrokedPoint *dst, const PainterAttribute &src)
uint32_t pack_bits(uint32_t bit0, uint32_t num_bits, uint32_t value)
Definition: util.hpp:294
void pack_cap(enum cap_type_t cp, const TessellatedPath::cap &cap, unsigned int depth, c_array< PainterAttribute > dst_attribs, c_array< PainterIndex > dst_indices, unsigned int index_adjust)
packed_data_bit_masks_t
Enumeration holding bit masks.
file painter_attribute.hpp
packed_data_bit_adjustable_cap_t
Enumeration encoding of bits of m_packed_data for those with offset type offset_adjustable_cap.
packed_data_bit_layout_miter_join_t
Enumeration encoding of bits of m_packed_data for those with offset type offset_miter_clip_join.