Windows mobile绘图实现
2010-06-03 23:00:00 来源:WEB开发网用api只能画位图,那么如果是其他格式的图片就要进行解码。
IImagingFactory则实现了这一功能。
This interface is used to create bitmaps and images and to manage image encoders and decoders。
Methods
The following table shows the methods for this interface by functional grouping. Like all COM interfaces, this interface inherits the methods for the IUnknown interface.
可以读取图片文件,读取缓冲创建IImage对象。
IImage
This is the basic interface to an image object. It allows applications to do the following:
Display the image onto a destination graphics context
Push image data into an image sink
Access image properties and metadata
Decoded image objects and in-memory bitmap image objects support the IImage interface.
Methods
The following table shows the methods for this interface by functional grouping. Like all COM interfaces, this interface inherits the methods for the IUnknown interface.
其中
HRESULT GetImageInfo(
ImageInfo* imageInfo
)这个函数是绘图时经常用的函数,可以返回图像的基本信息。
结构体ImageInfo 的定义如下:
typedef struct tagImageInfo {
GUID RawDataFormat;
PixelFormatID PixelFormat;
UINT Width;
UINT Height;
UINT TileWidth;
UINT TileHeight;
double Xdpi;
double Ydpi;
UINT Flags;
} ImageInfo;
从成员中可以看出,可以返回图像宽度和高度,以及多少色的图。
熟悉以上东西,对于获取图片信息已经足够了。
更多精彩
赞助商链接