FastUIDraw
Classes | Public Types | Public Member Functions | List of all members
fastuidraw::GlyphRenderDataRestrictedRays Class Reference

#include <glyph_render_data_restricted_rays.hpp>

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

Classes

class  query_info
 

Public Types

enum  { glyph_coord_value = 2048 }
 
enum  attribute_values_t { glyph_normalized_x, glyph_normalized_y, glyph_offset, glyph_num_attributes }
 
enum  curve_list_packing_t {
  curve_numbits = 16u, curve_entry0_bit0 = 0u, curve_entry1_bit0 = 16u, curve_is_quadratic_bit = 15u,
  curve_location_bit0 = 0u, curve_location_numbits = 15u
}
 
enum  hierarchy_packing_t {
  hierarchy_child_offset_numbits = 15u, hierarchy_leaf_curve_list_numbits = 16u, hierarchy_leaf_curve_list_size_numbits = 15u, hierarchy_is_node_bit = 0u,
  hierarchy_splitting_coordinate_bit = hierarchy_is_node_bit + 1u, hierarchy_child0_offset_bit0 = hierarchy_splitting_coordinate_bit + 1u, hierarchy_child1_offset_bit0 = hierarchy_child0_offset_bit0 + hierarchy_child_offset_numbits, hierarchy_leaf_curve_list_bit0 = hierarchy_is_node_bit + 1u,
  hierarchy_leaf_curve_list_size_bit0 = hierarchy_leaf_curve_list_bit0 + hierarchy_leaf_curve_list_numbits
}
 
enum  point_packing_t
 
enum  winding_sample_packing_t {
  winding_bias = 32768u, winding_value_bit0 = 0u, winding_value_numbits = 16u, delta_div_factor = 256,
  delta_x_bit0 = 16u, delta_y_bit0 = 24u, delta_numbits = 8u
}
 

Public Member Functions

 GlyphRenderDataRestrictedRays (void)
 
void finalize (enum PainterEnums::fill_rule_t f, const Rect &glyph_rect, float units_per_EM)
 
void finalize (enum PainterEnums::fill_rule_t f, const Rect &glyph_rect, int split_thresh, int max_recursion, vec2 near_thresh)
 
void line_to (vec2 pt)
 
void move_to (vec2 pt)
 
void quadratic_to (vec2 ct, vec2 pt)
 
enum return_code query (query_info *out_info) const
 
virtual c_array< const c_stringrender_info_labels (void) const
 
virtual enum fastuidraw::return_code upload_to_atlas (GlyphAtlasProxy &atlas_proxy, GlyphAttribute::Array &attributes, c_array< float > render_costs) const
 

Detailed Description

A GlyphRenderDataRestrictedRays represents the data needed to build a glyph to render it. The technique operates as follows:

NOTE: this is NOT the techinque as patented by Eric Lengyel that computes by a lookup table keyed by the 3 conditions of examing q1, q2, q3 against 0. The Lengyel technique does give a fast shader, but we cannot use it because of the patent on it.

Definition at line 60 of file glyph_render_data_restricted_rays.hpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
glyph_coord_value 

The glyph coordinate value in each coordiante varies from -glyph_coord_value to +glyph_coord_value, i.e. the glyph is drawn as rect with min-corner (-glyph_coord_value, -glyph_coord_value) and max-corner (+glyph_coord_value, +glyph_coord_value)

Definition at line 278 of file glyph_render_data_restricted_rays.hpp.

◆ attribute_values_t

This enumeration describes the meaning of the attributes. The glyph shader is to assume that the glyph-coordinates at the min-corner is (-glyph_coord_value, -glyph_coord_value) and the glyph coordiantes at the max-corner is (+glyph_coord_value, +glyph_coord_value)

Enumerator
glyph_normalized_x 

Value is 0 if on min-x side of glyph, value is 1 if on max-x side of glyph; packed as uint.

glyph_normalized_y 

Value is 0 if on min-y side of glyph, value is 1 if on max-y side of glyph; packed as uint.

glyph_offset 

the index into GlyphAttribute::m_data storing the fill rule and the offset into the store for the glyph data. The offset is encoded as follows

  • bits0-bits29 encode the offset
  • bit30 indicates to complement fill
  • bit31 up indicates odd-even fill rule and down indicates non-zero fill rule.
glyph_num_attributes 

Number attribute values needed.

Definition at line 298 of file glyph_render_data_restricted_rays.hpp.

◆ curve_list_packing_t

Enumeration to describe how a list of curves is packed. Each 32-bit value holds the data for two curves. A curve entry is 16-bit value whose highest bit gives the degree of the curve and the remaining 15-bits give the offset to the location of the curve's control points.

Enumerator
curve_numbits 

The number of bits to store a single curve entry.

curve_entry0_bit0 

The first bit used for the first curve of the entry.

curve_entry1_bit0 

The first bit used for the second curve of the entry.

curve_is_quadratic_bit 

Given an unpacked curve entry (which is 16-bits wide), if this bit of the value is up, then the curve referenced is a quadratic Bezier curve having control points. Otherwise, it is a line segment connecting its two points.

curve_location_bit0 

Given an unpacked curve entry (which is 16-bits wide), this is the first bit used to store the offset to the location of the points of the curve (packed as according to point_packing_t).

curve_location_numbits 

Given an unpacked curve entry (which is 16-bits wide), this is the number of bits used to store the offset to the location of the points of the curve (packed as according to point_packing_t).

Definition at line 229 of file glyph_render_data_restricted_rays.hpp.

◆ hierarchy_packing_t

Enumeration to describe the hierarchy of bounding boxes as packed into the data. A node in the hierarchy is a single 32-bit value. A leaf in the hierarchy is a single 32-bit value followed by a single sample point which has a winding value and offset position packed as according to winding_sample_packing_t.

Enumerator
hierarchy_child_offset_numbits 

This is the number of bits used to store the offsets to a child node.

hierarchy_leaf_curve_list_numbits 

For case where the element is leaf, i.e. the bit hierarchy_is_node_bit is down. This is the number bit used to encode the offset to where the list of curves for the box is located. The list of curves is packed as according to curve_list_packing_t.

hierarchy_leaf_curve_list_size_numbits 

For case where the element is leaf, i.e. the bit hierarchy_is_node_bit is down. This is the number of bits used to encode the size of the list of curves for the box is located. The list of curves is packed as according to curve_list_packing_t.

hierarchy_is_node_bit 

If this bit is up, indicates that the 32-bit value is holding node data. If the bit is down indicates that the element is a leaf and the value holds the properties of the curve list in the box and the next value holds the winding sample information for the box and are packed as according to winding_sample_packing_t.

hierarchy_splitting_coordinate_bit 

For case where the element is a node, i.e. the bit hierarchy_is_node_bit is up. This bit indicates if the split of the node is horizontal of verical. A value of 0 indicates that the split happens in the x-coordinate (i.e. the child nodes have the same values for min-y and max-y) and a value of 1 indicates the split happens in the y-coordinate.

hierarchy_child0_offset_bit0 

For case where the element is a node, i.e. the bit hierarchy_is_node_bit is up. This is the first bit holding the offset from the start of the geomertic data of the glyph for the child node which comes before the split, i.e. the child on the left or bottom side.

hierarchy_child1_offset_bit0 

For case where the element is a node, i.e. the bit hierarchy_is_node_bit is up. This is the first bit holding the offset from the start of the geomertic data of the glyph for the child node which comes after the split, i.e. the child on the right or top side.

hierarchy_leaf_curve_list_bit0 

For case where the element is leaf, i.e. the bit hierarchy_is_node_bit is down. This is the first bit used to encode the offset to where the list of curves for the box is located. The list of curves is packed as according to curve_list_packing_t.

hierarchy_leaf_curve_list_size_bit0 

For case where the element is leaf, i.e. the bit hierarchy_is_node_bit is down. This is the first bit used to encode the size of the list of curves for the box is located. The list of curves is packed as according to curve_list_packing_t.

Definition at line 72 of file glyph_render_data_restricted_rays.hpp.

◆ point_packing_t

Points are packed as (fp16, fp16) pairs.

Definition at line 274 of file glyph_render_data_restricted_rays.hpp.

◆ winding_sample_packing_t

Enumeration to describe how the winding samples of a leaf-box of the hierarchy are packed. The position of the sample is the bottom left corner of the node offset by a delta: $ Delta = RelativeDelta * BoxDimensions / DeltaFactor $ where PackedDelta is extracted from the 32-bit value as a pair of 8-bit values located at bits delta_x_bit0 and delta_y_bit0; DeltaFactor is given by delta_div_factor and BoxDimensions is the width and height of the box of the leaf.

Enumerator
winding_bias 

Winding values are stored biased (in order to be able to store negative winding values) This is the value to add to the unpacked winding number found at bit winding_value_bit0

winding_value_bit0 

The first bit used to encode the winding value (which is stored biased by winding_bias).

winding_value_numbits 

The number of bits used to encode the winding value (which is stored biased by winding_bias).

delta_div_factor 

The amount by which to divide the delta

delta_x_bit0 

The first bit used to store the delta x-coordinate

delta_y_bit0 

The first bit used to store the delta y-coordinate

delta_numbits 

The number of bits used to store the delta x-coordinate and delta y-coordinate values.

Definition at line 177 of file glyph_render_data_restricted_rays.hpp.

Constructor & Destructor Documentation

◆ GlyphRenderDataRestrictedRays()

fastuidraw::GlyphRenderDataRestrictedRays::GlyphRenderDataRestrictedRays ( void  )

Ctor.

Member Function Documentation

◆ finalize() [1/2]

void fastuidraw::GlyphRenderDataRestrictedRays::finalize ( enum PainterEnums::fill_rule_t  f,
const Rect glyph_rect,
float  units_per_EM 
)

Finalize the input data after which no more contours or curves may be added; all added contours must be closed before calling finalize(). Once finalize() is called, no further data can be added. How the data is broken into bounding boxes is specified by

◆ finalize() [2/2]

void fastuidraw::GlyphRenderDataRestrictedRays::finalize ( enum PainterEnums::fill_rule_t  f,
const Rect glyph_rect,
int  split_thresh,
int  max_recursion,
vec2  near_thresh 
)

Finalize the input data after which no more contours or curves may be added; all added contours must be closed before calling finale(). Once finalize() is called, no further data can be added. Instead of using methods from GlyphGenerateParams, directly specify how the data is broken into boxes.

Parameters
ffill rule to use for rendering
glyph_rectthe rect of the glyph
split_threshif the number of curves within a box is greater than this value, the box is split
max_recursionthe maximum level of recursion allowed in splitting the data into boxes
near_threshhorizontal and vertical threshhold to decide if a curve outside of a box should be added to a box

◆ line_to()

void fastuidraw::GlyphRenderDataRestrictedRays::line_to ( vec2  pt)

Add a line segment connecting the end point of the last curve or line segment of the current contour to a given point.

Parameters
ptend point of the new line segment

◆ move_to()

void fastuidraw::GlyphRenderDataRestrictedRays::move_to ( vec2  pt)

Start a contour. Before starting a new contour the previous contour must be closed by calling line_to() or quadratic_to() connecting to the start point of the previous contour.

Parameters
ptstart point of the new contour

◆ quadratic_to()

void fastuidraw::GlyphRenderDataRestrictedRays::quadratic_to ( vec2  ct,
vec2  pt 
)

Add a quadratic curveconnecting the end point of the last curve or line segment of the current contour

Parameters
ctcontrol point of the quadratic curve
ptend point of the quadratic curve

◆ query()

enum return_code fastuidraw::GlyphRenderDataRestrictedRays::query ( query_info out_info) const

Query the data; may only be called after finalize(). Returns routine_fail if finalize() has not yet been called.

Parameters
out_infolocation to which to write information about this object.

◆ render_info_labels()

virtual c_array<const c_string> fastuidraw::GlyphRenderDataRestrictedRays::render_info_labels ( void  ) const
virtual

To be implemented by a derived class to return the strings used in GlyphRenderCostInfo::m_value; The pointer behind each of the string in the return c_array returned are required to stay valid even after the GlyphRenderData is deleted. The expectation is that the returned c_array is just c_array wrapping over a static constant array of string.

Implements fastuidraw::GlyphRenderData.

◆ upload_to_atlas()

virtual enum fastuidraw::return_code fastuidraw::GlyphRenderDataRestrictedRays::upload_to_atlas ( GlyphAtlasProxy atlas_proxy,
GlyphAttribute::Array attributes,
c_array< float >  render_costs 
) const
virtual

To be implemented by a derived class to upload data to a GlyphAtlas.

Parameters
atlas_proxyGlyphAtlasProxy to which to upload data
attributes(output) glyph attributes (see Glyph::attributes())
render_costs(output) an array of size render_info().size() to which to write the render costs for each entry in render_info().

Implements fastuidraw::GlyphRenderData.


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