20 #ifndef INCLUDED_VCL_COLORMASK_HXX
21 #define INCLUDED_VCL_COLORMASK_HXX
26 #define MASK_TO_COLOR( d_nVal, d_RM, d_GM, d_BM, d_RS, d_GS, d_BS, d_Col ) \
27 const sal_uInt8 _def_cR = static_cast<sal_uInt8>( d_RS < 0 ? ( (d_nVal) & d_RM ) << -d_RS : ( (d_nVal) & d_RM ) >> d_RS ); \
28 const sal_uInt8 _def_cG = static_cast<sal_uInt8>( d_GS < 0 ? ( (d_nVal) & d_GM ) << -d_GS : ( (d_nVal) & d_GM ) >> d_GS ); \
29 const sal_uInt8 _def_cB = static_cast<sal_uInt8>( d_BS < 0 ? ( (d_nVal) & d_BM ) << -d_BS : ( (d_nVal) & d_BM ) >> d_BS ); \
30 d_Col = BitmapColor( static_cast<sal_uInt8>( _def_cR | ( ( _def_cR & maR.mnOr ) >> maR.mnOrShift ) ), \
31 static_cast<sal_uInt8>( _def_cG | ( ( _def_cG & maG.mnOr ) >> maG.mnOrShift ) ), \
32 static_cast<sal_uInt8>( _def_cB | ( ( _def_cB & maB.mnOr ) >> maB.mnOrShift ) ) );
35 #define COLOR_TO_MASK( d_rCol, d_RM, d_GM, d_BM, d_RS, d_GS, d_BS, d_ALPHA ) \
36 ( ( ( ( d_RS < 0 ) ? ( static_cast<sal_uInt32>((d_rCol).GetRed()) >> -d_RS ) : \
37 ( static_cast<sal_uInt32>((d_rCol).GetRed()) << d_RS ) ) & d_RM ) | \
38 ( ( ( d_GS < 0 ) ? ( static_cast<sal_uInt32>((d_rCol).GetGreen()) >> -d_GS ) : \
39 ( static_cast<sal_uInt32>((d_rCol).GetGreen()) << d_GS ) ) & d_GM ) | \
40 ( ( ( d_BS < 0 ) ? ( static_cast<sal_uInt32>((d_rCol).GetBlue()) >> -d_BS ) : \
41 ( static_cast<sal_uInt32>((d_rCol).GetBlue()) << d_BS ) ) & d_BM ) | \
66 while( nShift >= 0 && !( mnMask & ( 1 << nShift ) ) )
73 while( nShift >= 0 && ( mnMask & ( 1 << nShift ) ) )
83 mnOr =
static_cast<sal_uInt8>( ( 0xFF >> nLen ) << mnOrShift );
106 inline sal_uInt32 GetRedMask()
const;
107 inline sal_uInt32 GetGreenMask()
const;
108 inline sal_uInt32 GetBlueMask()
const;
137 const sal_uInt32 nVal = pPixel[ 1 ] | (
static_cast<sal_uInt32
>(pPixel[ 0 ]) << 8 );
146 pPixel[ 0 ] =
static_cast<sal_uInt8>(nVal >> 8);
147 pPixel[ 1 ] =
static_cast<sal_uInt8>(nVal);
152 const sal_uInt32 nVal = pPixel[ 0 ] | (
static_cast<sal_uInt32
>(pPixel[ 1 ]) << 8 );
161 pPixel[ 0 ] =
static_cast<sal_uInt8>(nVal);
162 pPixel[ 1 ] =
static_cast<sal_uInt8>(nVal >> 8);
167 const sal_uInt32 nVal =
static_cast<sal_uInt32
>(pPixel[ 0 ]) | ( static_cast<sal_uInt32>(pPixel[ 1 ]) << 8 ) |
168 ( static_cast<sal_uInt32>(pPixel[ 2 ]) << 16 ) | ( static_cast<sal_uInt32>(pPixel[ 3 ]) << 24 );
175 const sal_uInt32 nVal =
static_cast<sal_uInt32
>(pPixel[ 0 ]) | ( static_cast<sal_uInt32>(pPixel[ 1 ]) << 8 ) |
176 ( static_cast<sal_uInt32>(pPixel[ 2 ]) << 16 ) | ( static_cast<sal_uInt32>(pPixel[ 3 ]) << 24 );
177 rAlpha =
static_cast<sal_uInt8>(nVal >> 24);
185 pPixel[ 0 ] =
static_cast<sal_uInt8>(nVal);
186 pPixel[ 1 ] =
static_cast<sal_uInt8>( nVal >> 8 );
187 pPixel[ 2 ] =
static_cast<sal_uInt8>( nVal >> 16 );
188 pPixel[ 3 ] =
static_cast<sal_uInt8>( nVal >> 24 );
191 #endif // INCLUDED_VCL_COLORMASK_HXX
void GetColorAndAlphaFor32Bit(BitmapColor &rColor, sal_uInt8 &rAlpha, const sal_uInt8 *pPixel) const
void GetColorFor16BitMSB(BitmapColor &rColor, const sal_uInt8 *pPixel) const
sal_uInt32 GetRedMask() const
void SetColorFor32Bit(const BitmapColor &rColor, sal_uInt8 *pPixel) const
#define MASK_TO_COLOR(d_nVal, d_RM, d_GM, d_BM, d_RS, d_GS, d_BS, d_Col)
void GetColorFor16BitLSB(BitmapColor &rColor, const sal_uInt8 *pPixel) const
void SetColorFor16BitMSB(const BitmapColor &rColor, sal_uInt8 *pPixel) const
void SetColorFor16BitLSB(const BitmapColor &rColor, sal_uInt8 *pPixel) const
ColorMaskElement(sal_uInt32 nMask=0)
sal_uInt32 GetBlueMask() const
void GetColorFor32Bit(BitmapColor &rColor, const sal_uInt8 *pPixel) const
sal_uInt32 GetGreenMask() const
ColorMask(const ColorMaskElement &rRedMask=ColorMaskElement(), const ColorMaskElement &rGreenMask=ColorMaskElement(), const ColorMaskElement &rBlueMask=ColorMaskElement())
#define COLOR_TO_MASK(d_rCol, d_RM, d_GM, d_BM, d_RS, d_GS, d_BS, d_ALPHA)