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

📄 cpictureloader.cpp

📁 JAVA3D游戏
💻 CPP
字号:
    /*
    *
============================================================================
    *  Name     : CPictureLoader.h
    *  Part of  : Example3D
    *  Created  : 12/14/2003 by Forum Nokia
    *  Description:
    *     This is the project specification file for Example3D.
    *     Initial content was generated by Series 60 AppWizard.
    *
    *  Version  : 1.0.0
    *  Copyright: Forum Nokia
    *
============================================================================
    */

// INCLUDES
#include "CPictureLoader.h"
#include <eikenv.h>
#include <eikappui.h>
#include <eikapp.h>

// MEMBER FUNCTIONS

CPictureLoader* CPictureLoader::NewL()
	{
	CPictureLoader* self = new( ELeave )CPictureLoader();
	CleanupStack::PushL( self );
	self->ConstructL();
	CleanupStack::Pop( self );
	return self;
	}


CPictureLoader::~CPictureLoader()
	{

	}


void CPictureLoader::ConstructL()
	{
	TFileName appFullName = CEikonEnv::Static()->EikAppUi()->Application()->AppFullName();
	TParse parse;

	//On WINS the application is on the z drive
#ifdef __WINS__
    parse.Set(_L("c:"), &appFullName, NULL);
#else
    parse.Set( appFullName, NULL, NULL);
#endif
    iPath = parse.DriveAndPath();
	}


CPictureLoader::CPictureLoader()
	{

	}


TBitmap CPictureLoader::LoadL( const TFileName& aFileName, TDisplayMode aDisplayMode )
	{
	TFileName file( iPath );
	file.Append( aFileName );

	CFbsBitmap bitmap;

	iStatus = KErrNone;
	CMdaImageFileToBitmapUtility* util;
	util = CMdaImageFileToBitmapUtility::NewL( *this ) ;
	
	CleanupStack::PushL( util );
	
	util->OpenL( file );
	CActiveScheduler::Start();
	User::LeaveIfError( iStatus );

	TFrameInfo frameInfo;
	util->FrameInfo( 0, frameInfo );
	
	User::LeaveIfError( bitmap.Create( frameInfo.iOverallSizeInPixels, aDisplayMode ) );
	
	util->ConvertL( bitmap );	
	CActiveScheduler::Start();
	User::LeaveIfError( iStatus );

	CleanupStack::PopAndDestroy( util );

	TBitmap bm;

	bm.iSize = bitmap.SizeInPixels();	

	TInt pixels = bm.iSize.iWidth * bm.iSize.iHeight;
	bm.iData = new( ELeave )TUint16[ pixels ];
	
	TInt y;
	for( y=0; y<bm.iSize.iHeight; y++ )
		{
		TPtr8 ydata( ((TUint8*)bm.iData) + y * bm.iSize.iWidth * 2, bm.iSize.iWidth * 2 );
		bitmap.GetScanLine( ydata, TPoint( 0, y ), bm.iSize.iWidth, aDisplayMode );
		}

	return bm;
	}


void CPictureLoader::MiuoConvertComplete( TInt aError )
	{
	iStatus = aError;
	CActiveScheduler::Stop();
	}


void CPictureLoader::MiuoCreateComplete( TInt /*aError*/ )
	{
	// manual create...
	}


void CPictureLoader::MiuoOpenComplete( TInt aError )
	{
	iStatus = aError;
	CActiveScheduler::Stop();
	}

⌨️ 快捷键说明

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