Struct PixelFormatSampler
Utility for writing and reading from different pixels formats within a single code path.
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Graphics/PixelFormatSampler.h
Syntax
public struct PixelFormatSampler
Fields
Format
PixelSize
Declaration
public int32 PixelSize
Field Value
int32
|
Read
Declaration
public ReadPixel Read
Field Value
ReadPixel
|
Write
Declaration
public WritePixel Write
Field Value
WritePixel
|
Methods
Get(PixelFormat format)
Tries to get a sampler tool for the specified format to read pixels.
Declaration
public static PixelFormatSampler* Get(PixelFormat format)
Parameters
PixelFormat
format
The format. |
Returns
PixelFormatSampler
The pointer to the sampler object or null when cannot sample the given format. |
Sample(const void* data, int32 x)
Samples the specified linear data (uses no interpolation).
Declaration
public Float4 Sample(const void* data, int32 x) const
Parameters
void
data
The data pointer for the data slice (linear buffer or 1D image). |
int32
x
Index of the element. |
Returns
Float4
The sampled value. |
SampleLinear(const void* data, const Float2& uv, const Int2& size, int32 rowPitch)
Samples the specified texture data (uses linear interpolation).
Declaration
public Color SampleLinear(const void* data, const Float2& uv, const Int2& size, int32 rowPitch) const
Parameters
void
data
The data pointer for the texture slice (1D or 2D image). |
Float2
uv
The texture coordinates (normalized to range 0-1). |
Int2
size
The size of the input texture (in pixels). |
int32
rowPitch
The row pitch (in bytes). The offset between each image rows. |
Returns
Color
The sampled color (linear). |
SamplePoint(const void* data, const Float2& uv, const Int2& size, int32 rowPitch)
Samples the specified texture data (uses no interpolation).
Declaration
public Color SamplePoint(const void* data, const Float2& uv, const Int2& size, int32 rowPitch) const
Parameters
void
data
The data pointer for the texture slice (1D or 2D image). |
Float2
uv
The texture coordinates (normalized to range 0-1). |
Int2
size
The size of the input texture (in pixels). |
int32
rowPitch
The row pitch (in bytes). The offset between each image rows. |
Returns
Color
The sampled color (linear). |
SamplePoint(const void* data, int32 x, int32 y, int32 rowPitch)
Samples the specified texture data (uses no interpolation).
Declaration
public Color SamplePoint(const void* data, int32 x, int32 y, int32 rowPitch) const
Parameters
void
data
The data pointer for the texture slice (1D or 2D image). |
int32
x
The X texture coordinates (normalized to range 0-width). |
int32
y
The Y texture coordinates (normalized to range 0-height). |
int32
rowPitch
The row pitch (in bytes). The offset between each image rows. |
Returns
Color
The sampled color (linear). |
Store(void* data, int32 x, int32 y, int32 rowPitch, const Color& color)
Stores the color into the specified texture data (uses no interpolation).
Declaration
public void Store(void* data, int32 x, int32 y, int32 rowPitch, const Color& color) const
Parameters
void
data
The data pointer for the texture slice (1D or 2D image). |
int32
x
The X texture coordinates (normalized to range 0-width). |
int32
y
The Y texture coordinates (normalized to range 0-height). |
int32
rowPitch
The row pitch (in bytes). The offset between each image rows. |
Color
color
The color to store (linear). |