Lagrange
|
RawInputImage holds the basic info and the raw pointer (without ownership) to the image pixels. More...
#include <lagrange/image/RawInputImage.h>
Classes | |
struct | PixelTraits |
struct | PixelTraits< Scalar, 1 > |
Public Types | |
enum class | precision_semantic : uint32_t { byte_p , half_p , single_p , double_p } |
enum class | color_space : uint32_t { linear , sRGB } |
enum class | texture_format : uint32_t { luminance = ((1) << 8) | 0x0 , luminance_alpha = ((2) << 8) | 0x1 , alpha_luminance = ((2) << 8) | 0x2 , rgb = ((3) << 8) | 0x4 , bgr = ((3) << 8) | 0x8 , rgba = ((4) << 8) | 0x10 , argb = ((4) << 8) | 0x12 , bgra = ((4) << 8) | 0x14 , max = ((4) << 8) | ((1 << 8) - 1) } |
enum class | image_storage_format : uint32_t { first_pixel_row_at_bottom , first_pixel_row_at_top } |
first_pixel_row_at_bottom: y is up (like OpenGL texcoords) first_pixel_row_at_top: y is down just like most image file formats More... | |
enum class | wrap_mode : uint32_t { repeat , clamp , mirror } |
enum class | texture_filtering : uint32_t { nearest , bilinear } |
Public Member Functions | |
size_t | get_width () const |
size_t | get_height () const |
size_t | get_row_byte_stride () const |
precision_semantic | get_pixel_precision () const |
color_space | get_color_space () const |
texture_format | get_tex_format () const |
wrap_mode | get_wrap_u () const |
wrap_mode | get_wrap_v () const |
image_storage_format | get_storage_format () const |
size_t | get_size_precision () const |
size_t | get_num_channels () const |
size_t | get_size_pixel () const |
size_t | get_row_stride () const |
size_t | get_pixel_data_offset () const |
const void * | get_pixel_data () const |
void | set_width (size_t x) |
void | set_height (size_t x) |
void | set_row_byte_stride (size_t x) |
void | set_pixel_precision (precision_semantic x) |
void | set_color_space (color_space x) |
void | set_tex_format (texture_format x) |
void | set_wrap_u (wrap_mode x) |
void | set_wrap_v (wrap_mode x) |
void | set_storage_format (image_storage_format x) |
void | set_pixel_data (const void *pixel_data, const bool copy_to_local) |
set_pixel_data must be called all other member variables are well set if copy_to_local == false: m_local_pixel_data empty m_pixel_data points to the external pixel_data else: external pixel_data are copied to m_local_pixel_data m_pixel_data is nullptr | |
void | set_pixel_data_buffer (std::vector< unsigned char > pixel_data_buffer) |
m_local_pixel_data takes over pixel_data_buffer m_pixel_data is set to nullptr | |
bool | operator== (const RawInputImage &other) const |
bool | operator!= (const RawInputImage &other) const |
template<typename TexcoordScalar , typename Scalar , uint32_t NumChannels> | |
PixelTraits< Scalar, NumChannels >::Pixel | sample (const TexcoordScalar u, const TexcoordScalar v, const texture_filtering filtering=texture_filtering::bilinear) const |
Sample an image at a given location. More... | |
template<typename TexcoordScalar , typename Scalar , uint32_t NumChannels> | |
PixelTraits< Scalar, NumChannels >::Pixel | sample_float (const TexcoordScalar u, const TexcoordScalar v, const texture_filtering filtering=texture_filtering::bilinear) const |
Similar to sample, but remaps the output values from [0, 255] to [0, 1] if the pixel data is stored as 8-bit integers. More... | |
template<typename Archive > | |
void | serialize_impl (Archive &ar) |
Serialization. More... | |
Protected Member Functions | |
template<typename TexcoordScalar , typename Scalar , uint32_t NumChannels, typename InternalScalar , uint32_t InternalNumChannels> | |
PixelTraits< Scalar, NumChannels >::Pixel | sample (const TexcoordScalar u, const TexcoordScalar v, const texture_filtering filtering=texture_filtering::bilinear) const |
Protected Attributes | |
size_t | m_width = 0 |
size_t | m_height = 0 |
size_t | m_row_byte_stride = 0 |
precision_semantic | m_pixel_precision = precision_semantic::single_p |
color_space | m_color_space = color_space::linear |
texture_format | m_tex_format = texture_format::rgba |
wrap_mode | m_wrap_u = wrap_mode::clamp |
wrap_mode | m_wrap_v = wrap_mode::clamp |
image_storage_format | m_storage_format = image_storage_format::first_pixel_row_at_top |
const void * | m_pixel_data = nullptr |
Raw pixel data pointer. Assumed ownership by host, host's responsibility to keep it valid as long as Lagrange has access to it. | |
std::vector< unsigned char > | m_local_pixel_data |
RawInputImage holds the basic info and the raw pointer (without ownership) to the image pixels.
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
RawInputImage::PixelTraits< Scalar, NumChannels >::Pixel sample | ( | const TexcoordScalar | u, |
const TexcoordScalar | v, | ||
const texture_filtering | filtering = texture_filtering::bilinear |
||
) | const |
Sample an image at a given location.
[in] | u | First sampling coordinate. |
[in] | v | Second sampling coordinate. |
[in] | filtering | Filtering scheme (nearest or bilinear). |
TexcoordScalar | Texture coordinate type. |
Scalar | Pixel scalar type. |
NumChannels | Number of color channels in the pixel. |
RawInputImage::PixelTraits< Scalar, NumChannels >::Pixel sample_float | ( | const TexcoordScalar | u, |
const TexcoordScalar | v, | ||
const texture_filtering | filtering = texture_filtering::bilinear |
||
) | const |
Similar to sample, but remaps the output values from [0, 255] to [0, 1] if the pixel data is stored as 8-bit integers.
[in] | u | First sampling coordinate. |
[in] | v | Second sampling coordinate. |
[in] | filtering | Filtering scheme (nearest or bilinear). |
TexcoordScalar | Texture coordinate type. |
Scalar | Pixel scalar type. Must be a floating point type. |
NumChannels | Number of color channels in the pixel. |
|
inline |
Serialization.
Serialization implementation.
Caution: TessellationOptions::facet_budget_callback is not serialized