imagedecoder.h

来自「Evc下的图片解码类」· C头文件 代码 · 共 58 行

H
58
字号
/*
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 + =
减小字号Ctrl + -
显示快捷键?