Krita Source Code Documentation
Loading...
Searching...
No Matches
RgbPixelWrapper< T > Struct Template Reference

Public Types

typedef T channel_type
 
typedef Rgba< T > pixel_type
 

Public Member Functions

alpha () const
 
bool checkMultipliedColorsConsistent () const
 
bool checkUnmultipliedColorsConsistent (const Rgba< T > &mult) const
 
 RgbPixelWrapper (Rgba< T > &_pixel)
 
void setUnmultiplied (const Rgba< T > &mult, T newAlpha)
 

Public Attributes

Rgba< T > & pixel
 

Detailed Description

template<typename T>
struct RgbPixelWrapper< T >

Definition at line 244 of file exr_converter.cc.

Member Typedef Documentation

◆ channel_type

template<typename T >
typedef T RgbPixelWrapper< T >::channel_type

Definition at line 246 of file exr_converter.cc.

◆ pixel_type

template<typename T >
typedef Rgba<T> RgbPixelWrapper< T >::pixel_type

Definition at line 247 of file exr_converter.cc.

Constructor & Destructor Documentation

◆ RgbPixelWrapper()

template<typename T >
RgbPixelWrapper< T >::RgbPixelWrapper ( Rgba< T > & _pixel)
inline

Definition at line 249 of file exr_converter.cc.

249: pixel(_pixel) {}
Rgba< T > & pixel

Member Function Documentation

◆ alpha()

template<typename T >
T RgbPixelWrapper< T >::alpha ( ) const
inline

Definition at line 251 of file exr_converter.cc.

251 {
252 return pixel.a;
253 }

References Rgba< _T_ >::a, and RgbPixelWrapper< T >::pixel.

◆ checkMultipliedColorsConsistent()

template<typename T >
bool RgbPixelWrapper< T >::checkMultipliedColorsConsistent ( ) const
inline

Definition at line 255 of file exr_converter.cc.

255 {
256 return !(std::abs(pixel.a) <= alphaEpsilon<T>() &&
257 (!qFuzzyIsNull(pixel.r) ||
258 !qFuzzyIsNull(pixel.g) ||
259 !qFuzzyIsNull(pixel.b)));
260 }
static bool qFuzzyIsNull(half h)

References Rgba< _T_ >::a, Rgba< _T_ >::b, Rgba< _T_ >::g, RgbPixelWrapper< T >::pixel, qFuzzyIsNull(), and Rgba< _T_ >::r.

◆ checkUnmultipliedColorsConsistent()

template<typename T >
bool RgbPixelWrapper< T >::checkUnmultipliedColorsConsistent ( const Rgba< T > & mult) const
inline

Definition at line 262 of file exr_converter.cc.

262 {
263 const T alpha = std::abs(pixel.a);
264
265 return alpha >= alphaNoiseThreshold<T>() ||
266 (qFuzzyCompare(T(pixel.r * alpha), mult.r) &&
267 qFuzzyCompare(T(pixel.g * alpha), mult.g) &&
268 qFuzzyCompare(T(pixel.b * alpha), mult.b));
269 }
static bool qFuzzyCompare(half p1, half p2)

References Rgba< _T_ >::a, RgbPixelWrapper< T >::alpha(), Rgba< _T_ >::b, Rgba< _T_ >::g, RgbPixelWrapper< T >::pixel, qFuzzyCompare(), and Rgba< _T_ >::r.

◆ setUnmultiplied()

template<typename T >
void RgbPixelWrapper< T >::setUnmultiplied ( const Rgba< T > & mult,
T newAlpha )
inline

Definition at line 271 of file exr_converter.cc.

271 {
272 const T absoluteAlpha = std::abs(newAlpha);
273
274 pixel.r = mult.r / absoluteAlpha;
275 pixel.g = mult.g / absoluteAlpha;
276 pixel.b = mult.b / absoluteAlpha;
277 pixel.a = newAlpha;
278 }

References Rgba< _T_ >::a, Rgba< _T_ >::b, Rgba< _T_ >::g, RgbPixelWrapper< T >::pixel, and Rgba< _T_ >::r.

Member Data Documentation

◆ pixel

template<typename T >
Rgba<T>& RgbPixelWrapper< T >::pixel

Definition at line 280 of file exr_converter.cc.


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