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

📄 imagedecoder.h

📁 Evc下的图片解码类
💻 H
字号:
/*
ImageDecoder.h
  Declare ImageDecoder class
  v 1.0
*/
#ifndef _IMAGEDECODER_H_
#define _IMAGEDECODER_H_

#define INITGUID
#include <windows.h>
#include <imaging.h>
#include <GdiPlusEnums.h>

enum CodecType {eDecoder, eEncoder};
enum StateType {UnInit, Init, Decoded, Finish};
class ImageDecoder
{
public:
	ImageDecoder(TCHAR* ImageFileName);
    ImageDecoder(HRSRC hRes);
	~ImageDecoder();
	StateType State();
	//TCHAR* FileName();
	int Width();
	int Height();
    UINT FrameCount();
	void Decode(); //decode the image
	void Draw(HDC hdc, RECT& dstRect); //draw current frame
	void Rotate(int Angle);
	void Flip();
	void Resize();
	void AdjustBrightness();
	void AdjustContrast();
	void AdjustGamma();
    void SelectNextFrame();
private:
	StateType state;
	TCHAR filename[MAX_PATH]; //Image source file name
    ImageInfo ii;
	int Angle; //Image Rotate Angle
    UINT nFrameCount;//Image frame count, time based
    UINT nSelectedFrame;//Active frame index;
	IImage *pImage;
	IImagingFactory *pImagingFactory;
	IImageSink *pImageSink;
	IImageDecoder *pImageDecoder;
	IBitmapImage *pBitmapImage;
	IBitmapImage *pBitmapImageRotate;
	IImage *pImageRotate;
	IStream *pStream;
	IBasicBitmapOps *pBasicBitmapOps;
	HRESULT CreateStreamOnFile(const TCHAR * tszFilename, IStream ** ppStream);
    HRESULT CreateStreamOnResource(HRSRC hRes, IStream ** ppStream);
	BOOL GetCodecCLSID(IImagingFactory* pImagingFactory, CLSID * pclsid, WCHAR * wszMimeType, CodecType ctCodec);
	void GetDestRect(int srcWidth, int srcHeight, int dstWidth, int dstHeight, RECT &pos);
};

#endif

⌨️ 快捷键说明

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