FastUIDraw
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
fastuidraw::ArcStrokedPoint Class Reference

An ArcStrokedPoint holds the data for a point of stroking where the segments can be arcs of a circle. The upshot is that a fragment shader will determine per-pixel coverage. In addition, the data is so that changing the stroking width or miter limit does not change the stroking data. More...

#include <arc_stroked_point.hpp>

Public Types

enum  offset_type_t { offset_arc_point, offset_line_segment, offset_arc_point_dashed_capper, number_offset_types }
 Enumeration type to specify how to compute the location of an ArcStrokedPoint. More...
 
enum  packed_data_bit_arc_point_dashed_capper { extend_bit = number_common_bits }
 
enum  packed_data_bit_layout_common_t {
  offset_type_bit0 = 0, offset_type_num_bits = 2, boundary_bit = offset_type_bit0 + offset_type_num_bits, end_segment_bit,
  distance_constant_on_primitive_bit, join_bit, depth_bit0, depth_num_bits = 20,
  number_common_bits = depth_bit0 + depth_num_bits
}
 Enumeration encoding of bits of m_packed_data common to all offset types. More...
 
enum  packed_data_bit_masks_t {
  offset_type_mask = FASTUIDRAW_MASK(offset_type_bit0, offset_type_num_bits), boundary_mask = FASTUIDRAW_MASK(boundary_bit, 1), beyond_boundary_mask = FASTUIDRAW_MASK(beyond_boundary_bit, 1), inner_stroking_mask = FASTUIDRAW_MASK(inner_stroking_bit, 1),
  move_to_arc_center_mask = FASTUIDRAW_MASK(move_to_arc_center_bit, 1), end_segment_mask = FASTUIDRAW_MASK(end_segment_bit, 1), distance_constant_on_primitive_mask = FASTUIDRAW_MASK(distance_constant_on_primitive_bit, 1), join_mask = FASTUIDRAW_MASK(join_bit, 1),
  extend_mask = FASTUIDRAW_MASK(extend_bit, 1), depth_mask = FASTUIDRAW_MASK(depth_bit0, depth_num_bits)
}
 Enumeration holding bit masks generated from values in packed_data_bit_layout_common_t. More...
 
enum  packed_data_bit_stroking_boundary_t { beyond_boundary_bit = number_common_bits, inner_stroking_bit, move_to_arc_center_bit }
 

Public Member Functions

float arc_angle (void) const
 
float & arc_angle (void)
 
uint32_t depth (void) const
 
void depth (const uint32_t v)
 
enum offset_type_t offset_type (void) const
 
void pack_point (PainterAttribute *dst) const
 
float radius (void) const
 
float & radius (void)
 

Static Public Member Functions

static enum offset_type_t offset_type (uint32_t packed_data_value)
 
static void unpack_point (ArcStrokedPoint *dst, const PainterAttribute &src)
 

Public Attributes

float m_contour_length
 
vec2 m_data
 
float m_distance_from_contour_start
 
float m_distance_from_edge_start
 
float m_edge_length
 
vec2 m_offset_direction
 
uint32_t m_packed_data
 
vec2 m_position
 

Detailed Description

An ArcStrokedPoint holds the data for a point of stroking where the segments can be arcs of a circle. The upshot is that a fragment shader will determine per-pixel coverage. In addition, the data is so that changing the stroking width or miter limit does not change the stroking data.

Definition at line 43 of file arc_stroked_point.hpp.

Member Enumeration Documentation

◆ offset_type_t

Enumeration type to specify how to compute the location of an ArcStrokedPoint.

Enumerator
offset_arc_point 

A point of an arc. Indicates the point is part of an arc.

offset_line_segment 

The point is part of a line-segment

offset_arc_point_dashed_capper 

Represents a point at the start or end of an edge. When performing dashed stroking with caps, these points can be expanded into quads to cover a cap induced by stroking at the start or end of an edge.

number_offset_types 

Number of offset types, not an actual offset type(!).

Definition at line 51 of file arc_stroked_point.hpp.

◆ packed_data_bit_arc_point_dashed_capper

Enumeration of the bits of m_packed_data for those with offset type offset_arc_point_dashed_capper

Enumerator
extend_bit 

if up, the point is to be moved in the direction of m_data to cover an induced cap.

Definition at line 177 of file arc_stroked_point.hpp.

◆ packed_data_bit_layout_common_t

Enumeration encoding of bits of m_packed_data common to all offset types.

Enumerator
offset_type_bit0 

Bit0 for holding the offset_type() value of the point.

offset_type_num_bits 

number of bits needed to hold the offset_type() value of the point.

boundary_bit 

Bit indicates that the point in on the stroking boundary. Points with this bit down have that the vertex position after stroking is the same as m_position.

end_segment_bit 

Bit indicates that point is on the end of a segment.

distance_constant_on_primitive_bit 

Bit indicates that when doing dashed stroking that the value the distance value is the same for all points of a triangle, i.e. the dashed coverage computation can be done purely from the vertex shader

join_bit 

Bit indicates that the primitive formed is for a join

depth_bit0 

Bit0 for holding the depth() value of the point

depth_num_bits 

number of bits needed to hold the depth() value of the point.

number_common_bits 

Number of bits used on common packed data

Definition at line 84 of file arc_stroked_point.hpp.

◆ packed_data_bit_masks_t

Enumeration holding bit masks generated from values in packed_data_bit_layout_common_t.

Enumerator
offset_type_mask 

Mask generated for offset_type_bit0 and offset_type_num_bits

boundary_mask 

Mask generated for boundary_bit

beyond_boundary_mask 

Mask generated for boundary_bit

inner_stroking_mask 

Mask generated for inner_stroking_bit

move_to_arc_center_mask 

Mask generated for move_to_arc_center_bit

end_segment_mask 

Mask generated for end_segment_bit

distance_constant_on_primitive_mask 

Mask generated for distance_constant_on_primitive_bit

join_mask 

Mask generated for join_bit

extend_mask 

Mask generated for extend_bit

depth_mask 

Mask generated for depth_bit0 and depth_num_bits

Definition at line 191 of file arc_stroked_point.hpp.

◆ packed_data_bit_stroking_boundary_t

Enumeration of the bits of m_packed_data for those with offset type offset_arc_point

Enumerator
beyond_boundary_bit 

Bit indicates that the point is a beyond stroking boundary bit. These points go beyond the stroking boundary to make sure that the triangles emitted contain the stroked arc.

inner_stroking_bit 

If bit is up, then point is on the inside stroking boundary, otherwise the point is on the outside stroking boundary.

move_to_arc_center_bit 

When this bit is up and the stroking radius exceeds the arc-radius, the point should be placed at the center of the arc.

Definition at line 148 of file arc_stroked_point.hpp.

Member Function Documentation

◆ arc_angle() [1/2]

float fastuidraw::ArcStrokedPoint::arc_angle ( void  ) const
inline

If a point from an arc-segment, gives the angle of the arc, equivalent to m_data[1].

Definition at line 350 of file arc_stroked_point.hpp.

◆ arc_angle() [2/2]

float& fastuidraw::ArcStrokedPoint::arc_angle ( void  )
inline

If a point from an arc-segment, gives the angle of the arc, equivalent to m_data[1].

Definition at line 360 of file arc_stroked_point.hpp.

◆ depth() [1/2]

uint32_t fastuidraw::ArcStrokedPoint::depth ( void  ) const
inline

When stroking the data, the depth test to only pass when the depth value is -strictly- larger so that a fixed pixel is not stroked twice by a single path. The value returned by depth() is a relative z-value for a vertex. The points drawn first have the largest z-values.

Definition at line 374 of file arc_stroked_point.hpp.

◆ depth() [2/2]

void fastuidraw::ArcStrokedPoint::depth ( const uint32_t  v)
inline

Set the value returned by depth().

Definition at line 383 of file arc_stroked_point.hpp.

◆ offset_type() [1/2]

static enum offset_type_t fastuidraw::ArcStrokedPoint::offset_type ( uint32_t  packed_data_value)
inlinestatic

Provides the point type from a value of m_packed_data. The return value is one of the enumerations of offset_type_t.

Parameters
packed_data_valuevalue suitable for m_packed_data

Definition at line 308 of file arc_stroked_point.hpp.

◆ offset_type() [2/2]

enum offset_type_t fastuidraw::ArcStrokedPoint::offset_type ( void  ) const
inline

Provides the point type for the point. The return value is one of the enumerations of offset_type_t.

Definition at line 320 of file arc_stroked_point.hpp.

◆ pack_point()

void fastuidraw::ArcStrokedPoint::pack_point ( PainterAttribute dst) const

◆ radius() [1/2]

float fastuidraw::ArcStrokedPoint::radius ( void  ) const
inline

If a point from an arc-segment, gives the radius of the arc, equivalent to m_data[0].

Definition at line 330 of file arc_stroked_point.hpp.

◆ radius() [2/2]

float& fastuidraw::ArcStrokedPoint::radius ( void  )
inline

If a point from an arc-segment, gives the radius of the arc, equivalent to m_data[0].

Definition at line 340 of file arc_stroked_point.hpp.

◆ unpack_point()

static void fastuidraw::ArcStrokedPoint::unpack_point ( ArcStrokedPoint dst,
const PainterAttribute src 
)
static

Unpack an ArcStrokedPoint from a Painter Attribute.

Parameters
dstpoint to which to unpack data
srcPainterAttribute from which to unpack data

Member Data Documentation

◆ m_contour_length

float fastuidraw::ArcStrokedPoint::m_contour_length

Gives the length of the contour on which the point lies. This value is the same for all points along a fixed contour.

Definition at line 293 of file arc_stroked_point.hpp.

◆ m_data

vec2 fastuidraw::ArcStrokedPoint::m_data

Meaning of m_data depends on offset_type(). If offset_type() is offset_line_segment, then m_data holds the vector from this point to other point of the line segment. Otherwise, m_data[0] holds the radius of the arc and m_data[1] holds the angle difference from the end of the arc to the start of the arc.

Definition at line 267 of file arc_stroked_point.hpp.

◆ m_distance_from_contour_start

float fastuidraw::ArcStrokedPoint::m_distance_from_contour_start

Gives the distance of the point from the start of the -contour- on which the point resides.

Definition at line 279 of file arc_stroked_point.hpp.

◆ m_distance_from_edge_start

float fastuidraw::ArcStrokedPoint::m_distance_from_edge_start

Gives the distance of the point from the start of the -edge- on which the point resides.

Definition at line 273 of file arc_stroked_point.hpp.

◆ m_edge_length

float fastuidraw::ArcStrokedPoint::m_edge_length

Gives the length of the edge on which the point lies. This value is the same for all points along a fixed edge.

Definition at line 286 of file arc_stroked_point.hpp.

◆ m_offset_direction

vec2 fastuidraw::ArcStrokedPoint::m_offset_direction

Gives the unit vector in which to push the point. For those points that are arc's the location of the center is always given by m_position - radius() * m_offset_direction

Definition at line 256 of file arc_stroked_point.hpp.

◆ m_packed_data

uint32_t fastuidraw::ArcStrokedPoint::m_packed_data

Bit field with data packed.

Definition at line 298 of file arc_stroked_point.hpp.

◆ m_position

vec2 fastuidraw::ArcStrokedPoint::m_position

Give the position of the point on the path.

Definition at line 248 of file arc_stroked_point.hpp.


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