⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bitmapbitbltcontainer.cpp

📁 最新官方例子,图形,描述副,基本控件,通讯协议,等等,
💻 CPP
字号:
/**
 * 
 * @brief Definition of CBitmapBitBltContainer
 *
 * Copyright (c) EMCC Software Ltd 2003
 * @version 1.0
 */

// INCLUDES

//  Class include
#include "BitmapBitBltContainer.h"

// System includes
#include <fbs.h> //CFbsBitmap
#include <aknutils.h>

// User include
#include <Bitmap.mbg> // Bitmap enumeration

_LIT(KBitBltBitmapPath, "\\system\\apps\\Bitmap\\Bitmap.mbm");
const TInt KTopLeftX = 10;
const TInt KTopLeftY = 40;


// CONSTANTS

// ================= MEMBER FUNCTIONS =======================

/**
 * Symbian OS 2 phase constructor.
 * Constructs the CBitmapBitBltContainer using the NewLC method, popping
 * the constructed object from the CleanupStack before returning it.
 * 
 * @param aRect The rectangle for this window
 * @return The newly constructed CBitmapBitBltContainer
 */

CBitmapBitBltContainer* CBitmapBitBltContainer::NewL(const TRect& aRect)
	{
	CBitmapBitBltContainer* self = CBitmapBitBltContainer::NewLC(aRect);
	CleanupStack::Pop(self);
	return self;
	}

/**
 * Symbian OS 2 phase constructor.
 * Constructs the CBitmapBitBltContainer using the constructor and ConstructL 
 * method, leaving the constructed object on the CleanupStack before returning it.
 * 
 * @param aRect The rectangle for this window
 * @return The newly constructed CBitmapBitBltContainer
 */

CBitmapBitBltContainer* CBitmapBitBltContainer::NewLC(const TRect& aRect)
	{
	CBitmapBitBltContainer* self = new (ELeave) CBitmapBitBltContainer;
	CleanupStack::PushL(self);
	self->ConstructL(aRect);
	return self;
	}

/**
 * Symbian OS 2nd phase constructor.  Creates a Window for the control to draw to.
 * Creates bitmap to be displayed. Illustrates use of the CFbsBitmap::Load() function
 *
 * @param aRect The rectangle for this window
 */ 

void CBitmapBitBltContainer::ConstructL(const TRect& aRect)
	{
	CreateWindowL();	
	SetRect(aRect);
	iBitmap = new (ELeave) CFbsBitmap();
	TFileName bitmapFile (KBitBltBitmapPath);
	User::LeaveIfError (CompleteWithAppPath (bitmapFile));
	User::LeaveIfError(iBitmap->Load(bitmapFile, EMbmBitmapBitbltbitmap));
	ActivateL();
	}

/** 
 * Destructor. 
 */

CBitmapBitBltContainer::~CBitmapBitBltContainer()
	{
	delete iBitmap;
	}

/**
 * Called by the framework to draw this control.  Clears the area in specified
 * by aRect, creates a TPoint object for the top left of the image, draws bitmap using
 * Blitting.
 * @param aRect in which to draw
 */

void CBitmapBitBltContainer::Draw(const TRect& aRect) const
	{
	CWindowGc& gc = SystemGc(); // obtain graphics context
	gc.Clear(aRect); // clear the graphics context
	TPoint topLeft(KTopLeftX, KTopLeftY); // create TPoint object for top left of bitmap
	gc.BitBlt(topLeft, iBitmap); // Blit bitmap using graphics context
	}

// End of File

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -