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

A PainterImageBrushShaderData defines the PainterBrushShaderData that the shaders of a PainterImageBrushShader consume. It specifies what Image and what rectangular region within it from which to source image data. More...

#include <painter_image_brush_shader_data.hpp>

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

Public Types

enum  atlas_location_encoding {
  atlas_location_x_num_bits = 8, atlas_location_y_num_bits = 8, atlas_location_z_num_bits = 16, atlas_location_x_bit0 = 0,
  atlas_location_y_bit0 = atlas_location_x_num_bits, atlas_location_z_bit0 = atlas_location_y_bit0 + atlas_location_y_num_bits
}
 Bit packing for the master index tile of a Image. More...
 
enum  offset_t {
  size_xy_offset, start_xy_offset, atlas_location_xyz_offset, number_lookups_offset,
  shader_data_size, bindless_handle_hi_offset = atlas_location_xyz_offset, bindless_handle_low_offset = number_lookups_offset
}
 Offsets for image data packing. The offsets are in units of uint32_t, NOT units of uvec4. More...
 
enum  uvec2_encoding { uvec2_x_num_bits = 16, uvec2_y_num_bits = 16, uvec2_x_bit0 = 0, uvec2_y_bit0 = uvec2_x_num_bits }
 Bit packing for an uvec2 value. More...
 
- 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

 PainterImageBrushShaderData (void)
 
 PainterImageBrushShaderData (const PainterImageBrushShaderData &obj)
 
c_array< const reference_counted_ptr< const Image > > bind_images (void) const override
 
unsigned int data_size (void) const override
 
void image (const reference_counted_ptr< const Image > &im)
 
const reference_counted_ptr< const Image > & image (void) const
 
unsigned int number_resources (void) const override
 
PainterImageBrushShaderDataoperator= (const PainterImageBrushShaderData &rhs)
 
void pack_data (c_array< uvec4 > dst) const override
 
void save_resources (c_array< reference_counted_ptr< const resource_base > > dst) const override
 
void sub_image (const reference_counted_ptr< const Image > &im, uvec2 xy, uvec2 wh)
 

Detailed Description

A PainterImageBrushShaderData defines the PainterBrushShaderData that the shaders of a PainterImageBrushShader consume. It specifies what Image and what rectangular region within it from which to source image data.

Definition at line 43 of file painter_image_brush_shader_data.hpp.

Member Enumeration Documentation

◆ atlas_location_encoding

Bit packing for the master index tile of a Image.

Enumerator
atlas_location_x_num_bits 

number bits to encode Image::master_index_tile().x()

atlas_location_y_num_bits 

number bits to encode Image::master_index_tile().y()

atlas_location_z_num_bits 

number bits to encode Image::master_index_tile().z()

atlas_location_x_bit0 

bit where Image::master_index_tile().x() is encoded

atlas_location_y_bit0 

bit where Image::master_index_tile().y() is encoded

atlas_location_z_bit0 

bit where Image::master_index_tile().z() is encoded

Definition at line 65 of file painter_image_brush_shader_data.hpp.

◆ offset_t

Offsets for image data packing. The offsets are in units of uint32_t, NOT units of uvec4.

Enumerator
size_xy_offset 

Width and height of the sub-rectangle of the Image from which to source and encoded in a single uint32_t. The bits are packed as according to uvec2_encoding. If there is no valid backing image, then the encoded value will be 0.

start_xy_offset 

The minx-miny corener of the sub-rectangle of the Image from which to source and encoded in a single uint32_t. The bits are packed as according to uvec2_encoding.

atlas_location_xyz_offset 

Location of image (Image::master_index_tile()) in the image atlas is encoded in a single uint32. The bits are packed as according to atlas_location_encoding. If the image is not of type Image::on_atlas, gives the high 32-bits of Image::handle().

number_lookups_offset 

Holds the amount the number of index looks ups, see Image::number_index_lookups(). If the image is not of type Image::on_atlas, gives the low 32-bits of Image::handle().

shader_data_size 

Number of elements packed for image support for a brush

bindless_handle_hi_offset 

Offset to the high 32-bits of the handle value when the Image is of type Image::bindless_texture2d.

bindless_handle_low_offset 

Offset to the low 32-bits of the handle value when the Image is of type Image::bindless_texture2d.

Definition at line 89 of file painter_image_brush_shader_data.hpp.

◆ uvec2_encoding

Bit packing for an uvec2 value.

Enumerator
uvec2_x_num_bits 

number bits to encode x-coordinate

uvec2_y_num_bits 

number bits to encode y-coordinate

uvec2_x_bit0 

bit where x-coordinate is encoded

uvec2_y_bit0 

bit where y-coordinate is encoded

Definition at line 52 of file painter_image_brush_shader_data.hpp.

Constructor & Destructor Documentation

◆ PainterImageBrushShaderData() [1/2]

fastuidraw::PainterImageBrushShaderData::PainterImageBrushShaderData ( void  )

Ctor initializes to not source from any image data

◆ PainterImageBrushShaderData() [2/2]

fastuidraw::PainterImageBrushShaderData::PainterImageBrushShaderData ( const PainterImageBrushShaderData obj)
inline

Copy ctor.

Definition at line 151 of file painter_image_brush_shader_data.hpp.

Member Function Documentation

◆ bind_images()

c_array<const reference_counted_ptr<const Image> > fastuidraw::PainterImageBrushShaderData::bind_images ( void  ) const
overridevirtual

To be implemented by a derived class to return a c_array of references to Image objects whose Image::type() value is Image::context_texture2d. The i'th entry in the returned array will be bound to the i'th external texture slot of the backend via the PainterDrawBreakAction objected returned by PainterBackend::bind_image(). Default implementation is to return an empty array.

Reimplemented from fastuidraw::PainterBrushShaderData.

◆ data_size()

unsigned int fastuidraw::PainterImageBrushShaderData::data_size ( void  ) const
overridevirtual

To be implemented by a derived class to return the number of uvec4 blocks needed to pack the data.

Implements fastuidraw::PainterBrushShaderData.

◆ image() [1/2]

void fastuidraw::PainterImageBrushShaderData::image ( const reference_counted_ptr< const Image > &  im)

Set to source from the entire contents of an Image.

Parameters
imImage from which to source

◆ image() [2/2]

const reference_counted_ptr<const Image>& fastuidraw::PainterImageBrushShaderData::image ( void  ) const
inline

Returns the Image from which to source

Definition at line 191 of file painter_image_brush_shader_data.hpp.

◆ number_resources()

unsigned int fastuidraw::PainterImageBrushShaderData::number_resources ( void  ) const
overridevirtual

To be optionally implemented by a derived class to return the number of resources that need to be resident after packing. Default implementation returns 0.

Reimplemented from fastuidraw::PainterBrushShaderData.

◆ operator=()

PainterImageBrushShaderData& fastuidraw::PainterImageBrushShaderData::operator= ( const PainterImageBrushShaderData rhs)
inline

Assignment operator

Definition at line 161 of file painter_image_brush_shader_data.hpp.

◆ pack_data()

void fastuidraw::PainterImageBrushShaderData::pack_data ( c_array< uvec4 dst) const
overridevirtual

To be implemented by a derived class to pack the data.

Parameters
dstlocation to which to pack the data

Implements fastuidraw::PainterBrushShaderData.

◆ save_resources()

void fastuidraw::PainterImageBrushShaderData::save_resources ( c_array< reference_counted_ptr< const resource_base > >  dst) const
overridevirtual

To be optionally implemented by a derived class to save references to resources that need to be resident after packing. Default implementation does nothing.

Parameters
dstlocation to which to save resources.

Reimplemented from fastuidraw::PainterBrushShaderData.

◆ sub_image()

void fastuidraw::PainterImageBrushShaderData::sub_image ( const reference_counted_ptr< const Image > &  im,
uvec2  xy,
uvec2  wh 
)

Set to source from a sub-rectangle of a Image

Parameters
imImage from which to source
xyminx-miny corner of sub-rectangle
whwidth and height of sub-rectangle

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