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

An implementation of ImageSourceBase where the data is backed by a c_array<const u8vec4> data. More...

#include <image.hpp>

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

Public Member Functions

 ImageSourceCArray (uvec2 dimensions, c_array< const c_array< const u8vec4 > > pdata, enum Image::format_t fmt)
 
virtual bool all_same_color (ivec2 location, int square_size, u8vec4 *dst) const
 
virtual void fetch_texels (unsigned int mimpap_level, ivec2 location, unsigned int w, unsigned int h, c_array< u8vec4 > dst) const
 
virtual enum Image::format_t format (void) const
 
virtual unsigned int number_levels (void) const
 

Detailed Description

An implementation of ImageSourceBase where the data is backed by a c_array<const u8vec4> data.

Definition at line 304 of file image.hpp.

Constructor & Destructor Documentation

◆ ImageSourceCArray()

fastuidraw::ImageSourceCArray::ImageSourceCArray ( uvec2  dimensions,
c_array< const c_array< const u8vec4 > >  pdata,
enum Image::format_t  fmt 
)

Ctor.

Parameters
dimensionswidth and height of the LOD level 0 mipmap; the LOD level n is then assumed to be size (dimensions.x() >> n, dimensions.y() >> n)
pdatathe texel data, the data is NOT copied, thus the contents backing the texel data must not be freed until the ImageSourceCArray goes out of scope.
fmtthe format of the image data

Member Function Documentation

◆ all_same_color()

virtual bool fastuidraw::ImageSourceCArray::all_same_color ( ivec2  location,
int  square_size,
u8vec4 dst 
) const
virtual

To be implemented by a derived class to return true if a region (across all mipmap levels) has a constant color.

Parameters
locationlocation at LOD 0
square_sizewidth and height of region to check
dstif all have texels of the region have the same color, write that color value to dst.

Implements fastuidraw::ImageSourceBase.

◆ fetch_texels()

virtual void fastuidraw::ImageSourceCArray::fetch_texels ( unsigned int  level,
ivec2  location,
unsigned int  w,
unsigned int  h,
c_array< u8vec4 dst 
) const
virtual

To be implemented by a derived class to write to a c_array of u8vec4 data a rectangle of texels of a particular mipmap level. NOTE: if pixels are requested to be fetched from outside the sources natural dimensions, those pixels outside are to be duplicates of the boundary values.

Parameters
levelLOD of data where 0 represents the highest level of detail and each successive level is half the resolution in each dimension; it is gauranteed by the called that 0 <= level() < number_levels()
location(x, y) location of data from which to copy
wwidth of data from which to copy
hheight of data from which to copy
dstlocation to which to write data, data is to be packed dst[x + w * y] holds the texel data (x + location.x(), y + location.y()) with 0 <= x < w and 0 <= y < h

Implements fastuidraw::ImageSourceBase.

◆ format()

virtual enum Image::format_t fastuidraw::ImageSourceCArray::format ( void  ) const
virtual

To be implemented by a derived class to return the format of the image data.

Implements fastuidraw::ImageSourceBase.

◆ number_levels()

virtual unsigned int fastuidraw::ImageSourceCArray::number_levels ( void  ) const
virtual

To be implemented by a derived class to return the number of levels (including the base-image) of image source has, i.e. if the image is to have no mipmapping, return 1.

Implements fastuidraw::ImageSourceBase.


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