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

A StrokedPoint holds the data for a point of stroking where all segments are line segments (coming from curve tessellation). The upshot is that the fragment shader does NOT perform any coverage computation for non-dashed stroking. In addition, the data is so that changing the stroking width or miter limit does not change the stroking data. More...

#include <stroked_point.hpp>

Public Types

enum  offset_type_t {
  offset_sub_edge, offset_shared_with_edge, offset_rounded_join, offset_miter_clip_join,
  offset_miter_bevel_join, offset_miter_join, offset_rounded_cap, offset_square_cap,
  offset_adjustable_cap, offset_flat_cap, number_offset_types
}
 Enumeration for specifing the point type which in turn determines the meaning of the fields m_pre_offset and m_auxiliary_offset. More...
 
enum  packed_data_bit_adjustable_cap_t { adjustable_cap_ending_bit = number_common_bits, adjustable_cap_is_end_contour_bit }
 Enumeration encoding of bits of m_packed_data for those with offset type offset_adjustable_cap. More...
 
enum  packed_data_bit_flat_cap_t { flat_cap_ending_bit = number_common_bits, flat_cap_is_end_contour_bit }
 Enumeration encoding of bits of m_packed_data for those with offset type offset_flat_cap. More...
 
enum  packed_data_bit_layout_common_t {
  offset_type_bit0 = 0, offset_type_num_bits = 4, boundary_bit = offset_type_bit0 + offset_type_num_bits, depth_bit0,
  depth_num_bits = 20, join_bit = depth_bit0 + depth_num_bits, number_common_bits
}
 Enumeration encoding of bits of m_packed_data common to all offset types. More...
 
enum  packed_data_bit_layout_miter_join_t { lambda_negated_bit = number_common_bits }
 Enumeration encoding of bits of m_packed_data for those with offset type offset_miter_clip_join. More...
 
enum  packed_data_bit_layout_rounded_join_t { normal0_y_sign_bit = number_common_bits, normal1_y_sign_bit, sin_sign_bit }
 Enumeration encoding of bits of m_packed_data for those with offset type offset_rounded_join. 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), depth_mask = FASTUIDRAW_MASK(depth_bit0, depth_num_bits), end_sub_edge_mask = FASTUIDRAW_MASK(end_sub_edge_bit, 1),
  bevel_edge_mask = FASTUIDRAW_MASK(bevel_edge_bit, 1), normal0_y_sign_mask = FASTUIDRAW_MASK(normal0_y_sign_bit, 1), normal1_y_sign_mask = FASTUIDRAW_MASK(normal1_y_sign_bit, 1), sin_sign_mask = FASTUIDRAW_MASK(sin_sign_bit, 1),
  lambda_negated_mask = FASTUIDRAW_MASK(lambda_negated_bit, 1), join_mask = FASTUIDRAW_MASK(join_bit, 1), adjustable_cap_ending_mask = FASTUIDRAW_MASK(adjustable_cap_ending_bit, 1), adjustable_cap_is_end_contour_mask = FASTUIDRAW_MASK(adjustable_cap_is_end_contour_bit, 1),
  flat_cap_ending_mask = FASTUIDRAW_MASK(flat_cap_ending_bit, 1), flat_cap_is_end_contour_mask = FASTUIDRAW_MASK(flat_cap_is_end_contour_bit, 1)
}
 Enumeration holding bit masks. More...
 
enum  packed_data_bit_sub_edge_t { end_sub_edge_bit = number_common_bits, bevel_edge_bit }
 Enumeration encoding of bits of m_packed_data for those with offset type offset_sub_edge. More...
 

Public Member Functions

uint32_t depth (void) const
 
void depth (const uint32_t v)
 
enum offset_type_t offset_type (void) const
 
int on_boundary (void) const
 
void pack_point (PainterAttribute *dst) const
 

Static Public Member Functions

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

Public Attributes

vec2 m_auxiliary_offset
 
float m_contour_length
 
float m_distance_from_contour_start
 
float m_distance_from_edge_start
 
float m_edge_length
 
uint32_t m_packed_data
 
vec2 m_position
 
vec2 m_pre_offset
 

Detailed Description

A StrokedPoint holds the data for a point of stroking where all segments are line segments (coming from curve tessellation). The upshot is that the fragment shader does NOT perform any coverage computation for non-dashed stroking. In addition, the data is so that changing the stroking width or miter limit does not change the stroking data.

Definition at line 46 of file stroked_point.hpp.

Member Enumeration Documentation

◆ offset_type_t

Enumeration for specifing the point type which in turn determines the meaning of the fields m_pre_offset and m_auxiliary_offset.

Enumerator
offset_sub_edge 

The point is for an edge of the path, point signifies the start or end of a sub-edge (quad) of drawing an edge. The meanings of m_pre_offset and m_auxiliary_offset are:

offset_shared_with_edge 

The point is at a position that has the same value as point on an edge but the point itself is part of a cap or join. The meanings of the members m_pre_offset and m_auxiliary_offset are:

  • m_pre_offset the normal vector to the edge in which move the point by the stroking width when stroking; this vector can be (0, 0).
  • m_auxiliary_offset unused (set to (0, 0))
offset_rounded_join 

The point is for a boundary point of a rounded join of the path. The meanings of the members m_pre_offset and and m_auxiliary_offset are:

  • m_pre_offset the .x() component holds the unit normal vector between the join point and the edge going into the join. The .y() component holds the unit normal vector between the join point and the edge leaving the join. The packing is that the x-coordinate value is given and the y-coordinate magnitude is $ sqrt(1 - x^2) $. If the bit normal0_y_sign_bit is up, then the y-coordinate for the normal vector of going into the join, then the y-value is negative. If the bit normal1_y_sign_bit is up, then the y-coordinate for the normal vector of leaving the join, then the y-value is negative.
  • m_auxiliary_offset the .x() component gives an interpolation in the range [0, 1] to interpolate between the normal vectors packed in m_pre_offset. The .y() value gives the normal vector directly but packed (as in m_pre_offset) where the y-coordinate sign is negative if the bit sin_sign_mask is up.
offset_miter_clip_join 

Point type for miter-clip join point whose position depends on the stroking radius and the miter-limit. The meanings of m_pre_offset and m_auxiliary_offset are:

  • m_pre_offset gives the unit normal vector of the edge going into the join
  • m_auxiliary_offset gives the unit normal vector of the edge leaving the join
offset_miter_bevel_join 

Point type for miter-bevel join point whose position depends on the stroking radius and the miter-limit. The meanings of m_pre_offset and m_auxiliary_offset are:

  • m_pre_offset gives the unit normal vector of the edge going into the join
  • m_auxiliary_offset gives the unit normal vector of the edge leaving the join
offset_miter_join 

Point type for miter join whose position position depends on the stroking radius and the miter-limit. The meanings of m_pre_offset and m_auxiliary_offset are:

  • m_pre_offset gives the unit normal vector of the edge going into the join
  • m_auxiliary_offset gives the unit normal vector of the edge leaving the join
offset_rounded_cap 

The point is for a boundary point of a rounded cap of the path. The meanings of m_pre_offset and m_auxiliary_offset are:

offset_square_cap 

The point is for a boundary point of a square cap of the path, the meanings of m_pre_offset and m_auxiliary_offset are:

  • m_pre_offset is the normal vector to the path by which to move the point
  • m_auxiliary_offset is the tangent vector to the path by which to move the point
offset_adjustable_cap 

The point is a point of an adjustable cap. These points are for dashed stroking with caps; they contain data to allow one from a vertex shader to extend or shrink the cap area correctly to implement dashed stroking. The meanings of m_pre_offset and m_auxiliary_offset are:

  • m_pre_offset is the normal vector to the path by which to move the point; this value can be (0, 0) to indicate to not move perpindicular to the path
  • m_auxiliary_offset is the tangent vector to the path by which to move the point; this value can be (0, 0) to indicate to not move parallel to the path
offset_flat_cap 

The point is a point of a flat cap. These points are for doing anti-aliasing at the starting and ending of an open contour. The meanings of m_pre_offset and m_auxiliary_offset are:

  • m_pre_offset is the normal vector to the path by which to move the point; this value can be (0, 0) to indicate to not move perpindicular to the path
  • m_auxiliary_offset is the tangent vector to the path by which to move the point; this value can be (0, 0) to indicate to not move parallel to the path
number_offset_types 

Number different point types with respect to rendering

Definition at line 55 of file stroked_point.hpp.

◆ packed_data_bit_adjustable_cap_t

Enumeration encoding of bits of m_packed_data for those with offset type offset_adjustable_cap.

Enumerator
adjustable_cap_ending_bit 

The bit is up if the point is for end of point of a cap (i.e. the side to be extended to make sure the entire cap near the end of edge is drawn).

adjustable_cap_is_end_contour_bit 

The bit is up if the point is for cap at the end of the contour.

Definition at line 323 of file stroked_point.hpp.

◆ packed_data_bit_flat_cap_t

Enumeration encoding of bits of m_packed_data for those with offset type offset_flat_cap.

Enumerator
flat_cap_ending_bit 

The bit is up if the point is for end of point of a cap (i.e. the side to be extended to make sure the entire cap near the end of edge is drawn).

flat_cap_is_end_contour_bit 

The bit is up if the point is for cap at the end of the contour.

Definition at line 344 of file 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 for holding boundary() value of the point

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.

join_bit 

Bit to indicate point is from a join. For these points, during dashed stroking. For joins, one is guaranteed that the distance values for all points of a fixed join are the same.

number_common_bits 

Number of bits used on common packed data

Definition at line 207 of file stroked_point.hpp.

◆ packed_data_bit_layout_miter_join_t

Enumeration encoding of bits of m_packed_data for those with offset type offset_miter_clip_join.

Enumerator
lambda_negated_bit 

Indicates that the lambda of the miter-join computation should be negated.

Definition at line 309 of file stroked_point.hpp.

◆ packed_data_bit_layout_rounded_join_t

Enumeration encoding of bits of m_packed_data for those with offset type offset_rounded_join.

Enumerator
normal0_y_sign_bit 

Bit for holding the the sign of the y-coordinate of the normal 0 for the offset_type() offset_rounded_join.

normal1_y_sign_bit 

Bit for holding the the sign of the y-coordinate of the normal 1 for the offset_type() offset_rounded_join.

sin_sign_bit 

Bit for holding the the sign of sin() value for the offset_type() offset_rounded_join.

Definition at line 278 of file stroked_point.hpp.

◆ packed_data_bit_masks_t

Enumeration holding bit masks.

Enumerator
offset_type_mask 

Mask generated for offset_type_bit0 and offset_type_num_bits

boundary_mask 

Mask generated for boundary_bit

depth_mask 

Mask generated for depth_bit0 and depth_num_bits

end_sub_edge_mask 

Mask generated for end_sub_edge_bit

bevel_edge_mask 

Mask generated for bevel_edge_bit

normal0_y_sign_mask 

Mask generated for normal0_y_sign_bit

normal1_y_sign_mask 

Mask generated for normal1_y_sign_bit

sin_sign_mask 

Mask generated for sin_sign_bit sin_sign_bit

lambda_negated_mask 

Mask generated for lambda_negated_mask

join_mask 

Mask generated for join_bit

adjustable_cap_ending_mask 

Mask generated for adjustable_cap_ending_bit

adjustable_cap_is_end_contour_mask 

Mask generated for adjustable_cap_is_end_contour_bit

flat_cap_ending_mask 

Mask generated for flat_cap_ending_bit

flat_cap_is_end_contour_mask 

Mask generated for adjustable_cap_is_end_contour_bit

Definition at line 364 of file stroked_point.hpp.

◆ packed_data_bit_sub_edge_t

Enumeration encoding of bits of m_packed_data for those with offset type offset_sub_edge.

Enumerator
end_sub_edge_bit 

If this bit is down indicates the point is the start of a sub-edge; if the bit is up, indicates that the point is the end of a subedge.

bevel_edge_bit 

The bit is up if the point is for the geometry of a bevel between two sub-edges.

Definition at line 257 of file stroked_point.hpp.

Member Function Documentation

◆ depth() [1/2]

uint32_t fastuidraw::StrokedPoint::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 531 of file stroked_point.hpp.

◆ depth() [2/2]

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

Set the value returned by depth().

Definition at line 540 of file stroked_point.hpp.

◆ offset_type() [1/2]

enum offset_type_t fastuidraw::StrokedPoint::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 517 of file stroked_point.hpp.

◆ offset_type() [2/2]

static enum offset_type_t fastuidraw::StrokedPoint::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 505 of file stroked_point.hpp.

◆ on_boundary()

int fastuidraw::StrokedPoint::on_boundary ( void  ) const
inline

Has value 0 or 1. If the value is 0, then the point is on the path. If the value has value 1, then indicates a point that is on the boundary of the stroked path.

Definition at line 553 of file stroked_point.hpp.

◆ pack_point()

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

◆ unpack_point()

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

Unpack a StrokedPoint from a Painter Attribute.

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

Member Data Documentation

◆ m_auxiliary_offset

vec2 fastuidraw::StrokedPoint::m_auxiliary_offset

Gives values to help compute the location of the point after applying the stroking width. See the descriptions to the elements of offset_type_t for its meaning for different offset types.

Definition at line 458 of file stroked_point.hpp.

◆ m_contour_length

float fastuidraw::StrokedPoint::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 484 of file stroked_point.hpp.

◆ m_distance_from_contour_start

float fastuidraw::StrokedPoint::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 470 of file stroked_point.hpp.

◆ m_distance_from_edge_start

float fastuidraw::StrokedPoint::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 464 of file stroked_point.hpp.

◆ m_edge_length

float fastuidraw::StrokedPoint::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 477 of file stroked_point.hpp.

◆ m_packed_data

uint32_t fastuidraw::StrokedPoint::m_packed_data

Bit field with data packed as according to packed_data_bit_layout_common_t, packed_data_bit_layout_rounded_join_t, packed_data_bit_adjustable_cap_t and packed_data_bit_sub_edge_t. See also, packed_data_bit_masks_t for bit masks generated.

Definition at line 495 of file stroked_point.hpp.

◆ m_position

vec2 fastuidraw::StrokedPoint::m_position

The base position of a point before applying the stroking width to the position.

Definition at line 442 of file stroked_point.hpp.

◆ m_pre_offset

vec2 fastuidraw::StrokedPoint::m_pre_offset

Gives values to help compute the location of the point after applying the stroking width. See the descriptions to the elements of offset_type_t for its meaning for different offset types.

Definition at line 450 of file stroked_point.hpp.


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