FastUIDraw
|
A PainterImageBrushShader represents a single PainterBrushShader together with sub-shaders of it that can be used to apply an Image. The sub-shader ID is used to describe the Image::type(), Image::format(), what filtering and mipmapping to apply to the image data. More...
#include <painter_image_brush_shader.hpp>
Public Types | |
enum | sub_shader_bits { filter_num_bits = 2, mipmap_num_bits = 7, type_num_bits = 4, format_num_bits = 1, filter_bit0 = 0, mipmap_bit0 = filter_bit0 + filter_num_bits, type_bit0 = mipmap_bit0 + mipmap_num_bits, format_bit0 = type_bit0 + type_num_bits, number_bits = format_bit0 + format_num_bits, number_sub_shaders = 1u << number_bits } |
Enumeration describing the roles of the bits for the sub-shader ID's. More... | |
enum | sub_shader_masks { filter_mask = FASTUIDRAW_MASK(filter_bit0, filter_num_bits), mipmap_mask = FASTUIDRAW_MASK(mipmap_bit0, mipmap_num_bits), type_mask = FASTUIDRAW_MASK(type_bit0, type_num_bits), format_mask = FASTUIDRAW_MASK(format_bit0, format_num_bits) } |
Public Types inherited from fastuidraw::PainterBrushEnums | |
enum | filter_t { filter_nearest = 1, filter_linear = 2, filter_cubic = 3 } |
Enumeration specifying what filter to apply to an image. More... | |
enum | gradient_type_t { gradient_non = 0, gradient_linear, gradient_radial, gradient_sweep, number_gradient_types } |
enum | mipmap_t { apply_mipmapping, dont_apply_mipmapping } |
enum | spread_type_t { spread_clamp, spread_mirror, spread_repeat, spread_mirror_repeat, number_spread_types } |
Public Member Functions | |
PainterImageBrushShader (const reference_counted_ptr< PainterBrushShader > &parent_shader) | |
PainterCustomBrush | create_brush (PainterPackedValuePool &pool, const reference_counted_ptr< const Image > &image, uvec2 xy, uvec2 wh, enum filter_t image_filter=filter_linear, enum mipmap_t mip_mapping=apply_mipmapping) const |
PainterCustomBrush | create_brush (PainterPackedValuePool &pool, const reference_counted_ptr< const Image > &image, enum filter_t image_filter=filter_linear, enum mipmap_t mip_mapping=apply_mipmapping) const |
const reference_counted_ptr< PainterBrushShader > & | sub_shader (const Image *image, enum filter_t image_filter, enum mipmap_t mip_mapping) const |
c_array< const reference_counted_ptr< PainterBrushShader > > | sub_shaders (void) const |
Public Member Functions inherited from fastuidraw::reference_counted_base< T, Counter > | |
reference_counted_base (void) | |
Static Public Member Functions | |
static uint32_t | sub_shader_id (const Image *image, enum filter_t image_filter, enum mipmap_t mip_mapping) |
Static Public Member Functions inherited from fastuidraw::reference_counted_base< T, Counter > | |
static void | add_reference (const reference_counted_base< T, Counter > *p) |
static void | remove_reference (const reference_counted_base< T, Counter > *p) |
A PainterImageBrushShader represents a single PainterBrushShader together with sub-shaders of it that can be used to apply an Image. The sub-shader ID is used to describe the Image::type(), Image::format(), what filtering and mipmapping to apply to the image data.
Definition at line 41 of file painter_image_brush_shader.hpp.
Enumeration describing the roles of the bits for the sub-shader ID's.
Enumerator | |
---|---|
filter_num_bits | Number of bits needed to encode filter for image. A value of 0 indicates no image applied, a non-zero value indicates an image applied and the value specifies what filter via the enumeration PainterBrushEnums::filter_t. |
mipmap_num_bits | Number of bits used to encode number of mipmap levels (when an image is present). |
type_num_bits | Number of bits needed to encode the image type (when an image is present). The possible values are given by the enumeration Image::type_t. |
format_num_bits | Number of bits needed to encode the value of Image::format(). |
filter_bit0 | first bit for if image is present on the brush and if so, what filter |
mipmap_bit0 | first bit to indicate maximum mipmap level to use |
type_bit0 | First bit to hold the type of image present if an image is present; the value is the enumeration in Image::type_t |
format_bit0 | First bit to encode Image::format_t |
number_bits | The total number of bits needed to specify the sub-shader IDs. |
number_sub_shaders | the total number of sub-shaders |
Definition at line 51 of file painter_image_brush_shader.hpp.
Various bit-mask values derived from sub_shader_bits
Enumerator | |
---|---|
filter_mask | mask generated from filter_bit0 and filter_num_bits |
mipmap_mask | mask generated from mipmap_bit0 and mipmap_num_bits |
type_mask | mask generated from type_bit0 and type_num_bits |
format_mask | mask generated from format_bit0 and format_num_bits |
Definition at line 116 of file painter_image_brush_shader.hpp.
|
explicit |
Ctor.
parent_shader | the parent PainterBrushShader that implements image-brush shading and has number_sub_shaders that implement brush shading where the I'th sub-shader implement brush shading as described by extracting from the bits of I the values as encoded by sub_shader_bits |
PainterCustomBrush fastuidraw::PainterImageBrushShader::create_brush | ( | PainterPackedValuePool & | pool, |
const reference_counted_ptr< const Image > & | image, | ||
uvec2 | xy, | ||
uvec2 | wh, | ||
enum filter_t | image_filter = filter_linear , |
||
enum mipmap_t | mip_mapping = apply_mipmapping |
||
) | const |
Create a PainterCustomBrush with packed data to brush by sourcing from a sub-rectangle of an Image.
pool | PainterPackedValuePool used to create the packed value |
image | Image from which to source |
xy | minx-miny corner of sub-rectangle |
wh | width and height of sub-rectangle |
image_filter | filtering to apply to image |
mip_mapping | mipmapping to apply to image |
PainterCustomBrush fastuidraw::PainterImageBrushShader::create_brush | ( | PainterPackedValuePool & | pool, |
const reference_counted_ptr< const Image > & | image, | ||
enum filter_t | image_filter = filter_linear , |
||
enum mipmap_t | mip_mapping = apply_mipmapping |
||
) | const |
Create a PainterCustomBrush with packed data to brush by sourcing from the entirity of an Image.
pool | PainterPackedValuePool used to create the packed value |
image | Image from which to source |
image_filter | filtering to apply to image |
mip_mapping | mipmapping to apply to image |
const reference_counted_ptr<PainterBrushShader>& fastuidraw::PainterImageBrushShader::sub_shader | ( | const Image * | image, |
enum filter_t | image_filter, | ||
enum mipmap_t | mip_mapping | ||
) | const |
image | Image from which the brush-image will source; a nullptr value indicates no image and the brush-image will emit constant color white fully opaque |
image_filter | filtering to apply to image |
mip_mapping | mipmapping to apply to image |
|
static |
Produce the sub-shader ID from what Image and how to sample from the image.
image | Image from which the brush-image will source; a nullptr value indicates no image and the brush-image will emit constant color white fully opaque |
image_filter | filtering to apply to image |
mip_mapping | mipmapping to apply to image |
c_array<const reference_counted_ptr<PainterBrushShader> > fastuidraw::PainterImageBrushShader::sub_shaders | ( | void | ) | const |
returns all the sub-shaders of the PainterImageBrushShader