コード例 #1
0
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
0
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
0
ファイル: TNNApp1.cpp プロジェクト: cdaffara/symbiandump-mw1
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
0
	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
0
ファイル: qwindowsurface_s60.cpp プロジェクト: Blizzard/qt4
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
0
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
0
	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
0
ファイル: TSCRDEV.CPP プロジェクト: kuailexs/symbiandump-os1
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
0
// ---------------------------------------------------------------------------
//  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
0
ファイル: celarray.cpp プロジェクト: Meridian59/Meridian59
//
/// 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
0
ファイル: Custom.cpp プロジェクト: huellif/symbian-example
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
0
ファイル: imagelst.cpp プロジェクト: Meridian59/Meridian59
//
/// 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
0
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
0
/*
-----------------------------------------------------------------------------
----------------------------------------------------------------------------
*/
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
0
ファイル: tst_qvolatileimage.cpp プロジェクト: maxxant/qt
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
}
コード例 #16
0
ファイル: decoder.cpp プロジェクト: kuailexs/symbiandump-os1
CVideoDecoderInfo* CMMFTestVideoDecodeHwDevice::VideoDecoderInfoLC()
	{
	// construct array of test types
	for (TUint i = 0; i < KTestDecoderInfoCount; i++)
		{
		// construct the video types for iVidTypes
		CCompressedVideoFormat* vid = NULL;
		TPtrC8 mimeType = KTestDecoderInfoMimeArray[i];
		vid = GetTestCVFormatL(mimeType);
		CleanupStack::PushL(vid);
		User::LeaveIfError(iVidFormats.Append(vid));
		CleanupStack::Pop(vid);	// CCompressedVideo object is destroyed in destructor

		// append the max picture rates
		TPictureRateAndSize rate;
		GetTestEncoderInfoRate(i, rate);
		User::LeaveIfError(iPictureRates.Append(rate));
		}
	
	// construct the video decoder info object
	CVideoDecoderInfo* vInfo = CVideoDecoderInfo::NewL(
		KUidDevVideoTestDecodeHwDevice,
		KTestDecoderInfoManufacturer,
		KTestDecoderInfoIdentifier,
		TVersion(KTestDecoderInfoVersionMaj, KTestDecoderInfoVersionMin, KTestDecoderInfoVersionBuild),
		iVidFormats.Array(),
		ETrue,	// accelerated
		ETrue,	// supports direct display
		TSize(KTestDecoderInfoMaxSizeX,KTestDecoderInfoMaxSizeY),
		KMaxTUint, //aMaxBitrate
		iPictureRates.Array(),
		ETrue,	// aSupportsPictureLoss
		EFalse, // aSupportsSliceLoss
		KTestDecoderInfoCSInfo,
		KTestDecoderInfoISInfo );
	CleanupStack::PushL(vInfo);
#ifdef SYMBIAN_ENABLE_MMF_MULTISCREEN_SUPPORT
	vInfo->AddSupportedScreenL(KDecoderDefaultScreenNumber);
	vInfo->AddSupportedScreenL(KDecoderSecondaryScreenNumber);
#endif
	vInfo->SetSupportsContentProtected(ETrue);
	return vInfo;
	}
コード例 #17
0
ファイル: EIKSBFRM.CPP プロジェクト: cdaffara/symbiandump-mw1
EXPORT_C TEikScrollBarFrameLayout::TEikScrollBarFrameLayout()
	//
	// default constructor
	//
	{
    iInclusiveMargin.iTop = 0;
    iInclusiveMargin.iBottom = 0;
    iInclusiveMargin.iLeft = 0;
    iInclusiveMargin.iRight = 0;
    
    iClientMargin.iTop = 0;
    iClientMargin.iBottom = 0;
    iClientMargin.iLeft = 0;
    iClientMargin.iRight = 0;
    
    iClientAreaGranularity = TSize(0,0);
    
    iTilingMode = EClientRectConstant;
	}
コード例 #18
0
void CTDirectScreenBitmap::TestRefreshingTimeL()
	{
	// As other display modes have been tested in other test cases
	// Only EColor16MAP is tested here
	CFbsDrawDevice *pDev = NULL;	
	TDisplayMode aDisplayMode = EColor16MAP;
	iDispMode = aDisplayMode;
			
	TRAPD(err,pDev = CFbsDrawDevice::NewScreenDeviceL(0, aDisplayMode));
	if (err)
		{
		INFO_PRINTF2(_L("Note: Failed to create screen device for display mode %i - not supported on this config?"),iDispMode);
		}
	else
		{
		INFO_PRINTF2(_L("Testing Continuous Refreshing for display mode %i"),iDispMode);
		CleanupDeletePushL(pDev);
		User::LeaveIfError(pDev->InitScreen());
		TSize screenSize = pDev->SizeInPixels();
		TRect directRect;

		// Quarter screen ENone
		INFO_PRINTF1(_L("Consecutively update frames at left bottom corner and setting ENone"));
		directRect = TRect(TPoint(0, screenSize.iHeight/2), TSize(screenSize.iWidth/2, screenSize.iHeight/2));
		TRAPD(err,ConstructL(directRect, CDirectScreenBitmap::ENone));
		if (err)
			{
			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
			}
		else
			{
			// use the same iDirectScreenBitmap as CTDirectScreenBitmap 
		    User::LeaveIfError(HAL::Get(HALData::EFastCounterFrequency, iFreq));

			MeasureFrame(directRect);
			
			INFO_PRINTF2(_L("The total time to render 200 frames is %f"),iMeasure);

			}
		CleanupStack::PopAndDestroy(pDev);

		}
	}
コード例 #19
0
// protected second-phase contsructor
void CSurface::ConstructL(RWsSession& arWs, TInt aW, TInt aH, TInt aBpp)
{
   // allocate, allocate and more allocate
   // first, the main bitmap; depending on the color depth specified
   TDisplayMode dispMode;
   switch(aBpp)
   {
      case 1:      // 1-bit monochrome bitmap (EGray2)
         dispMode = EGray2;
         break;
      case 4:
         dispMode = EColor16;
         break;
      case 8:
         dispMode = EColor256;
         break;
      case 12:
         dispMode = EColor4K;
         break;
      case 16:
         dispMode = EColor64K;
         break;
      case 24:
         dispMode = EColor16M;
         break;
      default:
         // Don't crash.
         dispMode = EColor4K;
         break;
   }
   
   // create the surface bitmap
   iBitmap = new(ELeave) CWsBitmap( arWs );
   //iBitmap = new(ELeave) CFbsBitmap( );
   //CleanupStack::PushL(iBitmap);
   
   User::LeaveIfError(iBitmap->Create(TSize(aW,aH), dispMode));
   // create the bitmap device
   iDevice = CFbsBitmapDevice::NewL(iBitmap);
   // create the graphics context for the device
   User::LeaveIfError(iDevice->CreateContext(iGc));   
}
コード例 #20
0
ファイル: tst_qvolatileimage.cpp プロジェクト: maxxant/qt
void tst_QVolatileImage::ensureFormat()
{
    QImage source(12, 23, QImage::Format_ARGB32_Premultiplied);
    QVolatileImage img(source);
    QVERIFY(!img.isNull());
    QVERIFY(img.imageRef() == source);
    QVERIFY(img.toImage() == source);

    QVERIFY(img.ensureFormat(QImage::Format_ARGB32_Premultiplied)); // no-op
    QVERIFY(img.imageRef() == source);
    QVERIFY(img.toImage() == source);
    QVERIFY(img.format() == QImage::Format_ARGB32_Premultiplied);

    QVERIFY(img.ensureFormat(QImage::Format_RGB32)); // new data under-the-hood
    QVERIFY(img.imageRef() != source);
    QVERIFY(img.toImage() != source);
    QVERIFY(img.format() == QImage::Format_RGB32);

#ifdef Q_OS_SYMBIAN
    CFbsBitmap *bmp = new CFbsBitmap;
    QVERIFY(bmp->Create(TSize(100, 50), EColor16MAP) == KErrNone);
    QVolatileImage bmpimg(bmp);
    QVERIFY(bmpimg.ensureFormat(QImage::Format_ARGB32_Premultiplied)); // no-op
    QCOMPARE(bmpimg.constBits(), (const uchar *) bmp->DataAddress());

    // A different format should cause data copying.
    QVERIFY(bmpimg.ensureFormat(QImage::Format_RGB32));
    QVERIFY(bmpimg.constBits() != (const uchar *) bmp->DataAddress());
    const uchar *prevBits = bmpimg.constBits();

    QVERIFY(bmpimg.ensureFormat(QImage::Format_RGB16));
    QVERIFY(bmpimg.constBits() != (const uchar *) bmp->DataAddress());
    QVERIFY(bmpimg.constBits() != prevBits);
    prevBits = bmpimg.constBits();

    QVERIFY(bmpimg.ensureFormat(QImage::Format_MonoLSB));
    QVERIFY(bmpimg.constBits() != (const uchar *) bmp->DataAddress());
    QVERIFY(bmpimg.constBits() != prevBits);

    delete bmp;
#endif
}
コード例 #21
0
ファイル: TOOM.CPP プロジェクト: kuailexs/symbiandump-os1
void COomPolygon::ConstructL()
	{
	COomSetup::ConstructL();
	iScrDev=new(ELeave) CWsScreenDevice(iWs);
	User::LeaveIfError(iScrDev->Construct(iTest->ScreenNumber()));
	User::LeaveIfError(iScrDev->CreateContext(iGc));
	iWin=RBackedUpWindow(iWs);
	User::LeaveIfError(iWin.Construct(iWinGroup,EGray16,33));
	User::LeaveIfError(iWin.SetSizeErr(TSize(40,40)));
	iWin.Activate();
	TInt index;
	for(index=0;index<20;index+=2)
		iPnts.AppendL(TPoint(20+index,index));
	for(index=0;index<20;index+=2)
		iPnts.AppendL(TPoint(40-index,20+index));
	for(index=0;index<20;index+=2)
		iPnts.AppendL(TPoint(20-index,40-index));
	for(index=0;index<20;index+=2)
		iPnts.AppendL(TPoint(index,20-index));
	}
コード例 #22
0
ファイル: imagelst.cpp プロジェクト: Meridian59/Meridian59
//
/// Constructs a TImageList from a DIB, slicing the bitmap up into a horizontal array of
/// the given number of evenly sized images.
// !CQ add an optional mask color? or mask? or palette?
//
TImageList::TImageList(const TDib& dib, uint flags, int imageCount, int growBy)
{
  if (!TCommCtrl::IsAvailable())
    TXCommCtrl::Raise();

  if (!imageCount)
    imageCount = 1;

  ImageSize = TSize(dib.Width() / imageCount, dib.Height());
  Bitmap = 0;

  Handle = TCommCtrl::Dll()->ImageList_Create(ImageSize.cx, ImageSize.cy,
                                       flags, imageCount, growBy);

  TPalette pal((HPALETTE)::GetStockObject(DEFAULT_PALETTE));

  // Use masked support with 3dFace color as background color
  //
  Add(TBitmap(dib, &pal), TColor::Sys3dFace);
}
コード例 #23
0
ファイル: celarray.cpp プロジェクト: Meridian59/Meridian59
//
/// Constructs a TCelArray from a bitmap by slicing the bitmap into a horizontal
/// array of cels of a specified size. If autoDelete is true, TCelArray can
/// automatically delete the bitmap. The ShouldDelete data member defaults to true,
/// ensuring that the handle will be deleted when the bitmap is destroyed. If
/// numRows is 0, the number of rows is calculated using the bitmap height and the
/// celSize y parameter.
//
TCelArray::TCelArray(TBitmap* bmp, int numCels, TSize celSize,
                     TPoint offset, int numRows, TAutoDelete autoDelete)
{
  PRECONDITION(bmp);

  NGrowBy = 1;
  NCels = NCelsUsed = std::max(1, numCels);
  NRows  = std::max(1, numRows);
  CSize = celSize.cx && celSize.cy ?
            celSize :
            TSize(bmp->Width() / NCels, bmp->Height() / NRows);
  Offs = offset;
  NCurRow = 0;
  ShouldDelete = ToBool(autoDelete == AutoDelete);

  Bitmap = bmp;

  TRACEX(OwlGadget, OWL_CDLEVEL, "TCelArray constructed @" << (void*)this <<
    " from slicing the bitmap @" << (void*)bmp);
}
コード例 #24
0
ファイル: WinInterface.cpp プロジェクト: mpmartin8080/winscp
//---------------------------------------------------------------------------
inline void TMessageParams::Reset()
{
  Params = 0;
  Aliases = NULL;
  AliasesCount = 0;
  Timer = 0;
  TimerEvent = NULL;
  TimerMessage = L"";
  TimerAnswers = 0;
  TimerQueryType = static_cast<TQueryType>(-1);
  Timeout = 0;
  TimeoutAnswer = 0;
  NeverAskAgainTitle = L"";
  NeverAskAgainAnswer = 0;
  NeverAskAgainCheckedInitially = false;
  AllowHelp = true;
  ImageName = L"";
  MoreMessagesUrl = L"";
  MoreMessagesSize = TSize();
}
コード例 #25
0
ファイル: Ordinal.cpp プロジェクト: huellif/symbian-example
void CExampleWsClient::ConstructMainWindowL()
    {
    // Resources allocated in this function are freed in the CExampleWsClient destructor

    iMainWindow = new (ELeave) CMainWindow(this);
    iMainWindow->ConstructL(iRect, TRgb(255, 255, 255));
    TInt count = 0;
    TRect rect(TPoint(100, 0), TSize(100, 100));
    iWindow1 = new (ELeave) CNumberedWindow(this, count++);
    iWindow1->ConstructL(rect, TRgb(50, 50, 50), iMainWindow);
    iWindow2 = new (ELeave) CNumberedWindow(this, count++);
    iWindow2->ConstructL(rect, TRgb(100, 100, 100), iMainWindow);
    iWindow3 = new (ELeave) CNumberedWindow(this, count++);
    iWindow3->ConstructL(rect, TRgb(150, 150, 150), iMainWindow);
    iWindow4 = new (ELeave) CNumberedWindow(this, count++);
    rect.Shrink(10, 10);
    iWindow4->ConstructL(rect, TRgb(200, 200, 200), iWindow1);
    iWindow5 = new (ELeave) CNumberedWindow(this, count++);
    iWindow5->ConstructL(rect, TRgb(150, 150, 150), iWindow1);
    }
コード例 #26
0
TInt CCTSYIntegrationTestSuiteStepBase::DoPauseL(const TDesC& aText, TTimeDuration aTimeout /* = ETimeMedium */)
/**
 Performs a pause, usually to allow user to intervene in Manual tests
 
 @param		aText - text for prompt
 @param		aTimeout - 
 @return	KErrNone if user pressed a key
 */
	{
	TInt ret = KErrNone;
		
	CConsoleBase* con = NULL;
	TRAPD(err, con = Console::NewL(_L("Interactive Test"), TSize(KConsFullScreen, KConsFullScreen)));

	INFO_PRINTF2(_L("Console status = %d"), err);
	TEST(err == KErrNone);
	CleanupStack::PushL(con);
	
	TConsoleReadRequestStatus readRequest(*con);
	//add to cleanup stack
	CleanupStack::PushL(readRequest);
	con->Printf(_L("%S (timeout %d secs) ..."), &aText, aTimeout / KOneSecond);
	con->Read(readRequest);
	
	ret = WaitForRequestWithTimeOut(readRequest, aTimeout);	
		
	if (ret == KErrTimedOut)
		{
		WARN_PRINTF1(_L("[doPause] No keypress detected, timeout! Manual action may not have occurred."));
		}

	if (readRequest.Int() == KRequestPending)	
		{
		readRequest.Cancel();
		}
	
	CleanupStack::PopAndDestroy(); // readRequest
	CleanupStack::PopAndDestroy(); // con
	
	return ret;
	}
コード例 #27
0
ファイル: TFTP.CPP プロジェクト: cdaffara/symbiandump-os2
//
// Set up Epoc environment. Put in separate function so we can
// let heap allocations fail and leave, trapping them all in 
// one place above.
//
LOCAL_C void ProgramL()
	{
	CActiveScheduler* pS = new(ELeave) CActiveScheduler;
	CleanupStack::PushL(pS);

	//initialization for COMM port (TFTP server on comm2)
	InitCommsL();
	
    CActiveScheduler::Install(pS);
	//create console for output
	CConsoleBase* console = Console::NewL(_L("TFTP"),TSize(KConsFullScreen,KConsFullScreen));
	CleanupStack::PushL(console);
	CCommandParser* compars= CCommandParser::NewL(*console);
	compars->Call();
	   
	CActiveScheduler::Start();

	delete compars;
	CleanupStack::PopAndDestroy(console);
	CleanupStack::PopAndDestroy(pS);
	}
コード例 #28
0
LOCAL_C void ActiveTestL()
    {
	CConsoleBase* console = Console::NewL(_L("ACTIVETEST"), TSize(KConsFullScreen, KConsFullScreen));
	CleanupStack::PushL(console);

	CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
	CleanupStack::PushL(scheduler);
	CActiveScheduler::Install(scheduler);

	CActiveConsole* activeConsole = CActiveConsole::NewLC(*console);
	activeConsole->RequestCharacter();
	CActiveScheduler::Start();
	// NB CActiveScheduler::Start only returns when someone somewhere has 
	// called CActiveScheduler::Stop.

	CleanupStack::PopAndDestroy(2); // activeConsole, scheduler

	console->Printf(_L("\nPress any key"));
	console->Getch(); // get and ignore character
	CleanupStack::PopAndDestroy(); // console
	}
コード例 #29
0
void CMainWindow::HandlePointerMoveBufferReady()
	{
	TPoint pnts[KPointerMoveBufferSize];
	TPtr8 ptr((TUint8 *) &pnts, sizeof(pnts));
	TInt numPnts = Window().RetrievePointerMoveBuffer(ptr);
	TRect redrawRect(Window().Position(), Window().Size());

	CWindowGc* gc = SystemGc();
	gc->Activate(Window());
	gc->SetPenColor(KRgbBlue);
	gc->SetPenSize(TSize(2, 2));
	Window().Invalidate();
	Window().BeginRedraw(redrawRect); // N.B. Redrawer::RunL() gets called with this 
	// rectangle - must give it a non-zero value
	for (TInt index = 0; index < numPnts; index++)
		{
		gc->DrawLineTo(pnts[index]);
		}
	Window().EndRedraw();
	gc->Deactivate();
	}
コード例 #30
0
QS60WindowSurface::QS60WindowSurface(QWidget* widget)
    : QWindowSurface(widget), d_ptr(new QS60WindowSurfacePrivate)
{

    TDisplayMode mode = S60->screenDevice()->DisplayMode();
    bool isOpaque = qt_widget_private(widget)->isOpaque;
    if (mode == EColor16MA && isOpaque)
        mode = EColor16MU; // Faster since 16MU -> 16MA is typically accelerated
    else if (mode == EColor16MU && !isOpaque)
        mode = EColor16MA; // Try for transparency anyway

    // We create empty CFbsBitmap here -> it will be resized in setGeometry
	CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap);	// CBase derived object needs check on new
    qt_symbian_throwIfError( bitmap->Create( TSize(0, 0), mode ) );
	
    QS60PixmapData *data = new QS60PixmapData(QPixmapData::PixmapType);
    data->fromSymbianBitmap(bitmap);
    d_ptr->device = QPixmap(data);
        
    setStaticContentsSupport(true);
}