FastUIDraw
|
#include <glyph_render_data_restricted_rays.hpp>
Classes | |
class | query_info |
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_string > | render_info_labels (void) const |
virtual enum fastuidraw::return_code | upload_to_atlas (GlyphAtlasProxy &atlas_proxy, GlyphAttribute::Array &attributes, c_array< float > render_costs) const |
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.
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.
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
|
glyph_num_attributes | Number attribute values needed. |
Definition at line 298 of file glyph_render_data_restricted_rays.hpp.
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.
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.
Points are packed as (fp16, fp16) pairs.
Definition at line 274 of file glyph_render_data_restricted_rays.hpp.
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.
fastuidraw::GlyphRenderDataRestrictedRays::GlyphRenderDataRestrictedRays | ( | void | ) |
Ctor.
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
f | fill rule to use for rendering |
glyph_rect | the rect of the glyph |
units_per_EM | the units per EM for the glyph; this value together with GlyphGenerateParams::restricted_rays_minimum_render_size() is used to decide how close a curve may be to a bounding box to decide if it is included. |
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.
f | fill rule to use for rendering |
glyph_rect | the rect of the glyph |
split_thresh | if the number of curves within a box is greater than this value, the box is split |
max_recursion | the maximum level of recursion allowed in splitting the data into boxes |
near_thresh | horizontal and vertical threshhold to decide if a curve outside of a box should be added to a box |
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.
pt | end point of the new line segment |
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.
pt | start point of the new contour |
Add a quadratic curveconnecting the end point of the last curve or line segment of the current contour
ct | control point of the quadratic curve |
pt | end point of the quadratic curve |
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.
out_info | location to which to write information about this object. |
|
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.
|
virtual |
To be implemented by a derived class to upload data to a GlyphAtlas.
atlas_proxy | GlyphAtlasProxy 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.