本文整理汇总了C++中TSize函数的典型用法代码示例。如果您正苦于以下问题:C++ TSize函数的具体用法?C++ TSize怎么用?C++ TSize使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TSize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ColumnViewer
void TSensorView::ColumnViewer(TDC& dc,PSHORTREAL pData)
{
m_xSize = m_nDimSize[0];
m_ySize = m_nDimSize[1];
m_yAdd = (int) (500L * m_ySize / m_xSize / 2);
dc.SetWindowExt(TSize(m_xSize * 2 + m_ySize,500 + m_yAdd));
Grid3D(dc);
TBrush brGray(SYSCOLOR(COLOR_BTNFACE)),
brWhite(SYSCOLOR(COLOR_BTNHIGHLIGHT)),
brDark(SYSCOLOR(COLOR_BTNSHADOW));
for (int y = 0; y < m_nDimSize[1]; y++)
for (int x = 0; x < m_nDimSize[0]; x++)
{
SHORTREAL r = pData[x + (LONGINT) m_nDimSize[0] * y];
TPoint pt[4] =
{
Project2D(x,y+1,r),
Project2D(x+1,y+1,r),
Project2D(x+1,y,r),
Project2D(x,y,r)
};
dc.SelectObject(brWhite);
POLY(dc,pt,4);
SHORTREAL r2 = y == m_nDimSize[1]-1
? 0
: pData[x + (LONGINT) m_nDimSize[0] * (y+1)];
if(r2 < r)
{
pt[2] = Project2D(x+1,y+1,r2);
pt[3] = Project2D(x,y+1,r2);
dc.SelectObject(brGray);
POLY(dc,pt,4);
}
r2 = x == m_nDimSize[0]-1 ? 0
: pData[x+1 + (LONGINT) m_nDimSize[0] * y];
if (r2 < r)
{
pt[0] = Project2D(x+1,y,r);
pt[2] = Project2D(x+1,y+1,r2);
pt[3] = Project2D(x+1,y,r2);
dc.SelectObject(brDark);
POLY(dc,pt,4);
}
}
dc.RestoreBrush();
}
示例2: TRAP_IGNORE
void CaMifIconEngine::getPixmapFromBitmap(const QSize &size, QPixmap& pixmap)
{
if (!mBitmapCached || !mMaskBitmapCached) {
TRAP_IGNORE(cacheBitmapL());
}
if (mBitmapCached && mMaskBitmapCached) {
CFbsBitmap *bitmap = mBitmapCached;
CFbsBitmap *maskBitmap = mMaskBitmapCached;
AknIconUtils::SetSize(bitmap, TSize(size.width(), size.height()),
EAspectRatioPreservedAndUnusedSpaceRemoved);
pixmap = pixmap.fromSymbianCFbsBitmap(bitmap);
QPixmap mask;
mask = mask.fromSymbianCFbsBitmap(maskBitmap);
pixmap.setAlphaChannel(mask);
}
}
示例3: CreateWindowL
void CTstControl::ConstructL()
{
RWsSession& windowServerSession=iCoeEnv->WsSession();
windowServerSession.SetAutoFlush(ETrue);
CreateWindowL();
EnableDragEvents();
ClaimPointerGrab();
RDrawableWindow& window=*DrawableWindow();
window.SetOrdinalPosition(0);
window.SetShadowHeight(3);
CWsScreenDevice& screenDevice=*iCoeEnv->ScreenDevice();
const TSize screenSize(screenDevice.SizeInPixels());
SetExtent(TPoint(20, 20), TSize(screenSize.iWidth-40, screenSize.iHeight-40));
iEikonEnv->AddDialogLikeControlToStackL(this);
iAppServer=CTstAppServer::NewL();
ActivateL();
}
示例4: CalcMinL
TSize CalcMinL()
{
CALLSTACKITEM_N(_CL("CJuikFixedWidthSizer"), _CL("CalcMinL"));
if ( ! iChildren.Count() )
return TSize(0,0);
// Calculate min size recursively & Calculate total stretch
TSize minSize(iPresetMinSize.iWidth,0);
for (TInt i=0; i < iChildren.Count(); i++)
{
CJuikSizerItem* child = iChildren[i];
child->SetFixedWidthL( iPresetMinSize.iWidth );
TSize cSize = child->CalcMinL();
minSize.iHeight += cSize.iHeight;
}
return minSize;
}
示例5: QWindowSurface
QS60WindowSurface::QS60WindowSurface(QWidget* widget)
: QWindowSurface(widget), d_ptr(new QS60WindowSurfacePrivate)
{
QWidgetPrivate *widgetPrivate = qt_widget_private(widget);
const bool opaque = widgetPrivate->isOpaque && !blitWriteAlpha(widgetPrivate);
TDisplayMode mode = displayMode(opaque);
// We create empty CFbsBitmap here -> it will be resized in setGeometry
CFbsBitmap *bitmap = new CFbsBitmap; // CBase derived object needs check on new
Q_CHECK_PTR(bitmap);
qt_symbian_throwIfError( bitmap->Create( TSize(0, 0), mode ) );
QS60PixmapData *data = new QS60PixmapData(QPixmapData::PixmapType);
if (data) {
data->fromSymbianBitmap(bitmap, true);
d_ptr->device = QPixmap(data);
}
}
示例6: ColorViewer
void TSensorView::ColorViewer(TDC& dc,PSHORTREAL pData)
{
int zMax = m_nDimSize[m_nDim-1],
xMax = m_nDim > 1 ? m_nDimSize[0] : 1,
yMax = m_nDim > 2 ? m_nDimSize[1] : 1;
dc.SetWindowExt(TSize(xMax,yMax));
for (int y = 0; y < yMax; y++)
{
int xStart = 0,
x = 0;
TColor clrLast,
clrThis;
while(x < xMax)
{
int Color[3] = {0,0,0};
for (int z = 0; z < zMax; z++)
{
SHORTREAL r = pData[x + y * (LONGINT) xMax
+ z * (LONGINT) xMax
* (LONGINT) yMax];
if (r > 1)
r = 1;
else if (r < 0)
r = 0;
Color[z] = (int) (pow(r,m_dBright) * 255);
}
clrThis = TColor(Color[0],Color[1],Color[2]);
if(!x)
clrLast = clrThis;
else if(clrThis != clrLast)
{
TBrush br(clrLast);
TRect rect(xStart,y,x,y+1);
dc.FillRect(rect,br);
xStart = x;
clrLast = clrThis;
}
x++;
}
TBrush br(clrLast);
TRect rect(xStart,y,x,y+1);
dc.FillRect(rect,br);
}
Grid2D(dc);
}
示例7: LayoutChildL
void LayoutChildL(TInt aIx)
{
CALLSTACKITEM_N(_CL("CJuikFixedWidthSizer"), _CL("LayoutChildL"));
if ( ! iChildren.Count() )
return;
CJuikSizerItem* child = iChildren[aIx];
child->SetFixedWidthL( iPresetMinSize.iWidth );
TSize cSize = child->CalcMinL();
//minSize.iHeight += cSize.iHeight;
cSize = child->MinSize();
// Figure out y-position for this child
TPoint pos;
// First and only child
if ( iChildren.Count() <= 1 )
{
pos = iPos;
}
// layout to top
else if (aIx == 0)
{
CJuikSizerItem* after = iChildren[aIx+1];
pos = after->Position();
}
// layout any other position
else
{
CJuikSizerItem* before = iChildren[aIx-1];
pos = before->Position();
pos += TPoint( 0, before->Rect().Size().iHeight );
}
child->SetDimensionL( pos, cSize );
// Transform rest of entries downwards
for (TInt i = aIx + 1; i < iChildren.Count(); i++)
{
CJuikSizerItem* c = iChildren[i];
TPoint p = c->Position();
c->SetPositionL( p + TSize(0, cSize.iHeight), ETrue );
}
}
示例8: shieldWin
void CTScreenDevice::doTestScreenToBitmapL()
{
RBlankWindow shieldWin(TheClient->iWs);
shieldWin.Construct(*TheClient->iGroup->GroupWin(),1);
shieldWin.SetOrdinalPosition(0,-1);
shieldWin.SetColor(TRgb::Gray4(1));
shieldWin.Activate();
CleanupStack::PushL(TCleanupItem(CleanUpWindow,&shieldWin));
TSize scrSize(TheClient->iScreen->SizeInPixels());
CWsBitmap *wsBitmap=new(ELeave) CWsBitmap(TheClient->iWs);
CleanupStack::PushL(wsBitmap);
User::LeaveIfError(wsBitmap->Create(scrSize,EGray4));
CFbsBitmap *bitmap=new(ELeave) CFbsBitmap;
CleanupStack::PushL(bitmap);
TheClient->iWs.Finish();
TheClient->WaitForRedrawsToFinish();
User::LeaveIfError(bitmap->Create(TSize(30,10),EGray4));
//
User::LeaveIfError(TheClient->iScreen->CopyScreenToBitmap(wsBitmap));
CheckBitmapL(wsBitmap,TRect(scrSize));
//
User::LeaveIfError(TheClient->iScreen->CopyScreenToBitmap(bitmap));
CheckBitmapL(bitmap,TRect(scrSize));
//
TRect rect1(111,10,222,20);
User::LeaveIfError(TheClient->iScreen->CopyScreenToBitmap(wsBitmap,rect1));
CheckBitmapL(wsBitmap,rect1);
//
TRect rect2(10,20,100,200);
User::LeaveIfError(TheClient->iScreen->CopyScreenToBitmap(bitmap,rect2));
CheckBitmapL(bitmap,rect2);
//
// Now some mad values
//
// Right edge left of left edge
User::LeaveIfError(TheClient->iScreen->CopyScreenToBitmap(bitmap,TRect(100,20,90,200)));
// Off the edge of the screen
User::LeaveIfError(TheClient->iScreen->CopyScreenToBitmap(bitmap,TRect(-10,20,-5,200)));
// Off the edge of the screen again
User::LeaveIfError(TheClient->iScreen->CopyScreenToBitmap(bitmap,TRect(scrSize.AsPoint()+TPoint(5,5),TSize(10,10))));
//
CleanupStack::PopAndDestroy(3);
}
示例9: TSize
// ---------------------------------------------------------------------------
// Helper methods
// ---------------------------------------------------------------------------
//
void CAfStorageClient::clearLastCallInfo()
{
CAfStorageClient::constructorError = EFalse;
CAfStorageClient::expectedReturnCode = KErrNone;
delete CAfStorageClient::lastCallEntry;
CAfStorageClient::lastCallEntry = 0;
CAfStorageClient::lastCallImageHandle = 0;
CAfStorageClient::lastCallThumbnailSize = TSize(0,0);
delete CAfStorageClient::lastCallThumbnailPath;
CAfStorageClient::lastCallThumbnailPath = 0;
CAfStorageClient::lastCallUserData = 0;
lastMethodCalled = CAfStorageClient::NoCall;
}
示例10: OwlCopyBmp
//
/// Add a cel from another CelArray to this CelArray
//
int
TCelArray::Add(const TCelArray& src, int index)
{
// if (src.CSize != CSize)
// return -1;
if (NCelsUsed >= NCels)
if (!Resize(NCels + NGrowBy))
return -1;
OwlCopyBmp(*Bitmap, (const TBitmap&)src, CelOffset(NCelsUsed,0),
TSize(CSize.cx,CSize.cy*NRows),CelRect(index,0).TopLeft());
TRACEX(OwlGadget, 1, "TCelArray @" << (void*)this << " added TCelArray @" <<
(void*)&src << " index 0x" << index);
return NCelsUsed++;
}
示例11: DrawEyebrow
void CSmiley::DrawEyebrow(CWindowGc & aGc, TBool bSmiling) const
{
//Draw the mouth, smiling or looking sad.
aGc.SetPenSize(TSize(1, 1));
aGc.SetPenColor(KRgbWhite);
if (bSmiling)
{
aGc.DrawArc(iFrownRect,
iFrownRect.iTl + TPoint(iSmileyWidth / 2, iFrownRect.Height() / 2),
iFrownRect.iTl + TPoint(0, iFrownRect.Height() / 2));
}
else
{
aGc.DrawArc(iSmileRect,
iSmileRect.iTl + TPoint(0, iSmileRect.Height() / 2),
iSmileRect.iTl + TPoint(iSmileyWidth / 2, iSmileRect.Height() / 2));
}
}
示例12: CHECK
//
/// Constructs an ImageList right from a bmp, icon or cursor resource in a file.
/// 'type' should be one of the consts from winuser.h:
/// - IMAGE_BITMAP
/// - IMAGE_ICON
/// - IMAGE_CURSOR
/// - IMAGE_ENHMETAFILE ?
///
/// \todo what really are the acceptable types?
//
TImageList::TImageList(HINSTANCE hI, TResId resName, int imageWidth, int growBy,
const TColor& mask, uint type, uint flags)
{
if (!TCommCtrl::IsAvailable())
TXCommCtrl::Raise();
Bitmap = 0;
Handle = TCommCtrl::Dll()->ImageList_LoadImage(hI, resName, imageWidth, growBy, mask, type, flags);
if (Handle)
{
int x, y;
bool r = TCommCtrl::Dll()->ImageList_GetIconSize(Handle, &x, &y);
CHECK(r); InUse(r);
ImageSize = TSize(x, y);
}
CheckValid();
WARNX(OwlCommCtrl, !Handle, 0, "Cannot create ImageList");
}
示例13: InitBitmap
void CContentInfoDialog::InitBitmap()
{
iBackRect=iMainEngine.ScreenLayout().GetClientRect();
iTextHeight=iMainEngine.ScreenLayout().FontHeight();
iMargin=iTextHeight/2;
if(iShowBmp)
{
iIconSize=iShowBmp->SizeInPixels();
if(iIconSize.iHeight>100||iIconSize.iWidth>100)
{
#ifdef __SERIES60_3X__
AknIconUtils::SetSize(iShowBmp,TSize(100,100));
#endif
iIconSize=iShowBmp->SizeInPixels();
}
}
else if(iBool)
{
iIconSize.iHeight=iTextHeight+iMargin;
iIconSize.iWidth=iBackRect.Size().iWidth-iTextHeight;
}
iTextSize.iHeight=iTextHeight+iMargin;
iTextSize.iWidth=iBackRect.Size().iWidth-iTextHeight-3;
TInt num=iIconSize.iHeight/iTextSize.iHeight;
if(iIconSize.iHeight%iTextSize.iHeight>0)
num++;
iAllLine=num;
iLineWidth=iBackRect.Size().iWidth-iTextHeight;
iMaxLine=(iBackRect.Height()-iIconSize.iHeight-iTextHeight)/(iTextHeight+iMargin);
iStartPoint.iX=iBackRect.iTl.iX+iMargin;
iStartPoint.iY=iBackRect.iTl.iY+iMargin;
InitScrollBar();
}
示例14: MySetIndex
/*
-----------------------------------------------------------------------------
----------------------------------------------------------------------------
*/
void CMainContainer::MakeListBoxL()
{
TInt MySetIndex(0);
if(iMyListBox)
{
MySetIndex = HandleViewSelectedIndex();
}
delete iMyListBox;
iMyListBox = NULL;
delete iProfileBox;
iProfileBox = NULL;
iMyListBox = new( ELeave ) CAknDoubleLargeStyleListBox();
iMyListBox->ConstructL(this,EAknListBoxSelectionList);
CArrayPtr<CGulIcon>* icons =new( ELeave ) CAknIconArray(1);
CleanupStack::PushL(icons);
iMyListBox->Model()->SetItemTextArray(GetProfilesArrayL(icons,TSize(0,0)));
iMyListBox->Model()->SetOwnershipType(ELbmOwnsItemArray);
CleanupStack::Pop(icons);
iMyListBox->ItemDrawer()->ColumnData()->SetIconArray(icons);
iMyListBox->CreateScrollBarFrameL( ETrue );
iMyListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
iMyListBox->SetRect(Rect());
// iMyListBox->View()->SetListEmptyTextL(KtxNoData);
iMyListBox->ActivateL();
TInt ItemsCount = iMyListBox->Model()->ItemTextArray()->MdcaCount();
if(ItemsCount > MySetIndex && MySetIndex >= 0)
iMyListBox->SetCurrentItemIndex(MySetIndex);
else if(ItemsCount > 0)
iMyListBox->SetCurrentItemIndex(0);
UpdateScrollBar(iMyListBox);
iMyListBox->DrawNow();
}
示例15: QVERIFY
void tst_QVolatileImage::create()
{
QVolatileImage nullImg;
QVERIFY(nullImg.isNull());
QVolatileImage img(100, 200, QImage::Format_ARGB32);
QVERIFY(!img.isNull());
QCOMPARE(img.width(), 100);
QCOMPARE(img.height(), 200);
QCOMPARE(img.format(), QImage::Format_ARGB32);
QCOMPARE(img.byteCount(), img.bytesPerLine() * img.height());
QCOMPARE(img.hasAlphaChannel(), true);
QCOMPARE(img.depth(), 32);
QImage source(12, 23, QImage::Format_ARGB32_Premultiplied);
img = QVolatileImage(source);
QVERIFY(!img.isNull());
QCOMPARE(img.width(), 12);
QCOMPARE(img.height(), 23);
QCOMPARE(img.format(), source.format());
QCOMPARE(img.byteCount(), img.bytesPerLine() * img.height());
QVERIFY(img.imageRef() == source);
QVERIFY(img.toImage() == source);
QCOMPARE(img.hasAlphaChannel(), true);
QCOMPARE(img.hasAlphaChannel(), img.imageRef().hasAlphaChannel());
QCOMPARE(img.hasAlphaChannel(), img.toImage().hasAlphaChannel());
QCOMPARE(img.depth(), 32);
#ifdef Q_OS_SYMBIAN
CFbsBitmap *bmp = new CFbsBitmap;
QVERIFY(bmp->Create(TSize(100, 50), EColor16MAP) == KErrNone);
QVolatileImage bmpimg(bmp);
QVERIFY(!bmpimg.isNull());
QCOMPARE(bmpimg.width(), 100);
QCOMPARE(bmpimg.height(), 50);
// Verify that we only did handle duplication, not pixel data copying.
QCOMPARE(bmpimg.constBits(), (const uchar *) bmp->DataAddress());
delete bmp;
// Check if content is still valid.
QImage copyimg = bmpimg.toImage();
QCOMPARE(copyimg.format(), QImage::Format_ARGB32_Premultiplied);
#endif
}