当前位置: 首页>>代码示例>>C++>>正文


C++ TRgb::Color16MA方法代码示例

本文整理汇总了C++中TRgb::Color16MA方法的典型用法代码示例。如果您正苦于以下问题:C++ TRgb::Color16MA方法的具体用法?C++ TRgb::Color16MA怎么用?C++ TRgb::Color16MA使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TRgb的用法示例。


在下文中一共展示了TRgb::Color16MA方法的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();
    }
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:60,代码来源:peninputpentracedecorator.cpp

示例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
//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:101,代码来源:tsurfacehelper.cpp


注:本文中的TRgb::Color16MA方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。