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

📄 imageconversion.h

📁 截屏软件
💻 H
字号:
/*
 * ImageConversion.h
 *
 * Copyright 2005 - 2007, Antony Pranata
 * http://www.antonypranata.com
 *
 * Project: Screenshot for Symbian OS.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#ifndef __IMAGECONVERSION_H__
#define __IMAGECONVERSION_H__

#include <MdaImageConverter.h>

_LIT8(KMimeTypeJpg,		"image/jpeg");
_LIT8(KMimeTypePng,		"image/x-png");
_LIT8(KMimeTypeBmp,		"image/bmp");
_LIT8(KMimeTypeMbm,		"image/x-epoc-mbm");
_LIT8(KMimeTypeUnknown,	"");

//
// CFrameImageData
//
class CFrameImageData: public CBase
	{
public:
	CFrameImageData()
	{ }

public:
	TInt iQualityFactor; // 0 - 100 (inclusive)
	TInt iBitsPerPixel;  // 8 or 24
	};

//
// CImageDecoder
// 
class CImageDecoder: public CBase, public MMdaImageUtilObserver
	{
	enum TDecodeStatus
		{
		EIdle,
		EFileOpening,
		EBitmapConverting,
		EBitmapMaskConverting
		};

public:
	static CImageDecoder* FileNewL(RFs& aFs, const TDesC& aFileName);
	~CImageDecoder();

	/**
	 * Opens an image only (no converting).  This is used to get the frame
	 * info.
	 */
	void OpenOnly(TInt aFrameNumber = 0);

	/**
	 * Opens an image and stores the bitmap in aDestination.
	 */
	void Convert(TRequestStatus* aRequestStatus, CFbsBitmap& aDestination,
		TInt aFrameNumber = 0);

	/**
	 * Opens an image and stores the bitmap in aDestination and the bitmap
	 * mask in aDestinationMask.
	 */
	void Convert(TRequestStatus* aRequestStatus, CFbsBitmap& aDestination,
		CFbsBitmap& aDestinationMask, TInt aFrameNumber = 0);

	/**
	 * Cancels the conversion.
	 */
	void Cancel();

	TFrameInfo FrameInfo(TInt aFrameNumber = 0) const;

private: // from MMdaImageUtilObserver
	void MiuoCreateComplete(TInt aError);
	void MiuoOpenComplete(TInt aError);
	void MiuoConvertComplete(TInt aError);

private:
	CImageDecoder();
	void ConstructL(const TDesC& aFileName);

private:
	CMdaImageFileToBitmapUtility*	iUtility;
	HBufC*							iFileName;
	TRequestStatus*					iRequestStatus;
	CFbsBitmap*						iDestBitmap;
	CFbsBitmap*						iDestMaskBitmap;
	CActiveSchedulerWait*			iActiveScheduler;
	TInt							iFrameNumber;
	TDecodeStatus					iDecodeStatus;
	};

//
// CImageEncoder
// 
class CImageEncoder: public CBase, public MMdaImageUtilObserver
	{
public:
	static CImageEncoder* FileNewL(RFs& aFs, const TDesC& aFileName,
		const TDesC8& aMimeType);
	~CImageEncoder();

	void Convert(TRequestStatus* aRequestStatus, CFbsBitmap& aDestination,
		CFrameImageData* aFrameImageData = 0);

	/**
	 * Cancels the conversion.
	 */
	void Cancel();

	TFrameInfo FrameInfo(TInt aFrameNumber = 0) const;

private: // from MMdaImageUtilObserver
	void MiuoCreateComplete(TInt aError);
	void MiuoOpenComplete(TInt aError);
	void MiuoConvertComplete(TInt aError);

private:
	CImageEncoder();
	void ConstructL(const TDesC& aFileName, const TDesC8& aMimeType);

private:
	CMdaImageBitmapToFileUtility*	iUtility;
	HBufC*							iFileName;
	HBufC8*							iMimeType;
	TRequestStatus*					iRequestStatus;
	CFbsBitmap*						iDestBitmap;
	TInt							iFrameNumber;
	TMdaJfifClipFormat				iJpgClipFormat;
	TMdaBmpClipFormat				iBmpClipFormat;
	TMdaMbmClipFormat				iMbmClipFormat;
	TMdaJpgQTable					iJpgCodec;
	TMda8BppBmpCodec				iBmp8bppCodec;
	TMda24BppBmpCodec				iBmpCodec;
	};

#endif // __IMAGECONVERSION_H__

⌨️ 快捷键说明

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