本文整理汇总了C++中TRgb::Color64K方法的典型用法代码示例。如果您正苦于以下问题:C++ TRgb::Color64K方法的具体用法?C++ TRgb::Color64K怎么用?C++ TRgb::Color64K使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TRgb
的用法示例。
在下文中一共展示了TRgb::Color64K方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
// ---------------------------------------------------------------------------
// Convert device-independent color to device-dependent color.
// ---------------------------------------------------------------------------
//
TInt CPeninputPenTraceDecorator::Rgb2DeviceColor( TDisplayMode aDisplayMode, const TRgb& aColor )
{
switch( aDisplayMode )
{
case EGray2:
{
return aColor.Gray2();
}
case EGray4:
{
return aColor.Gray4();
}
case EGray16:
{
return aColor.Gray16();
}
case EGray256:
{
return aColor.Gray256();
}
case EColor16:
{
return aColor.Color16();
}
case EColor256:
{
return aColor.Color256();
}
case EColor64K:
{
return aColor.Color64K();
}
case EColor16M:
{
return aColor.Color16M();
}
case EColor4K:
{
return aColor.Color4K();
}
case EColor16MU:
{
return aColor.Color16MU();
}
case EColor16MA:
{
return aColor.Color16MA();
}
case EColor16MAP:
{
return aColor.Color16MAP();
}
default:
return aColor.Internal();
}
}
示例2: FillRectangleL
/**
Fill a rectangle on the given surface.
@param aSurface The surface to be filled.
@param aStartPos Where to place the rectangle.
@param aSize Size of the rectangle.
@param aColor The colour to fill it with.
*/
void CSurfaceHelper::FillRectangleL(const TSurfaceId& aSurface, const TPoint& aStartPos, const TSize& aSize, const TRgb& aColor)
{
RSurfaceManager::TInfoBuf infoBuf;
RSurfaceManager::TSurfaceInfoV01& info = infoBuf();
User::LeaveIfError(iManager.SurfaceInfo(aSurface, infoBuf));
TUint32 color = 0;
if (info.iSize.iHeight<0 || info.iSize.iWidth<0 || info.iStride<0)
{
User::Leave(KErrCorrupt);
}
if (info.iSize.iHeight==0 || info.iSize.iWidth==0 || info.iStride==0)
{
User::Leave(KErrNotReady);
}
switch (info.iPixelFormat)
{
case EUidPixelFormatXRGB_8888:
{
color = aColor.Color16MU();
#ifdef ALPHA_FIX_24BIT
color |= ((ALPHA_FIX_24BIT)&0xff)<<24;
#endif
break;
}
case EUidPixelFormatARGB_8888:
{
color = aColor.Color16MA();
break;
}
case EUidPixelFormatARGB_8888_PRE:
{
color = aColor.Color16MAP();
break;
}
case EUidPixelFormatRGB_565:
{
color = aColor.Color64K();
break;
}
default:
{
User::Leave(KErrNotSupported);
break;
}
}
RChunk chunk;
User::LeaveIfError(iManager.MapSurface(aSurface, chunk));
CleanupClosePushL(chunk);
TUint8* surfacePtr = chunk.Base();
// Check for out of bounds
TBool validRect = ETrue;
TInt surfaceWidth = info.iSize.iWidth;
TInt surfaceHeight = info.iSize.iHeight;
// Width and Height
if ((aStartPos.iX + aSize.iWidth) > surfaceWidth)
{
validRect = EFalse;
}
if ((aStartPos.iY + aSize.iHeight) > surfaceHeight)
{
validRect = EFalse;
}
// Starting position
if ((aStartPos.iX < 0) || (aStartPos.iY < 0))
{
validRect = EFalse;
}
if (!validRect)
{
User::Leave(KErrOverflow);
}
if (info.iPixelFormat == EUidPixelFormatRGB_565)
{ //2 bytes per pixel
if ( info.iSize.iWidth*2>info.iStride)
{
User::Leave(KErrOverflow);
}
TInt offset;
User::LeaveIfError(iManager.GetBufferOffset(aSurface, 0, offset));
TUint16* ptr = reinterpret_cast<TUint16*>(surfacePtr + offset);
// Fill the rectangle
//.........这里部分代码省略.........