本文整理汇总了C++中TRgb::SetAlpha方法的典型用法代码示例。如果您正苦于以下问题:C++ TRgb::SetAlpha方法的具体用法?C++ TRgb::SetAlpha怎么用?C++ TRgb::SetAlpha使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TRgb
的用法示例。
在下文中一共展示了TRgb::SetAlpha方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: layoutRect
// -----------------------------------------------------------------------------
// Blit
//
// Blits given image to gc.
//
// -----------------------------------------------------------------------------
//
inline static TBool Blit(
MAknsSkinInstance* aSkin, CBitmapContext& aGc, const TRect& aTrgRect,
CAknsImageItemData* aImgData, const TAknsItemID& aIID,
const TAknsBackground* aLayout, const TPoint& aPADelta,
const TInt aDrawParam )
{
CAknsAppSkinInstance* appInstance =
static_cast<CAknsAppSkinInstance*>(aSkin);
if ( IsBackgroundItem( aIID,appInstance ) &&
appInstance && appInstance->AnimBackgroundState() )
{
if( (aDrawParam&KAknsDrawParamPrepareOnly) )
{
return ETrue;
}
TRgb color = KRgbWhite;
color.SetAlpha(0x00);
aGc.SetPenColor(color);
aGc.SetBrushColor(color);
aGc.SetPenStyle(CGraphicsContext::ESolidPen);
aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
aGc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
TRect layoutRect( aTrgRect );
if( aLayout )
{
layoutRect = aLayout->iRect;
}
layoutRect.Move( -aPADelta );
TRect drawRect = aTrgRect;
drawRect.Intersection( layoutRect );
aGc.Clear(drawRect);
return ETrue;
}
TRect layoutRect( aTrgRect );
const TAknsImageAttributeData* attr = NULL;
if( aLayout )
{
layoutRect = aLayout->iRect;
if( aLayout->iAttr.iAttributes != EAknsImageAttributeNone )
{
attr = &(aLayout->iAttr);
}
}
layoutRect.Move( -aPADelta );
TRect drawRect(aTrgRect);
drawRect.Intersection( layoutRect );
return DrawPartialCachedImage( aSkin, aGc, layoutRect, drawRect,
aImgData, aIID, attr, aDrawParam );
}
示例2: SetPenColor
//Ensure the pen colour is set in the bitmap with the correct alpha blending level
void CTransGc::SetPenColor(const TRgb &aColor)
{
TRgb Color = aColor;
Color.SetAlpha(iAlpha);
iFbsBitGc.SetPenColor(Color);
}
示例3: DrawBitmap
void CEnormousWin::DrawBitmap(CFbsBitGc* aGc, TRect& aClip, TPoint& aOrigin)
{
aGc->Reset();
TPoint origin = iPos + aOrigin;
aGc->SetOrigin(origin);
TRect clip(origin, iSize);
clip.Intersection(aClip);
clip.Move(-origin);
aGc->SetClippingRect(clip);
aGc->SetPenStyle(iPenStyle);
aGc->SetBrushStyle(iBrushStyle);
TInt left = clip.iTl.iX / ESegmentSize;
TInt top = clip.iTl.iY / ESegmentSize;
TInt right = clip.iBr.iX / ESegmentSize + 1;
TInt bottom = clip.iBr.iY / ESegmentSize + 1;
TRgb fg;
TRgb bg;
for (TInt y = top; y < bottom; ++y)
{
TInt g = (y * 31) & 0xFF;
for (TInt x = left; x < right; ++x)
{
TRect rect(x * ESegmentSize, y * ESegmentSize, (x + 1) * ESegmentSize, (y + 1) * ESegmentSize);
TInt r = (x * 25) & 0xFF;
TInt b = ((x + y) * 28) & 0xFF;
TInt col = ((b << 16) + (g << 8) + r) | 0x101010;
bg = col;
fg = 0xFFFFFF ^ col;
bg.SetAlpha(0xFF);
fg.SetAlpha(0xFF);
if (iTransparent && (x & y & 1))
{
bg.SetAlpha(0x80);
fg.SetAlpha(0x80);
}
aGc->SetPenColor(fg);
aGc->SetBrushColor(bg);
aGc->DrawRect(rect);
}
}
CCompWin::DrawBitmap(aGc, aClip, aOrigin);
}
示例4: SetTransparentBackground
void CButton::SetTransparentBackground(TBool aState)
{
TInt alpha;
if (aState){alpha=0;}
else {alpha=255;}
TRgb backgroundColour = KRgbWhite; // for example
if(KErrNone == iButton->Window().SetTransparencyAlphaChannel())
{backgroundColour.SetAlpha(alpha);}
iButton->Window().SetBackgroundColor(backgroundColour);
}
示例5: Redraw
void CEnormousWin::Redraw(const TRect& aRect)
{
iWsGc.Activate(*iWindow);
iWsGc.Reset();
iWsGc.SetPenStyle(iPenStyle);
iWsGc.SetBrushStyle(iBrushStyle);
TInt left = aRect.iTl.iX / ESegmentSize;
TInt top = aRect.iTl.iY / ESegmentSize;
TInt right = aRect.iBr.iX / ESegmentSize + 1;
TInt bottom = aRect.iBr.iY / ESegmentSize + 1;
TRgb fg;
TRgb bg;
for (TInt y = top; y < bottom; ++y)
{
TInt g = (y * 31) & 0xFF;
for (TInt x = left; x < right; ++x)
{
TRect rect(x * ESegmentSize, y * ESegmentSize, (x + 1) * ESegmentSize, (y + 1) * ESegmentSize);
iRedrawWindow->BeginRedraw(rect);
TInt r = (x * 25) & 0xFF;
TInt b = ((x + y) * 28) & 0xFF;
TInt col = ((b << 16) + (g << 8) + r) | 0x101010;
bg = col;
fg = 0xFFFFFF ^ col;
bg.SetAlpha(0xFF);
fg.SetAlpha(0xFF);
if (iTransparent && (x & y & 1))
{
bg.SetAlpha(0x80);
fg.SetAlpha(0x80);
}
iWsGc.SetPenColor(fg);
iWsGc.SetBrushColor(bg);
iWsGc.DrawRect(rect);
iRedrawWindow->EndRedraw();
}
}
iWsGc.Deactivate();
}
示例6: ConstructL
void CWindowMover::ConstructL(MWindowMover* m,QmlApplicationViewer* v,RWsSession* aWs)
{
iWinGroup=new (ELeave) RWindowGroup(*aWs);
iWinGroup->Construct((TUint32)&iWinGroup, EFalse);
iWinGroup->EnableReceiptOfFocus(EFalse); // Don't capture any key events.
iWinGroup->SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront+KAddPriority+1);
CApaWindowGroupName* wn=CApaWindowGroupName::NewL(*aWs);
wn->SetHidden(ETrue);
wn->SetSystem(ETrue);
wn->SetWindowGroupName(*iWinGroup);
delete wn;
iCallBack=m;
viewer=v;
iDragged=EFalse;
CreateWindowL(iWinGroup);
SetPointerCapture(ETrue);
EnableDragEvents();
// for transparency
TRgb backgroundColour = KRgbWhite; // for example
//#ifndef _DEBUG
if(KErrNone == Window().SetTransparencyAlphaChannel())
{backgroundColour.SetAlpha(0);}
//#endif
Window().SetBackgroundColor(backgroundColour);
//SetSize(TSize(1,1));
MakeVisible(EFalse);
SetExtentToWholeScreen();
settings=new QSettings(KConfigFile,QSettings::IniFormat);
xAnim=new MyAnimation();
yAnim=new MyAnimation();
//QEasingCurve curve=new QEasingCurve(QEasingCurve::OutQuad);
xAnim->setEasingCurve(QEasingCurve::OutQuad);
yAnim->setEasingCurve(QEasingCurve::OutQuad);
xAnim->setDuration(200);
yAnim->setDuration(200);
connect(xAnim,SIGNAL(valueChanged(QVariant)),this,SLOT(xAnimChanged(QVariant)));
connect(yAnim,SIGNAL(valueChanged(QVariant)),this,SLOT(yAnimChanged(QVariant)));
connect(yAnim,SIGNAL(finished()),this,SLOT(finished()));
connect(xAnim,SIGNAL(finished()),this,SLOT(finished()));
iTimer=new QTimer();
iTimer->setInterval(400);
iTimer->setSingleShot(false);
connect(iTimer,SIGNAL(timeout()),this,SLOT(checkLaunchArea()));
ActivateL();
int gest=settings->value("settings/gesture").toInt();
if (gest==0) axisSet=false;
else if (gest==1) {axisX=1;axisY=0; axisSet=true;}
else if (gest==2) {axisX=0;axisY=1; axisSet=true;}
}
示例7: RWindowGroup
/**
* @brief Completes the second phase of Symbian object construction.
* Put initialization code that could leave here.
*/
void CTap2CloseAppUi::ConstructL()
{
// [[[ begin generated region: do not modify [Generated Contents]
BaseConstructL( EAknEnableSkin |
EAknEnableMSK );
InitializeContainersL();
// ]]] end generated region [Generated Contents]
//CCoeControl
iWinGroup=new (ELeave) RWindowGroup(CEikonEnv::Static()->WsSession());
iWinGroup->Construct((TUint32)&iWinGroup, EFalse);
iWinGroup->EnableReceiptOfFocus(EFalse); // Don't capture any key events.
iWinGroup->SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront);
CApaWindowGroupName* wn=CApaWindowGroupName::NewL(CEikonEnv::Static()->WsSession());
wn->SetHidden(ETrue);
wn->SetSystem(ETrue);
wn->SetWindowGroupName(*iWinGroup);
delete wn;
iButton = CAknButton::NewL();
iButton->ConstructFromResourceL(R_CLOSE_BUTTON);
iButton->CreateWindowL(iWinGroup);
TInt scrX=CEikonEnv::Static()->ScreenDevice()->SizeInPixels().iWidth;
TRgb backgroundColour = KRgbWhite; // for example
if(KErrNone == iButton->Window().SetTransparencyAlphaChannel())
{backgroundColour.SetAlpha(0);}
iButton->Window().SetBackgroundColor(backgroundColour);
iButton->SetIconSize(KSize);
TRect r;
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EBatteryPane,r);
iButton->SetRect(TRect ( TPoint(scrX-KSize.iWidth-r.Width()-5,0),KSize));
iButton->SetObserver(this);
iButton->MakeVisible(ETrue);
iButton->ActivateL();
CEikonEnv::Static()->RootWin().SetOrdinalPosition(-4);
HideApplicationFromFSW(ETrue);
iObserver=CGroupListObserver::NewL(this);
}
示例8: GetRgbFromConfig
TBool CDataWrapperBase::GetRgbFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TRgb& aResult)
{
TBuf<KMaxTestExecuteCommandLength> tempStore;
TInt red;
tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbRed);
TBool ret=GetIntFromConfig(aSectName, tempStore, red);
TInt green;
tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbGreen);
if ( !GetIntFromConfig(aSectName, tempStore, green) )
{
ret=EFalse;
}
TInt blue;
tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbBlue);
if ( !GetIntFromConfig(aSectName, tempStore, blue) )
{
ret=EFalse;
}
if ( ret )
{
aResult.SetRed(red);
aResult.SetGreen(green);
aResult.SetBlue(blue);
TInt alpha;
tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbAlpha);
if ( GetIntFromConfig(aSectName, tempStore, alpha) )
{
aResult.SetAlpha(alpha);
}
}
return ret;
}
示例9: RasterizePictographLineL
TBool CHuiRasterizedTextMesh::RasterizePictographLineL(const TDesC& aTextLine, CFont* aFont, SRasterizedLine & aLineOut)
{
if(iUsingPreRasterizedMesh)
{
return EFalse;
}
// Retrieve the used text style.
THuiTextStyle* textStyle = CHuiStatic::Env().TextStyleManager().TextStyle(iTextStyleId);
// Calculate line extents and assign it to texture size.
TSize textureSize = textStyle->LineExtentsL(aTextLine);
if(textureSize.iWidth == 0 || !iPictographInterface || !iPictographInterface->Interface()->ContainsPictographs(aTextLine))
{
// This is an empty string or it does not contain pictographs. We will not rasterize it.
// Just add a gap.
aLineOut.iTexture = NULL;
aLineOut.iGap = textureSize.iHeight;
return !IsMaxLineCountReached();
}
// store the actual size to be assigned as the textures logical size
TSize actualsize(textureSize);
if (aLineOut.iTexture == NULL)
{
// Create a texture for storing the pictographs into.
aLineOut.iTexture = CHuiTexture::NewL();
HUI_DEBUG1(_L("CHuiRasterizedTextMesh::RasterizePictographLineL() - Registering self (0x%x) as a texture content observer."), this);
// Register one content observer for the first texture that
// is able to restore all lines in a single run
if (iLines.Count()==1)
{
aLineOut.iTexture->iContentObservers.AppendL(*this);
}
aLineOut.iGap = 0;
}
// set a name for the texture
// @todo is this needed, what names to use
aLineOut.iTexture->SetImageFileNameL(_L("Pictographs"));
TSize maxTextureSize = aLineOut.iTexture->MaxTextureSize();
textureSize.iWidth = Min(textureSize.iWidth, maxTextureSize.iWidth);
textureSize.iHeight = Min(textureSize.iHeight, maxTextureSize.iHeight);
if((textureSize.iWidth == 0) || (textureSize.iHeight == 0))
{
// Cannot draw into this tiny texture, so leave.
HUI_DEBUG2(_L("CHuiRasterizedTextMesh::RasterizePictographLineL() - texture size was too small to draw into (%i, %i)."), textureSize.iWidth, textureSize.iHeight);
User::Leave(KErrAbort);
}
User::LeaveIfError( iPictographBitmap->Resize(textureSize) );
CFbsBitmapDevice* device = CFbsBitmapDevice::NewL(iPictographBitmap);
CleanupStack::PushL(device);
CFbsBitGc* gc = 0;
User::LeaveIfError( device->CreateContext(gc) );
CleanupStack::PushL(gc);
// Prepare the bitmap for drawing...set drawmode because of EColor16MA mode...
gc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
TRgb color = KRgbWhite;
color.SetAlpha(0x00);
gc->SetBrushColor(color);
gc->Clear();
gc->UseFont(aFont);
// Draw pictorgraphs
iPictographInterface->Interface()->DrawPictographsInText(
*gc,
*aFont,
aTextLine, TPoint(0, aFont->FontMaxAscent()));
CleanupStack::PopAndDestroy(gc);
CleanupStack::PopAndDestroy(device);
aLineOut.iTexture->UploadL(*iPictographBitmap, NULL, EHuiTextureUploadFlagRetainResolution);
aLineOut.iTexture->SetSize(actualsize);
return !IsMaxLineCountReached();
}