openMSX
Public Member Functions | Static Public Member Functions | List of all members
openmsx::PixelOperations< Pixel > Class Template Reference

#include <PixelOperations.hh>

Inheritance diagram for openmsx::PixelOperations< Pixel >:
Inheritance graph
[legend]
Collaboration diagram for openmsx::PixelOperations< Pixel >:
Collaboration graph
[legend]

Public Member Functions

 PixelOperations (const SDL_PixelFormat &format)
 
unsigned red (Pixel p) const
 Extract RGB componts. More...
 
unsigned green (Pixel p) const
 
unsigned blue (Pixel p) const
 
unsigned alpha (Pixel p) const
 
bool isFullyOpaque (Pixel p) const
 
bool isFullyTransparent (Pixel p) const
 
unsigned red256 (Pixel p) const
 Same as above, but result is scaled to [0..255]. More...
 
unsigned green256 (Pixel p) const
 
unsigned blue256 (Pixel p) const
 
Pixel combine (unsigned r, unsigned g, unsigned b) const
 Combine RGB components to a pixel. More...
 
Pixel combine256 (unsigned r, unsigned g, unsigned b) const
 
unsigned getMaxRed () const
 Get maximum component value. More...
 
unsigned getMaxGreen () const
 
unsigned getMaxBlue () const
 
template<unsigned w1, unsigned w2>
Pixel blend (Pixel p1, Pixel p2) const
 Blend the given colors into a single color. More...
 
template<unsigned w1, unsigned w2, unsigned w3>
Pixel blend (Pixel p1, Pixel p2, Pixel p3) const
 
template<unsigned w1, unsigned w2, unsigned w3, unsigned w4>
Pixel blend (Pixel p1, Pixel p2, Pixel p3, Pixel p4) const
 
template<unsigned w1, unsigned w2, unsigned w3, unsigned w4, unsigned w5, unsigned w6>
Pixel blend (Pixel p1, Pixel p2, Pixel p3, Pixel p4, Pixel p5, Pixel p6) const
 
template<unsigned w1, unsigned w2>
Pixel blend2 (const Pixel *p) const
 
template<unsigned w1, unsigned w2, unsigned w3>
Pixel blend3 (const Pixel *p) const
 
template<unsigned w1, unsigned w2, unsigned w3, unsigned w4>
Pixel blend4 (const Pixel *p) const
 
template<unsigned w1, unsigned w2, unsigned w3, unsigned w4, unsigned w5, unsigned w6>
Pixel blend6 (const Pixel *p) const
 
Pixel lerp (Pixel p1, Pixel p2, unsigned x) const
 Perform linear interpolation between two pixels. More...
 
Pixel alphaBlend (Pixel p1, Pixel p2) const
 Perform alpha blending of two pixels. More...
 
- Public Member Functions inherited from openmsx::PixelOpBase< Pixel >
 PixelOpBase (const SDL_PixelFormat &format_)
 
const SDL_PixelFormat & getSDLPixelFormat () const
 
int getRmask () const
 
int getGmask () const
 
int getBmask () const
 
int getAmask () const
 
int getRshift () const
 
int getGshift () const
 
int getBshift () const
 
int getAshift () const
 
int getRloss () const
 
int getGloss () const
 
int getBloss () const
 
int getAloss () const
 
Pixel getBlendMask () const
 Returns a constant that is useful to calculate the average of two pixel values. More...
 

Static Public Member Functions

static Pixel multiply (Pixel p, unsigned x)
 Perform a component wise multiplication of a pixel with an 8-bit fractional value: result = (pixel * x) / 256 [component wise] 'x' must be in range [0..256]. More...
 

Additional Inherited Members

- Static Public Attributes inherited from openmsx::PixelOpBase< Pixel >
static const bool IS_RGB565 = false
 Return true if it's statically known that the pixelformat has a 5-6-5 format (not specified wihich component goes where, but usually it will be BGR). More...
 

Detailed Description

template<typename Pixel>
class openmsx::PixelOperations< Pixel >

Definition at line 153 of file PixelOperations.hh.

Constructor & Destructor Documentation

◆ PixelOperations()

template<typename Pixel >
openmsx::PixelOperations< Pixel >::PixelOperations ( const SDL_PixelFormat &  format)
explicit

Definition at line 261 of file PixelOperations.hh.

Member Function Documentation

◆ alpha()

template<typename Pixel>
unsigned openmsx::PixelOperations< Pixel >::alpha ( Pixel  p) const
inline

Definition at line 294 of file PixelOperations.hh.

◆ alphaBlend()

template<typename Pixel>
Pixel openmsx::PixelOperations< Pixel >::alphaBlend ( Pixel  p1,
Pixel  p2 
) const
inline

Perform alpha blending of two pixels.

Pixel p1 contains the alpha value. For maximal alpha p1 is returned, for minimal alpha p2.

Definition at line 672 of file PixelOperations.hh.

◆ blend() [1/4]

template<typename Pixel>
template<unsigned w1, unsigned w2>
Pixel openmsx::PixelOperations< Pixel >::blend ( Pixel  p1,
Pixel  p2 
) const
inline

Blend the given colors into a single color.

The special case for blending between two colors with an equal blend weight has an optimized implementation.

Definition at line 421 of file PixelOperations.hh.

◆ blend() [2/4]

template<typename Pixel>
template<unsigned w1, unsigned w2, unsigned w3>
Pixel openmsx::PixelOperations< Pixel >::blend ( Pixel  p1,
Pixel  p2,
Pixel  p3 
) const
inline

Definition at line 497 of file PixelOperations.hh.

◆ blend() [3/4]

template<typename Pixel>
template<unsigned w1, unsigned w2, unsigned w3, unsigned w4>
Pixel openmsx::PixelOperations< Pixel >::blend ( Pixel  p1,
Pixel  p2,
Pixel  p3,
Pixel  p4 
) const
inline

Definition at line 519 of file PixelOperations.hh.

◆ blend() [4/4]

template<typename Pixel>
template<unsigned w1, unsigned w2, unsigned w3, unsigned w4, unsigned w5, unsigned w6>
Pixel openmsx::PixelOperations< Pixel >::blend ( Pixel  p1,
Pixel  p2,
Pixel  p3,
Pixel  p4,
Pixel  p5,
Pixel  p6 
) const
inline

Definition at line 548 of file PixelOperations.hh.

◆ blend2()

template<typename Pixel>
template<unsigned w1, unsigned w2>
Pixel openmsx::PixelOperations< Pixel >::blend2 ( const Pixel p) const
inline

Definition at line 584 of file PixelOperations.hh.

◆ blend3()

template<typename Pixel>
template<unsigned w1, unsigned w2, unsigned w3>
Pixel openmsx::PixelOperations< Pixel >::blend3 ( const Pixel p) const
inline

Definition at line 591 of file PixelOperations.hh.

◆ blend4()

template<typename Pixel>
template<unsigned w1, unsigned w2, unsigned w3, unsigned w4>
Pixel openmsx::PixelOperations< Pixel >::blend4 ( const Pixel p) const
inline

Definition at line 598 of file PixelOperations.hh.

◆ blend6()

template<typename Pixel>
template<unsigned w1, unsigned w2, unsigned w3, unsigned w4, unsigned w5, unsigned w6>
Pixel openmsx::PixelOperations< Pixel >::blend6 ( const Pixel p) const
inline

Definition at line 606 of file PixelOperations.hh.

◆ blue()

template<typename Pixel>
unsigned openmsx::PixelOperations< Pixel >::blue ( Pixel  p) const
inline

Definition at line 285 of file PixelOperations.hh.

◆ blue256()

template<typename Pixel>
unsigned openmsx::PixelOperations< Pixel >::blue256 ( Pixel  p) const
inline

Definition at line 342 of file PixelOperations.hh.

◆ combine()

template<typename Pixel >
Pixel openmsx::PixelOperations< Pixel >::combine ( unsigned  r,
unsigned  g,
unsigned  b 
) const
inline

Combine RGB components to a pixel.

Definition at line 352 of file PixelOperations.hh.

◆ combine256()

template<typename Pixel >
Pixel openmsx::PixelOperations< Pixel >::combine256 ( unsigned  r,
unsigned  g,
unsigned  b 
) const
inline

Definition at line 361 of file PixelOperations.hh.

◆ getMaxBlue()

template<typename Pixel >
unsigned openmsx::PixelOperations< Pixel >::getMaxBlue ( ) const
inline

Definition at line 394 of file PixelOperations.hh.

◆ getMaxGreen()

template<typename Pixel >
unsigned openmsx::PixelOperations< Pixel >::getMaxGreen ( ) const
inline

Definition at line 385 of file PixelOperations.hh.

◆ getMaxRed()

template<typename Pixel >
unsigned openmsx::PixelOperations< Pixel >::getMaxRed ( ) const
inline

Get maximum component value.

Definition at line 376 of file PixelOperations.hh.

◆ green()

template<typename Pixel>
unsigned openmsx::PixelOperations< Pixel >::green ( Pixel  p) const
inline

Definition at line 276 of file PixelOperations.hh.

◆ green256()

template<typename Pixel>
unsigned openmsx::PixelOperations< Pixel >::green256 ( Pixel  p) const
inline

Definition at line 333 of file PixelOperations.hh.

◆ isFullyOpaque()

template<typename Pixel>
bool openmsx::PixelOperations< Pixel >::isFullyOpaque ( Pixel  p) const
inline

Definition at line 305 of file PixelOperations.hh.

◆ isFullyTransparent()

template<typename Pixel>
bool openmsx::PixelOperations< Pixel >::isFullyTransparent ( Pixel  p) const
inline

Definition at line 314 of file PixelOperations.hh.

◆ lerp()

template<typename Pixel>
Pixel openmsx::PixelOperations< Pixel >::lerp ( Pixel  p1,
Pixel  p2,
unsigned  x 
) const
inline

Perform linear interpolation between two pixels.

This calculates component-wise: (c1 * (256 - x) + c2 * x) / 256 with c1, c2 the R,B,G,A components of the pixel. 'x' must be in range [0..256]. For x=0 the result is p1. For x=256 the result is p2.

Definition at line 623 of file PixelOperations.hh.

◆ multiply()

template<typename Pixel>
Pixel openmsx::PixelOperations< Pixel >::multiply ( Pixel  p,
unsigned  x 
)
inlinestatic

Perform a component wise multiplication of a pixel with an 8-bit fractional value: result = (pixel * x) / 256 [component wise] 'x' must be in range [0..256].

For x=0 the result is 0. For x=255 the result in the original value. Note: ATM only implemented for 32bpp.

Definition at line 612 of file PixelOperations.hh.

Referenced by openmsx::Multiply< uint32_t >::multiply().

◆ red()

template<typename Pixel>
unsigned openmsx::PixelOperations< Pixel >::red ( Pixel  p) const
inline

Extract RGB componts.

Definition at line 267 of file PixelOperations.hh.

◆ red256()

template<typename Pixel>
unsigned openmsx::PixelOperations< Pixel >::red256 ( Pixel  p) const
inline

Same as above, but result is scaled to [0..255].

Definition at line 324 of file PixelOperations.hh.


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