📄 imaging.h
字号:
#define IMGFLAG_HASREALPIXELSIZE ImageFlagsHasRealPixelSize
#define IMGFLAG_READONLY ImageFlagsReadOnly
#define IMGFLAG_CACHING ImageFlagsCaching
#define IMGFLAGS_VALID ImageFlagsValid
#define ImageFlag ImageFlags
//
// Decoder flags
//
/* Only used in COM interface */
enum DecoderInitFlag
{
DecoderInitFlagNone = 0,
// NOBLOCK indicates that the caller requires non-blocking
// behavior. This will be honored only by non-blocking decoders, that
// is, decoders that don't have the IMGCODEC_BLOCKING_DECODE flag.
DecoderInitFlagNoBlock = 0x0001,
// Choose built-in decoders first before looking at any
// installed plugin decoders.
DecoderInitFlagBuiltIn1st = 0x0002
};
#define DECODERINIT_NONE DecoderInitFlagNone
#define DECODERINIT_NOBLOCK DecoderInitFlagNoBlock
#define DECODERINIT_BUILTIN1ST DecoderInitFlagBuiltIn1st
/* Only used in COM interface */
enum BufferDisposalFlag
{
BufferDisposalFlagNone,
BufferDisposalFlagGlobalFree,
BufferDisposalFlagCoTaskMemFree,
BufferDisposalFlagUnmapView
};
#define DISPOSAL_NONE BufferDisposalFlagNone
#define DISPOSAL_GLOBALFREE BufferDisposalFlagGlobalFree
#define DISPOSAL_COTASKMEMFREE BufferDisposalFlagCoTaskMemFree
#define DISPOSAL_UNMAPVIEW BufferDisposalFlagUnmapView
//---------------------------------------------------------------------------
// Intepolation hints used by resize/rotation operations
//---------------------------------------------------------------------------
enum InterpolationHint
{
InterpolationHintDefault,
InterpolationHintNearestNeighbor,
InterpolationHintBilinear,
InterpolationHintAveraging,
InterpolationHintBicubic
};
#define INTERP_DEFAULT InterpolationHintDefault
#define INTERP_NEAREST_NEIGHBOR InterpolationHintNearestNeighbor
#define INTERP_BILINEAR InterpolationHintBilinear
#define INTERP_AVERAGING InterpolationHintAveraging
#define INTERP_BICUBIC InterpolationHintBicubic
#define IMGCODEC_ENCODER ImageCodecFlagsEncoder
#define IMGCODEC_DECODER ImageCodecFlagsDecoder
#define IMGCODEC_SUPPORT_BITMAP ImageCodecFlagsSupportBitmap
#define IMGCODEC_SUPPORT_VECTOR ImageCodecFlagsSupportVector
#define IMGCODEC_SEEKABLE_ENCODE ImageCodecFlagsSeekableEncode
#define IMGCODEC_BLOCKING_DECODE ImageCodecFlagsBlockingDecode
#define IMGCODEC_BUILTIN ImageCodecFlagsBuiltin
#define IMGCODEC_SYSTEM ImageCodecFlagsSystem
#define IMGCODEC_USER ImageCodecFlagsUser
//
// Identifier for channel(s) in a pixel
//
/* Only used internally */
enum ChannelID
{
ChannelID_Alpha = 0x00000001,
ChannelID_Red = 0x00000002,
ChannelID_Green = 0x00000004,
ChannelID_Blue = 0x00000008,
ChannelID_Color = ChannelID_Red|ChannelID_Green|ChannelID_Blue,
ChannelID_All = ChannelID_Color|ChannelID_Alpha,
ChannelID_Intensity = 0x00010000
};
//
// Data structure for communicating to an image sink
//
/* Only used internally */
enum SinkFlags
{
// Low-word: shared with ImgFlagx
SinkFlagsScalable = ImageFlagsScalable,
SinkFlagsHasAlpha = ImageFlagsHasAlpha,
SinkFlagsPartiallyScalable = ImageFlagsPartiallyScalable,
// High-word
SinkFlagsTopDown = 0x00010000,
SinkFlagsBottomUp = 0x00020000,
SinkFlagsFullWidth = 0x00040000,
SinkFlagsMultipass = 0x00080000,
SinkFlagsComposite = 0x00100000,
SinkFlagsWantProps = 0x00200000
};
#define SINKFLAG_SCALABLE SinkFlagsScalable
#define SINKFLAG_HASALPHA SinkFlagsHasAlpha
#define SINKFLAG_PARTIALLY_SCALABLE SinkFlagsPartiallyScalable
#define SINKFLAG_TOPDOWN SinkFlagsTopDown
#define SINKFLAG_BOTTOMUP SinkFlagsBottomUp
#define SINKFLAG_FULLWIDTH SinkFlagsFullWidth
#define SINKFLAG_MULTIPASS SinkFlagsMultipass
#define SINKFLAG_COMPOSITE SinkFlagsComposite
#define SINKFLAG_WANTPROPS SinkFlagsWantProps
/* Only used internally */
struct ImageInfo
{
GUID RawDataFormat;
PixelFormat PixelFormat;
UINT Width, Height;
UINT TileWidth, TileHeight;
double Xdpi, Ydpi;
UINT Flags;
};
//
// Interface and class identifiers
//
interface IImagingFactory;
interface IImage;
interface IBitmapImage;
interface IImageDecoder;
interface IImageEncoder;
interface IImageSink;
interface IBasicBitmapOps;
//--------------------------------------------------------------------------
// Imaging utility factory object
// This is a CoCreate-able object.
//--------------------------------------------------------------------------
#ifdef _WIN32_WCE
interface DECLSPEC_UUID("327ABDA7-072B-11D3-9D7B-0000F81EF32E")
#else
MIDL_INTERFACE("327ABDA7-072B-11D3-9D7B-0000F81EF32E")
#endif // _WIN32_WCE
IImagingFactory : public IUnknown
{
public:
// Create an image object from an input stream
// stream doesn't have to seekable
// caller should Release the stream if call is successful
STDMETHOD(CreateImageFromStream)(
IN IStream* stream,
OUT IImage** image
) = 0;
// Create an image object from a file
STDMETHOD(CreateImageFromFile)(
IN const WCHAR* filename,
OUT IImage** image
) = 0;
// Create an image object from a memory buffer
STDMETHOD(CreateImageFromBuffer)(
IN const VOID* buf,
IN UINT size,
IN BufferDisposalFlag disposalFlag,
OUT IImage** image
) = 0;
// Create a new bitmap image object
STDMETHOD(CreateNewBitmap)(
IN UINT width,
IN UINT height,
IN PixelFormatID pixelFormat,
OUT IBitmapImage** bitmap
) = 0;
// Create a bitmap image from an IImage object
STDMETHOD(CreateBitmapFromImage)(
IN IImage* image,
IN OPTIONAL UINT width,
IN OPTIONAL UINT height,
IN OPTIONAL PixelFormatID pixelFormat,
IN InterpolationHint hints,
OUT IBitmapImage** bitmap
) = 0;
// Create a new bitmap image object on user-supplied memory buffer
STDMETHOD(CreateBitmapFromBuffer)(
IN BitmapData* bitmapData,
OUT IBitmapImage** bitmap
) = 0;
// Create an image decoder object to process the given input stream
STDMETHOD(CreateImageDecoder)(
IN IStream* stream,
IN DecoderInitFlag flags,
OUT IImageDecoder** decoder
) = 0;
// Create an image encoder object that can output data in the
// specified image file format.
STDMETHOD(CreateImageEncoderToStream)(
IN const CLSID* clsid,
IN IStream* stream,
OUT IImageEncoder** encoder
) = 0;
STDMETHOD(CreateImageEncoderToFile)(
IN const CLSID* clsid,
IN const WCHAR* filename,
OUT IImageEncoder** encoder
) = 0;
// Get a list of all currently installed image decoders
STDMETHOD(GetInstalledDecoders)(
OUT UINT* count,
OUT ImageCodecInfo** decoders
) = 0;
// Get a list of all currently installed image decoders
STDMETHOD(GetInstalledEncoders)(
OUT UINT* count,
OUT ImageCodecInfo** encoders
) = 0;
// Install an image encoder / decoder
// caller should do the regular COM component
// installation before calling this method
STDMETHOD(InstallImageCodec)(
IN const ImageCodecInfo* codecInfo
) = 0;
// Uninstall an image encoder / decoder
STDMETHOD(UninstallImageCodec)(
IN const WCHAR* codecName,
IN UINT flags
) = 0;
};
//--------------------------------------------------------------------------
// Image interface
// bitmap image
// vector image
// procedural image
//--------------------------------------------------------------------------
#ifdef _WIN32_WCE
interface DECLSPEC_UUID("327ABDA9-072B-11D3-9D7B-0000F81EF32E")
#else
MIDL_INTERFACE("327ABDA9-072B-11D3-9D7B-0000F81EF32E")
#endif // _WIN32_WCE
IImage : public IUnknown
{
public:
// Get the device-independent physical dimension of the image
// in unit of 0.01mm
STDMETHOD(GetPhysicalDimension)(
OUT SIZE* size
) = 0;
// Get basic image info
STDMETHOD(GetImageInfo)(
OUT ImageInfo* imageInfo
) = 0;
// Set image flags
STDMETHOD(SetImageFlags)(
IN UINT flags
) = 0;
// Display the image in a GDI device context
STDMETHOD(Draw)(
IN HDC hdc,
IN const RECT* dstRect,
IN OPTIONAL const RECT* srcRect
) = 0;
// Push image data into an IImageSink
STDMETHOD(PushIntoSink)(
IN IImageSink* sink
) = 0;
// Get a thumbnail representation for the image object
STDMETHOD(GetThumbnail)(
IN OPTIONAL UINT thumbWidth,
IN OPTIONAL UINT thumbHeight,
OUT IImage** thumbImage
) = 0;
};
//--------------------------------------------------------------------------
// Bitmap interface
//--------------------------------------------------------------------------
#ifdef _WIN32_WCE
interface DECLSPEC_UUID("327ABDAA-072B-11D3-9D7B-0000F81EF32E")
#else
MIDL_INTERFACE("327ABDAA-072B-11D3-9D7B-0000F81EF32E")
#endif // !_WIN32_WCE
IBitmapImage : public IUnknown
{
public:
// Get bitmap dimensions in pixels
STDMETHOD(GetSize)(
OUT SIZE* size
) = 0;
// Get bitmap pixel format
STDMETHOD(GetPixelFormatID)(
OUT PixelFormatID* pixelFormat
) = 0;
// Access bitmap data in the specified pixel format
// must support at least PIXFMT_DONTCARE and
// the caninocal formats.
STDMETHOD(LockBits)(
IN const RECT* rect,
IN UINT flags,
IN PixelFormatID pixelFormat,
IN OUT BitmapData* lockedBitmapData
) = 0;
STDMETHOD(UnlockBits)(
IN const BitmapData* lockedBitmapData
) = 0;
// Set/get palette associated with the bitmap image
STDMETHOD(GetPalette)(
OUT ColorPalette** palette
) = 0;
STDMETHOD(SetPalette)(
IN const ColorPalette* palette
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -