本文整理汇总了C++中TRgb::Alpha方法的典型用法代码示例。如果您正苦于以下问题:C++ TRgb::Alpha方法的具体用法?C++ TRgb::Alpha怎么用?C++ TRgb::Alpha使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TRgb
的用法示例。
在下文中一共展示了TRgb::Alpha方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InterpolateColour
/**
Interpolates between the two TRgb values aHi and aLo including alpha channel, with the value aX and the denoinator aN
*/
TRgb CTe_graphicsperformanceSuiteStepBase::InterpolateColour(TRgb aLo, TRgb aHi, TInt aX, TInt aN)
{
TInt y = aN - aX;
TUint8 a = (TUint8)( (aHi.Alpha()*aX + aLo.Alpha()*y)/aN );
TUint8 r = (TUint8)( (aHi.Red()*aX + aLo.Red()*y)/aN );
TUint8 g = (TUint8)( (aHi.Green()*aX + aLo.Green()*y)/aN );
TUint8 b = (TUint8)( (aHi.Blue()*aX + aLo.Blue()*y)/aN );
return TRgb(r, g, b, a);
}
示例2: ColorAdjust
EXPORT_C TRgb ColorUtils::ColorAdjust(TRgb aColor,TInt aPercentage)
/** Brightens or darkens a 24-bit colour by a percentage.
If the percentage given is less than 100%, a darker colour will be returned.
The algorithm brightens or darkens each of the R, G and B channels equally.
@param aColor Input colour.
@param aPercentage Percentage by which to adjust the input colour.
@return The adjusted colour. */
{
// Poor algorithm for the moment, but it can improve and all apps that
// use this will benefit. (I don't think the accuracy for a 16/256 color system
// is really relevant anyway)
TInt red=aColor.Red();
TInt green=aColor.Green();
TInt blue=aColor.Blue();
TInt alpha=aColor.Alpha();
if (aPercentage<=100)
{
red=(red * aPercentage)/100;
green=(green * aPercentage)/100;
blue=(blue * aPercentage)/100;
}
else
{
red = 255 - (((255 - red) * 100) / aPercentage);
green = 255 - (((255 - green) * 100) / aPercentage);
blue = 255 - (((255 - blue) * 100) / aPercentage);
}
return TRgb(red,green,blue,alpha);
}
示例3: CompareDisplayL
/**
Compare the window with the bitmap.
@param aScreen The screen device object
@param aBitmap The bitmap object for comparison
@return ETrue if the window and the bitmap is identified. Otherwise return EFalse.
*/
TBool CT_WServGenericpluginStepLoad::CompareDisplayL(CWsScreenDevice* aScreen, CFbsBitmap* aBitmap)
{
// Capture window display to bitmap
CFbsBitmap* screenBitmap = new(ELeave) CFbsBitmap();
CleanupStack::PushL(screenBitmap);
User::LeaveIfError(screenBitmap->Create(KWinRect.Size(), iDisplayMode));
User::LeaveIfError(aScreen->CopyScreenToBitmap(screenBitmap, KWinRect));
//Compare the window bitmap with the bitmap pass in for comparison
TBool ret = ETrue;
const TReal KErrorLimit = 0.05;
TInt mismatchedPixels = 0;
TRgb testWinPix = TRgb(0,0,0,0);
TRgb checkWinPix = TRgb(0,0,0,0);
for (TInt x = 0; x < KWinRect.Width(); x++)
{
for (TInt y = 0; y < KWinRect.Height(); y++)
{
screenBitmap->GetPixel(testWinPix, TPoint(x,y));
aBitmap->GetPixel(checkWinPix, TPoint(x,y));
//check if there are differeces between test Window colors and check Window colors
if(((TReal)abs(testWinPix.Red() - checkWinPix.Red())/255) > KErrorLimit ||
((TReal)abs(testWinPix.Blue() - checkWinPix.Blue())/255) > KErrorLimit ||
((TReal)abs(testWinPix.Green() - checkWinPix.Green())/255) > KErrorLimit ||
((TReal)abs(testWinPix.Alpha() - checkWinPix.Alpha())/255) > KErrorLimit)
{
mismatchedPixels++; // -- Useful for debugging
ret = EFalse;
break;
}
}
}
/* INFO_PRINTF2(_L("Number of different pixels: %i"), mismatchedPixels); */ // -- Useful for debugging
CleanupStack::PopAndDestroy(screenBitmap);
return ret;
}
示例4: RgbLighterColor
EXPORT_C TRgb ColorUtils::RgbLighterColor(TRgb aRgb, TDisplayMode aMode)
/** Creates a lighter colour.
@param aRgb The Rgb colour.
@param aMode The display mode, which indicates the screen output of the colour
e.g. 256 colour display mode (8 bpp).
@return The lighter colour. */
{
switch (aMode)
{
case EColor256:
return TRgb::Color256(color256lightlutab[aRgb.Color256()]);
default:
TInt value = aRgb.Internal();
TInt b = Min( 255, ((value & 0x000000ff) ) + KLightRgbAdder );
TInt g = Min( 255, ((value & 0x0000ff00) >> 8) + KLightRgbAdder );
TInt r = Min( 255, ((value & 0x00ff0000) >> 16) + KLightRgbAdder );
return TRgb(r,g,b,aRgb.Alpha());
}
}
示例5: RgbDarkerColor
EXPORT_C TRgb ColorUtils::RgbDarkerColor(TRgb aRgb, TDisplayMode aMode)
/** Creates a darker color.
@param aRgb The RGB color.
@param aMode The display mode, which indicates the screen output of the colour
e.g. 256 colour display mode (8 bpp).
@return The darker colour. */
{
switch (aMode)
{
case EColor256:
return TRgb::Color256(color256darklutab[aRgb.Color256()]);
default:
TInt value = aRgb.Internal();
TInt b = Max( 0, ((value & 0x000000ff) ) - KDarkRgbSubtractor );
TInt g = Max( 0, ((value & 0x0000ff00) >> 8) - KDarkRgbSubtractor );
TInt r = Max( 0, ((value & 0x00ff0000) >> 16) - KDarkRgbSubtractor );
return TRgb(r,g,b,aRgb.Alpha());
}
}