📄 imagetestappview.cpp
字号:
/*
============================================================================
Name : ImageTestAppView.cpp
Author :
Copyright : Your copyright notice
Description : Application view implementation
============================================================================
*/
// INCLUDE FILES
#include <coemain.h>
#include "ImageTestAppView.h"
#include <ImageConversion.h>
#include <GDI.h>
// ============================ MEMBER FUNCTIONS ===============================
// -----------------------------------------------------------------------------
// CImageTestAppView::NewL()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CImageTestAppView* CImageTestAppView::NewL(const TRect& aRect)
{
CImageTestAppView* self = CImageTestAppView::NewLC(aRect);
CleanupStack::Pop(self);
return self;
}
// -----------------------------------------------------------------------------
// CImageTestAppView::NewLC()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CImageTestAppView* CImageTestAppView::NewLC(const TRect& aRect)
{
CImageTestAppView* self = new ( ELeave ) CImageTestAppView;
CleanupStack::PushL(self);
self->ConstructL(aRect);
return self;
}
// -----------------------------------------------------------------------------
// CImageTestAppView::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CImageTestAppView::ConstructL(const TRect& aRect)
{
// Create a window for this application view
CreateWindowL();
// Set the windows size
SetRect(aRect);
pTimerControl = Cjishiqi::NewL(EPriorityNormal, *this);
User::LeaveIfError(iFillsession.Connect());
imap = new (ELeave)CFbsBitmap;
imask = new (ELeave)CFbsBitmap;
pTimerControl->Start((TTimeIntervalMicroSeconds32)10);
// Activate the window, which makes it ready to be drawn
ActivateL();
}
// -----------------------------------------------------------------------------
// CImageTestAppView::CImageTestAppView()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
CImageTestAppView::CImageTestAppView()
{
// No implementation required
istatus = 3;
}
// -----------------------------------------------------------------------------
// CImageTestAppView::~CImageTestAppView()
// Destructor.
// -----------------------------------------------------------------------------
//
CImageTestAppView::~CImageTestAppView()
{
// No implementation required
if(imap)
{
delete imap;
}
if(imask)
{
delete imask;
}
if(imageDecoder)
{
delete imageDecoder;
}
if(pTimerControl)
{
pTimerControl->Cancel();
delete pTimerControl;
}
iFillsession.Close();
}
// -----------------------------------------------------------------------------
// CImageTestAppView::Draw()
// Draws the display.
// -----------------------------------------------------------------------------
//
void CImageTestAppView::Draw(const TRect& /*aRect*/) const
{
// Get the standard graphics context
CWindowGc& gc = SystemGc();
// Gets the control's extent
TRect drawRect(Rect());
// Clears the screen
gc.Clear(drawRect);
if(istatus == 0)
{
gc.BitBltMasked(TPoint(0, 0), imap, drawRect, imask, EFalse);
}
else
{
//gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
//gc.SetBrushColor(KRgbBlue);
//gc.SetPenStyle(CGraphicsContext::ESolidPen);
//gc.SetPenColor(KRgbRed);
//TRect rect(30,30,180,220);
//gc.DrawRect(rect);
// pTimerControl->Start((TTimeIntervalMicroSeconds32)3000000);
}
}
// -----------------------------------------------------------------------------
// CImageTestAppView::SizeChanged()
// Called by framework when the view size is changed.
// -----------------------------------------------------------------------------
//
void CImageTestAppView::SizeChanged()
{
}
// End of File
void CImageTestAppView::LoadImageL()
{
}
void CImageTestAppView::TimerExpired()
{
// 构建文件名//c\resource\apps\test
_LIT(KResourcePath, "c:\\Data\\Images\\1.png");
TFileName fileName(KResourcePath);
// _LIT8(KIMAGETYPE, "image/jpg");
imageDecoder = CImageDecoder::FileNewL(iFillsession, fileName, CImageDecoder::EOptionAlwaysThread);
TSize imageSize = imageDecoder->FrameInfo().iOverallSizeInPixels;
// TSize test = imageDecoder->FrameInfo().iFrameSizeInPixels;
TDisplayMode displayMode = imageDecoder->FrameInfo().iFrameDisplayMode;
imap->Create(imageSize, displayMode);
imask->Create(imageSize, EGray256);
TRequestStatus iStatus = KRequestPending;
imageDecoder ->Convert(&iStatus, *imap, *imask);
User::WaitForRequest (iStatus);
istatus = 0;
}
void CImageTestAppView::TimerExpired1()
{
istatus = 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -