本文整理汇总了C++中TRect::SetRect方法的典型用法代码示例。如果您正苦于以下问题:C++ TRect::SetRect方法的具体用法?C++ TRect::SetRect怎么用?C++ TRect::SetRect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TRect
的用法示例。
在下文中一共展示了TRect::SetRect方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Construct
void CStatusWindow::Construct(CTestBase* aTest)
{
_LIT(Title,"StatusWindow");
_LIT(String4,"Click here to finish");
iTest=aTest;
TWindowTitle title(Title);
SetTitle(title);
TInt yy=iTitleHeight+iFont->HeightInPixels()+7;
iRect1.SetRect(3,iTitleHeight+5,iSize.iWidth-1,yy);
TInt yy1=yy+iFont->HeightInPixels()+2;
iRect2.SetRect(3,yy+3,iSize.iWidth-1,yy1);
TInt yy2=yy1+iFont->HeightInPixels()+2;
iRect3.SetRect(3,yy1+3,iSize.iWidth-1,yy2);
iRect4.SetRect(3,yy2+3,iSize.iWidth-1,yy2+iFont->HeightInPixels()+2);
TMachineInfoV1Buf machineInfo;
UserHal::MachineInfo(machineInfo);
iXyInputType=machineInfo().iXYInputType;
iOriginalXyInputType=iXyInputType;
iSimulatedPenDown=EFalse;
//
iString3.Copy(KNullDesC);
if (iXyInputType==EXYInputDeltaMouse)
{
if (HAL::Get(HALData::EMouseState,iSimulatedPenDown)==KErrNone)
UpdateString3();
}
UpdateString1();
iMode=Client()->iWs.PointerCursorMode();
iOriginalMode=iMode;
UpdateString2();
iUpdateNeeded=EFalse;
iString4.Copy(String4);
iExit=EFalse;
}
示例2: GetTerminalRect
void CTerminalContainer::GetTerminalRect(TRect &aRect) {
// Get font dimensions
TInt fontHeight = iFont->FontSize().iHeight;
TInt fontWidth = iFont->FontSize().iWidth;
// Terminal maximum size
TInt termWidth = Rect().Width();
TInt termHeight = Rect().Height();
// Round size down to the largest possible terminal that contains whole
// characters
termWidth = fontWidth * (termWidth / fontWidth);
termHeight = fontHeight * (termHeight / fontHeight);
// The following condition should only be met in the very specific case
// where an e90 user with 800x352 screen, uses the 14point font designed
// explicitly for a 80x24 screen size.
if (fontHeight == 14 && fontWidth == 10 && termWidth == 800) {
termHeight = 24 * fontHeight;
}
assert((termWidth > 0) && (termHeight > 0));
// Set terminal size and position
TInt termX = Rect().iTl.iX + (Rect().Width() - termWidth) / 2;
TInt termY = Rect().iTl.iY + (Rect().Height() - termHeight) / 2;
aRect.SetRect(TPoint(termX, termY), TSize(termWidth, termHeight));
}
示例3: DrawBackground
void CWordTest::DrawBackground(const TParam& aParam,const TRgb& aBackground,TRect& aDrawn) const
{
if (iBackgroundBitmap)
{
aParam.iGc.SetClippingRect(aParam.iDrawRect);
aDrawn.SetRect(aParam.iTextLayoutTopLeft,iBackgroundBitmap->SizeInPixels());
aParam.iGc.DrawBitmap(aDrawn,iBackgroundBitmap);
}
else
MFormCustomDraw::DrawBackground(aParam,aBackground,aDrawn);
}
示例4: GetOrientedRect
//Gets the actual orientation based refresh rect required from a 'physical' screen reference.
TRect RWindows::GetOrientedRect(const TRect &aScreenRect)
{
TRect orientedRect;
switch(iOrientation)
{
case 1:
{
orientedRect.SetRect(aScreenRect.iTl.iY,
iEpocBitmapSize.iWidth-aScreenRect.iBr.iX,
aScreenRect.iBr.iY,
iEpocBitmapSize.iWidth-aScreenRect.iTl.iX);
break;
}
case 2:
{
orientedRect.SetRect(iEpocBitmapSize.iWidth-aScreenRect.iBr.iX,
iEpocBitmapSize.iHeight-aScreenRect.iBr.iY,
iEpocBitmapSize.iWidth-aScreenRect.iTl.iX,
iEpocBitmapSize.iHeight-aScreenRect.iTl.iY);
break;
}
case 3:
{
orientedRect.SetRect(iEpocBitmapSize.iHeight-aScreenRect.iBr.iY,
aScreenRect.iTl.iX,
iEpocBitmapSize.iHeight-aScreenRect.iTl.iY,
aScreenRect.iBr.iX);
break;
}
default:
{
orientedRect = aScreenRect;
break;
}
}
return orientedRect;
}
示例5: DrawReturnArrow
void TDrawer::DrawReturnArrow(CWsBitmap* aBackUpBitmap, CWsBitmap* aResourceBitmap, TRect aWorldPointRect,
TRect aBitMapRect)
{
//根据WorldPointRect大小 和 aBitMapRect的大小 设置新的returnRect的大小
TPoint center;
center.SetXY((aWorldPointRect.iBr.iX + aWorldPointRect.iTl.iX) / 2, (aWorldPointRect.iBr.iY
+ aWorldPointRect.iTl.iY) / 2);
TInt iHalfHigh = (aBitMapRect.iBr.iY - aBitMapRect.iTl.iY) / 2;
TInt iHalfWidth = (aBitMapRect.iBr.iX - aBitMapRect.iTl.iX) / 2;
TRect centerRect;
centerRect.SetRect(center.iX - iHalfWidth, center.iY - iHalfHigh, center.iX + iHalfWidth, center.iY + iHalfHigh);
TBitmapUtil objectUtil(aResourceBitmap);
TBitmapUtil backUpUtil(aBackUpBitmap);
//
objectUtil.Begin(TPoint(0, 0));
backUpUtil.Begin(TPoint(0, 0));
R8G8B8* addr1 = (R8G8B8*) aResourceBitmap->DataAddress();// 对象
R8G8B8* addr2 = (R8G8B8*) aBackUpBitmap->DataAddress();// 背景
TSize desSize = aBackUpBitmap->SizeInPixels();
TSize srcSize = aResourceBitmap->SizeInPixels();
R8G8B8* addr22;
R8G8B8* addr11;
addr22 = addr2 + (centerRect.iTl.iY - 1) * desSize.iWidth + centerRect.iTl.iX;
TSize newSize = centerRect.Size();
addr11 = addr1 + aBitMapRect.iTl.iY * srcSize.iWidth + aBitMapRect.iTl.iX;
//每画完一行,arrd11要前进的距离
TInt iWidthSpan = srcSize.iWidth - newSize.iWidth;
TInt iScreenWidthSpan = desSize.iWidth - newSize.iWidth;
for (TInt j = 0; j < newSize.iHeight; j++)
{
for (TInt i = 0; i < newSize.iWidth; i++)
{
*addr22 = *addr11;
addr22++;
addr11++;
}
addr11 = addr11 + iWidthSpan;
addr22 = addr22 + iScreenWidthSpan;
}
backUpUtil.End();
objectUtil.End();
}
示例6: GetRectFromConfig
TBool CDataWrapperBase::GetRectFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TRect& aResult)
{
TBuf<KMaxTestExecuteCommandLength> tempStore;
TInt top;
tempStore.Format(KFormatEntryField, &aKeyName, &KTagRectTop);
TBool ret=GetIntFromConfig(aSectName, tempStore, top);
TInt left;
tempStore.Format(KFormatEntryField, &aKeyName, &KTagRectLeft);
if ( !GetIntFromConfig(aSectName, tempStore, left) )
{
ret=EFalse;
}
TInt bottom;
tempStore.Format(KFormatEntryField, &aKeyName, &KTagRectBottom);
if ( !GetIntFromConfig(aSectName, tempStore, bottom) )
{
ret=EFalse;
}
TInt right;
tempStore.Format(KFormatEntryField, &aKeyName, &KTagRectRight);
if ( !GetIntFromConfig(aSectName, tempStore, right) )
{
ret=EFalse;
}
if ( ret )
{
aResult.SetRect(left, top, right, bottom);
}
return ret;
}
示例7: UpdateDisplay
TInt COpenWFC_RI_DisplayUpdater::UpdateDisplay()
{
TInt err = KErrNone;
SymbianStreamBuffer readBuffer = iNextReadBuffer;
iNextReadBuffer = SYMBIAN_INVALID_HANDLE;
if (!iNextSceneStream)
{
LOG((" !!! COpenWFC_RI_DisplayUpdater::UpdateDisplay() ASSERT: No top layer has been set!"));
return KErrNotReady;
}
if (readBuffer == SYMBIAN_INVALID_HANDLE)
{
if ((err = SymbianStreamAcquireReadBuffer(iNextSceneStream, &readBuffer)) != KErrNone)
{ //AcquireReadBuffer "Can't fail" in theory, but just incase....
LOG((" !!! COpenWFC_RI_DisplayUpdater::UpdateDisplay() Acquire failed: %d", err));
return err;
}
}
TBufferInfo bufferInfo;
khronos_int32_t width, height, stride;
SymbianStreamGetHeader(iNextSceneStream, &width, &height, &stride, NULL, NULL);
bufferInfo.iBufferWidth = (TInt16)width;
bufferInfo.iBufferHeight = (TInt16)height;
bufferInfo.iStride = (TInt16)stride;
bufferInfo.iBufferFormat = EPixelFormatXRgb8888Le;
bufferInfo.iLinearAddress = 0;
err = SymbianStreamGetBufferPointer(iNextSceneStream, readBuffer,&bufferInfo.iLinearAddress);
if (err == KErrNone)
{
err = SymbianStreamGetChunkHandle(iNextSceneStream, &bufferInfo.iBufferRChunkHandle);
}
if (err != KErrNone)
{
LOG((" !!! COpenWFC_RI_DisplayUpdater::UpdateDisplay() error %d getting stream data", err));
SymbianStreamReleaseReadBuffer(iNextSceneStream, readBuffer);
return err;
}
TRect displayRect;
displayRect.SetRect(TPoint(0, 0), TSize(bufferInfo.iBufferWidth, bufferInfo.iBufferHeight ));
TDisplayViewSettings viewSettings; // Default
viewSettings.iSourceScissor = displayRect;
viewSettings.iDestinationScaledRect = displayRect;
viewSettings.iLayerRotation = ERotate0Deg;
viewSettings.iUsageHint = EPurposeUi;
viewSettings.iTearingFree = ETrue;
LOG((" $$$*** bufferInfo.iBufferWidth %d", bufferInfo.iBufferWidth));
LOG((" $$$*** bufferInfo.iBufferHeight %d", bufferInfo.iBufferHeight));
LOG((" $$$*** bufferInfo.iStride %d", bufferInfo.iStride));
LOG((" $$$*** bufferInfo.iBufferFormat %d", bufferInfo.iBufferFormat));
LOG((" $$$*** bufferInfo.iLinearAddress %08x", bufferInfo.iLinearAddress));
LOG((" $$$*** bufferInfo.iBufferRChunkHandle %d", bufferInfo.iBufferRChunkHandle));
LOG((" $$$*** viewSettings iSourceScissor width %d", viewSettings.iSourceScissor.Width()));
LOG((" $$$*** viewSettings iSourceScissor height %d", viewSettings.iSourceScissor.Height()));
LOG((" $$$*** viewSettings iDestinationScaledRect width %d", viewSettings.iDestinationScaledRect.Width()));
LOG((" $$$*** viewSettings iDestinationScaledRect height %d", viewSettings.iDestinationScaledRect.Height()));
LOG((" $$$*** viewSettings iLayerRotation %d", viewSettings.iLayerRotation));
LOG((" $$$*** viewSettings iUsageHint %d", viewSettings.iUsageHint));
LOG((" $$$*** viewSettings iTearingFree %d", viewSettings.iTearingFree));
TRequestStatus completedWhenReady = KRequestPending;
viewSettings.iLayerRotation = iCurrentRotation;
err = iDisplayUpdater->SetView(KTopMostLayer, viewSettings, bufferInfo);
if (err != KErrNone)
{
LOG((" !!! COpenWFC_RI_DisplayUpdater::UpdateDisplay()ERROR: Display update set view failed %d", err));
}
else
{
err = iDisplayUpdater->SetBuffer(KTopMostLayer, displayRect, bufferInfo );
if (err != KErrNone)
{
LOG((" !!! COpenWFC_RI_DisplayUpdater::UpdateDisplay()ERROR: Display Update set buffer failed %d", err));
}
}
////////////////////////////////////////////////////////////////////////////////////////////
iDisplayUpdater->Flush(completedWhenReady);
/* The TRequestStatus& aCompletedWhenReady parameter is signalled
* either when the buffer has been copied,
* or it is streaming the first pixel to the display
* In either case this indicates that the previous buffer is no longer required.
* By waiting here we guarantee that the previous iCurrentReadBuffer is no longer required,
* but here are more intelligent ways to wait, I am sure!
*/
User::WaitForRequest(completedWhenReady);
if (iCurrentReadBuffer != SYMBIAN_INVALID_HANDLE)
{
// Release the previous update's read buffer.
/* This ensures that a lock is held on the displayed buffer until the next commit/compose
* This is correct behaviour for streaming direct to the display, but is actually not
* necessary if the display makes its own copy.
//.........这里部分代码省略.........
示例8: RenderSprite
void CSpriteSet::RenderSprite(TInt aSpriteType, TInternalSpriteResizeMode aInternalSpriteResizeMode, const TSize& aSourceSize, const TSize& aSpriteSize)
{
const TInt sourceWidth = aSourceSize.iWidth;
const TInt sourceHeight = aSourceSize.iHeight;
const TInt spriteWidth = aSpriteSize.iWidth;
const TInt spriteHeight = aSpriteSize.iHeight;
const TInt numOfHorizAddedLines = spriteHeight-sourceHeight;
const TInt numOfVertAddedLines = spriteWidth-sourceWidth;
const TPoint posZeroZero(0,0); // cached for repeated use
CGulIcon* spriteSetMember = iSourceMembers[aSpriteType];
CFbsBitmap* bitmapToUse = spriteSetMember->Bitmap();
CFbsBitmap* maskToUse = spriteSetMember->Mask();
TRect fromRect;
TPoint toPoint;
switch(aInternalSpriteResizeMode)
{
case EHSameVSame:
{
fromRect.SetRect(0,0,sourceWidth,sourceHeight);
iMainFbsBitGc->BitBlt(posZeroZero,bitmapToUse,fromRect);
iMaskFbsBitGc->BitBlt(posZeroZero,maskToUse,fromRect);
break;
}
case EHSameVShrink:
{
const TInt halfSpriteHeight = spriteHeight/2;
fromRect.SetRect(0,0,spriteWidth,halfSpriteHeight);
iMainFbsBitGc->BitBlt(posZeroZero,bitmapToUse,fromRect);
iMaskFbsBitGc->BitBlt(posZeroZero,maskToUse,fromRect);
fromRect.SetRect(0,sourceHeight - (halfSpriteHeight) - (spriteHeight%2),sourceWidth,sourceHeight);
toPoint.SetXY(0,halfSpriteHeight);
iMainFbsBitGc->BitBlt(toPoint,bitmapToUse,fromRect);
iMaskFbsBitGc->BitBlt(toPoint,maskToUse,fromRect);
break;
}
case EHSameVStretch:
{
const TInt halfSourceHeight = sourceHeight/2;
fromRect.SetRect(0,0,sourceWidth,halfSourceHeight);
iMainFbsBitGc->BitBlt(posZeroZero,bitmapToUse,fromRect);
iMaskFbsBitGc->BitBlt(posZeroZero,maskToUse,fromRect);
fromRect.SetRect(0,halfSourceHeight,sourceWidth,sourceHeight);
toPoint.SetXY(0,spriteHeight-(halfSourceHeight)-(sourceHeight%2));
iMainFbsBitGc->BitBlt(toPoint,bitmapToUse,fromRect);
iMaskFbsBitGc->BitBlt(toPoint,maskToUse,fromRect);
for(TInt i = 0; i < numOfHorizAddedLines;i++)
{
fromRect.SetRect(0,halfSourceHeight,sourceWidth,(halfSourceHeight)+1);
toPoint.SetXY(0,(halfSourceHeight)+i);
iMainFbsBitGc->BitBlt(toPoint,bitmapToUse,fromRect);
iMaskFbsBitGc->BitBlt(toPoint,maskToUse,fromRect);
}
break;
}
case EHShrinkVSame:
{
const TInt halfSpriteWidth = spriteWidth/2;
fromRect.SetRect(0,0,halfSpriteWidth,spriteHeight);
iMainFbsBitGc->BitBlt(posZeroZero,bitmapToUse,fromRect);
iMaskFbsBitGc->BitBlt(posZeroZero,maskToUse,fromRect);
fromRect.SetRect(sourceWidth - (halfSpriteWidth) - (spriteWidth%2),0,sourceWidth,sourceHeight);
toPoint.SetXY(halfSpriteWidth,0);
iMainFbsBitGc->BitBlt(toPoint,bitmapToUse,fromRect);
iMaskFbsBitGc->BitBlt(toPoint,maskToUse,fromRect);
break;
}
case EHShrinkVShrink:
{
const TInt halfSpriteWidth = spriteWidth/2;
const TInt halfSpriteHeight = spriteHeight/2;
const TInt spriteHeightModTwo = spriteHeight%2;
const TInt spriteWidthModTwo = spriteWidth%2;
fromRect.SetRect(0,0,halfSpriteWidth,halfSpriteHeight);
iMainFbsBitGc->BitBlt(posZeroZero,bitmapToUse,fromRect);
iMaskFbsBitGc->BitBlt(posZeroZero,maskToUse,fromRect);
fromRect.SetRect(sourceWidth - (halfSpriteWidth) - (spriteWidthModTwo),0,sourceWidth,halfSpriteHeight);
toPoint.SetXY(halfSpriteWidth,0);
iMainFbsBitGc->BitBlt(toPoint,bitmapToUse,fromRect);
iMaskFbsBitGc->BitBlt(toPoint,maskToUse,fromRect);
fromRect.SetRect(0,sourceHeight - (halfSpriteHeight) - (spriteHeightModTwo),halfSpriteWidth,sourceHeight);
toPoint.SetXY(0,halfSpriteHeight);
iMainFbsBitGc->BitBlt(toPoint,bitmapToUse,fromRect);
iMaskFbsBitGc->BitBlt(toPoint,maskToUse,fromRect);
fromRect.SetRect(sourceWidth - (halfSpriteWidth) - (spriteWidthModTwo),sourceHeight - (halfSpriteHeight) - (spriteHeightModTwo),sourceWidth,sourceHeight);
toPoint.SetXY(halfSpriteWidth,halfSpriteHeight);
iMainFbsBitGc->BitBlt(toPoint,bitmapToUse,fromRect);
iMaskFbsBitGc->BitBlt(toPoint,maskToUse,fromRect);
break;
}
case EHShrinkVStretch:
{
const TInt halfSourceHeight = sourceHeight/2;
const TInt halfSpriteWidth = spriteWidth/2;
const TInt sourceHeightModTwo = sourceHeight%2;
const TInt spriteWidthModTwo = spriteWidth%2;
fromRect.SetRect(0,0,halfSpriteWidth,halfSourceHeight);
iMainFbsBitGc->BitBlt(posZeroZero,bitmapToUse,fromRect);
iMaskFbsBitGc->BitBlt(posZeroZero,maskToUse,fromRect);
fromRect.SetRect(sourceWidth - (halfSpriteWidth) - (spriteWidthModTwo),0,sourceWidth,halfSourceHeight);
//.........这里部分代码省略.........