![]() |
ULIS
dev4.0.7
Utility Library for Imaging Systems
|
The ISample class is an abstract interface allowing to store and manipulate pixels or colors in various formats. More...
Public Member Functions | |
~ISample () | |
uint16 | A16 () const |
uint16 | a16 () const |
uint8 | A8 () const |
uint8 | a8 () const |
float | AF () const |
float | aF () const |
uint16 | Alpha16 () const |
uint8 | Alpha8 () const |
float | AlphaF () const |
template<typename T > | |
T | AlphaT () const |
template<typename T > | |
T | AT () const |
uint16 | B16 () const |
uint16 | b16 () const |
uint8 | B8 () const |
uint8 | b8 () const |
float | BF () const |
float | bF () const |
uint8 * | Bits () |
const uint8 * | Bits () const |
uint16 | Blue16 () const |
uint8 | Blue8 () const |
float | BlueF () const |
uint16 | Channel16 (uint8 iIndex) const |
uint8 | Channel8 (uint8 iIndex) const |
ufloat | ChannelF (uint8 iIndex) const |
template<typename T > | |
T | ChannelT (uint8 iIndex) const |
uint16 | Cyan16 () const |
uint8 | Cyan8 () const |
float | CyanF () const |
uint16 | G16 () const |
uint8 | G8 () const |
float | GF () const |
uint16 | Green16 () const |
uint8 | Green8 () const |
float | GreenF () const |
uint16 | Grey16 () const |
uint8 | Grey8 () const |
float | GreyF () const |
uint16 | Hue16 () const |
uint8 | Hue8 () const |
float | HueF () const |
uint16 | K16 () const |
uint8 | K8 () const |
uint16 | Key16 () const |
uint8 | Key8 () const |
float | KeyF () const |
float | KF () const |
uint16 | L16 () const |
uint8 | L8 () const |
float | LF () const |
uint16 | Lightness16 () const |
uint8 | Lightness8 () const |
float | LightnessF () const |
uint16 | Luma16 () const |
uint8 | Luma8 () const |
float | LumaF () const |
uint16 | Magenta16 () const |
uint8 | Magenta8 () const |
float | MagentaF () const |
bool | operator!= (const ISample &iOther) const |
bool | operator== (const ISample &iOther) const |
uint64 | PlaneSize () const |
FColor | Premultiplied () const |
void | Premultiply () |
uint16 | R16 () const |
uint8 | R8 () const |
uint16 | Red16 () const |
uint8 | Red8 () const |
float | RedF () const |
float | RF () const |
uint16 | Saturation16 () const |
uint8 | Saturation8 () const |
float | SaturationF () const |
void | SetA16 (uint16 iValue) |
void | Seta16 (uint16 iValue) |
void | SetA8 (uint8 iValue) |
void | Seta8 (uint8 iValue) |
void | SetAF (float iValue) |
void | SetaF (ufloat iValue) |
void | SetAlpha16 (uint16 iValue) |
void | SetAlpha8 (uint8 iValue) |
void | SetAlphaF (float iValue) |
template<typename T > | |
void | SetAlphaT (T iValue) |
template<typename T > | |
void | SetAT (T iValue) |
void | SetB16 (uint16 iValue) |
void | Setb16 (uint16 iValue) |
void | SetB8 (uint8 iValue) |
void | Setb8 (uint8 iValue) |
void | SetBF (ufloat iValue) |
void | SetbF (ufloat iValue) |
void | SetBlue16 (uint16 iValue) |
void | SetBlue8 (uint8 iValue) |
void | SetBlueF (ufloat iValue) |
void | SetChannel16 (uint8 iIndex, uint16 iValue) |
void | SetChannel8 (uint8 iIndex, uint8 iValue) |
void | SetChannelF (uint8 iIndex, ufloat iValue) |
template<typename T > | |
void | SetChannelT (uint8 iIndex, T iValue) |
void | SetCyan16 (uint16 iValue) |
void | SetCyan8 (uint8 iValue) |
void | SetCyanF (ufloat iValue) |
void | SetG16 (uint16 iValue) |
void | SetG8 (uint8 iValue) |
void | SetGF (ufloat iValue) |
void | SetGreen16 (uint16 iValue) |
void | SetGreen8 (uint8 iValue) |
void | SetGreenF (ufloat iValue) |
void | SetGrey16 (uint16 iValue) |
void | SetGrey8 (uint8 iValue) |
void | SetGreyF (ufloat iValue) |
void | SetHue16 (uint16 iValue) |
void | SetHue8 (uint8 iValue) |
void | SetHueF (ufloat iValue) |
void | SetK16 (uint16 iValue) |
void | SetK8 (uint8 iValue) |
void | SetKey16 (uint16 iValue) |
void | SetKey8 (uint8 iValue) |
void | SetKeyF (ufloat iValue) |
void | SetKF (ufloat iValue) |
void | SetL16 (uint16 iValue) |
void | SetL8 (uint8 iValue) |
void | SetLF (ufloat iValue) |
void | SetLightness16 (uint16 iValue) |
void | SetLightness8 (uint8 iValue) |
void | SetLightnessF (ufloat iValue) |
void | SetLuma16 (uint16 iValue) |
void | SetLuma8 (uint8 iValue) |
void | SetLumaF (ufloat iValue) |
void | SetMagenta16 (uint16 iValue) |
void | SetMagenta8 (uint8 iValue) |
void | SetMagentaF (ufloat iValue) |
void | SetR16 (uint16 iValue) |
void | SetR8 (uint8 iValue) |
void | SetRed16 (uint16 iValue) |
void | SetRed8 (uint8 iValue) |
void | SetRedF (ufloat iValue) |
void | SetRF (ufloat iValue) |
void | SetSaturation16 (uint16 iValue) |
void | SetSaturation8 (uint8 iValue) |
void | SetSaturationF (ufloat iValue) |
void | SetU16 (uint16 iValue) |
void | SetU8 (uint8 iValue) |
void | SetUF (ufloat iValue) |
void | SetV16 (uint16 iValue) |
void | SetV8 (uint8 iValue) |
void | SetValue16 (uint16 iValue) |
void | SetValue8 (uint8 iValue) |
void | SetValueF (ufloat iValue) |
void | SetVF (ufloat iValue) |
void | SetX16 (uint16 iValue) |
void | Setx16 (uint16 iValue) |
void | SetX8 (uint8 iValue) |
void | Setx8 (uint8 iValue) |
void | SetXF (ufloat iValue) |
void | SetxF (ufloat iValue) |
void | SetY16 (uint16 iValue) |
void | Sety16 (uint16 iValue) |
void | SetY8 (uint8 iValue) |
void | Sety8 (uint8 iValue) |
void | SetYellow16 (uint16 iValue) |
void | SetYellow8 (uint8 iValue) |
void | SetYellowF (ufloat iValue) |
void | SetYF (ufloat iValue) |
void | SetyF (ufloat iValue) |
void | SetZ16 (uint16 iValue) |
void | SetZ8 (uint8 iValue) |
void | SetZF (ufloat iValue) |
FColor | ToFormat (eFormat iDstFormat) const |
uint16 | U16 () const |
uint8 | U8 () const |
float | UF () const |
FColor | Unpremultiplied () const |
void | Unpremultiply () |
uint16 | V16 () const |
uint8 | V8 () const |
uint16 | Value16 () const |
uint8 | Value8 () const |
float | ValueF () const |
float | VF () const |
uint16 | X16 () const |
uint16 | x16 () const |
uint8 | X8 () const |
uint8 | x8 () const |
float | XF () const |
float | xF () const |
uint16 | Y16 () const |
uint16 | y16 () const |
uint8 | Y8 () const |
uint8 | y8 () const |
uint16 | Yellow16 () const |
uint8 | Yellow8 () const |
float | YellowF () const |
float | YF () const |
float | yF () const |
uint16 | Z16 () const |
uint8 | Z8 () const |
float | ZF () const |
![]() | |
~IHasFormat () | |
uint8 | AlphaIndex () const |
uint8 | BytesPerPixel () const |
uint8 | BytesPerSample () const |
uint8 | DefaultProfileCode () const |
eFormat | Format () const |
const FFormatMetrics & | FormatMetrics () const |
bool | HasAlpha () const |
const uint8 * | IndexTable () const |
bool | Linear () const |
eColorModel | Model () const |
uint8 | NumColorChannels () const |
bool | Planar () const |
bool | Premultiplied () const |
uint8 | RedirectedIndex (uint8 iIndex) const |
bool | Reversed () const |
uint8 | SamplesPerPixel () const |
bool | Swapped () const |
eType | Type () const |
![]() | |
~IHasColorSpace () | |
void | AssignColorSpace (const FColorSpace *iColorSpace) |
const FColorSpace * | ColorSpace () const |
Static Public Member Functions | |
static void | ConvertFormat (const ISample &iSrc, ISample &iDst) |
static FColor | MixFormat (const ISample &iA, const ISample &iB, eFormat iFormat, ufloat iLerpParameter) |
static FColor | MixLab (const ISample &iA, const ISample &iB, ufloat iLerpParameter) |
static FColor | MixRGB (const ISample &iA, const ISample &iB, ufloat iLerpParameter) |
Protected Member Functions | |
ISample (uint8 *iData, eFormat iFormat, const FColorSpace *iColorSpace=nullptr, uint64 iPlaneSize=0) | |
![]() | |
IHasFormat (eFormat iFormat) | |
void | ReinterpretFormat (eFormat iFormat) |
![]() | |
IHasColorSpace (const FColorSpace *iColorSpace=nullptr) | |
Protected Attributes | |
uint64 | mPlaneSize |
uint8 * | mSignal |
ISample is a pure virtual class that provides a common interface for the FPixel and FColor classes.
The ISample has a format which specifies the type, memory layout, color model, and other informations about the pixel data. The underlying pixel data is always a regular contiguous buffer storage that lives on RAM with no alignment requirement. It is usually very small, ranging from 1 byte to 40 bytes, depending on the format.
The ISample interface provides a way to access individualy named samples or channels components. If accessing a channel from a named component that is not compatible with the initial format of the ISample, the returned value could make little sense to the caller, but it is properly defined and is safe to call unless accessing a named component that is out of range and from another color model with a greater number of channels than the true color model of the data, according to the format.
There are many named components that can be accessed with a suffix indicating which type is required. If accessing such components with a type suffix that is not the appropriate type according to the format, the function will trigger an assert and crash in debug build, but it will fail silently and access the buffer out of bounds in release builds, leading to potential memory corruption or crashes further down the line.
Here are some examples of legal and illegal uses of ISample through the derived classes:
|
protected |
Construct a ISample interface in a derived class
ISample::~ISample | ( | ) |
Destructor.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
uint8* ISample::Bits | ( | ) |
Obtain a pointer to the raw data at the base element of the underlying buffer.
The data is accessible through the returned pointer and can be modified safely, as long as you don't dereference elements outside of the buffer boundaries.
const uint8* ISample::Bits | ( | ) | const |
Obtain a const pointer to the raw data at the base element of the underlying buffer.
The data is accessible through the returned pointer and can be read safely, as long as you don't dereference elements outside of the buffer boundaries.
|
inline |
|
inline |
|
inline |
Obtain the value at the redirected channel index as uint16. It is undefined behaviour to call this if the format is not of type uint16.
Obtain the value at the redirected channel index as uint8. It is undefined behaviour to call this if the format is not of type uint8.
Obtain the value at the redirected channel index as uint32. It is undefined behaviour to call this if the format is not of type uint32.
Obtain the value at the redirected channel index as ufloat. It is undefined behaviour to call this if the format is not of type ufloat.
|
inline |
Obtain the value at the redirected channel index as T. It is undefined behaviour to call this if the format is not of type T.
In-place converter, upon return Dst will represent the visual information of this sample, but converted into the specified format into its own storage.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
static |
Color Mix or Lerp, beetween two input ISample, in the input format.
|
static |
Color Mix or Lerp, beetween two input ISample, in Lab.
|
static |
Color Mix or Lerp, beetween two input ISample, in RGB.
bool ISample::operator!= | ( | const ISample & | iOther | ) | const |
Comparison strict not equal operator
bool ISample::operator== | ( | const ISample & | iOther | ) | const |
Comparison strict equal operator
uint64 ISample::PlaneSize | ( | ) | const |
Obtain the plane size ( BytesPerSample for interleaved formats, N for planars )
FColor ISample::Premultiplied | ( | ) | const |
Get Premultiplied color version of this sample.
void ISample::Premultiply | ( | ) |
Premultiply sample in place.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Set the value at the redirected channel index as uint16. It is undefined behaviour to call this if the format is not of type uint16.
Set the value at the redirected channel index as uint8. It is undefined behaviour to call this if the format is not of type uint8.
Set the value at the redirected channel index as ufloat. It is undefined behaviour to call this if the format is not of type ufloat.
|
inline |
Set the value at the redirected channel index as T. It is undefined behaviour to call this if the format is not of type T.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Obtain a new color object that represents the visual information of this sample, but converted into the specified format and with its own storage.
|
inline |
|
inline |
|
inline |
FColor ISample::Unpremultiplied | ( | ) | const |
Get Unpremultiplied color version of this sample.
void ISample::Unpremultiply | ( | ) |
Unpremultiply sample in place.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
protected |
|
mutableprotected |