Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

945 lines
23 KiB

  1. /**************************************************************************\
  2. *
  3. * Copyright (c) 1999 Microsoft Corporation
  4. *
  5. * Module Name:
  6. *
  7. * imaging.h
  8. *
  9. * Abstract:
  10. *
  11. * Public SDK header file for the imaging library
  12. *
  13. * Notes:
  14. *
  15. * This is hand-coded for now. Eventually it'll be automatically
  16. * generated from an IDL file.
  17. *
  18. * Revision History:
  19. *
  20. * 05/10/1999 davidx
  21. * Created it.
  22. *
  23. \**************************************************************************/
  24. #ifndef _IMAGING_H
  25. #define _IMAGING_H
  26. #include "GdiplusPixelFormats.h"
  27. //
  28. // Imaging library GUIDS:
  29. // image file format identifiers
  30. // interface and class identifers
  31. //
  32. #include "imgguids.h"
  33. //
  34. // Image property ID tags (PROPID's from the EXIF tags)
  35. //
  36. #define TAG_EXIF_IFD 0x8769
  37. #define TAG_GPS_IFD 0x8825
  38. #define TAG_IMAGE_WIDTH 0x0100
  39. #define TAG_IMAGE_HEIGHT 0x0101
  40. #define TAG_BITS_PER_SAMPLE 0x0102
  41. #define TAG_COMPRESSION 0x0103
  42. #define TAG_PHOTOMETRIC_INTERP 0x0106
  43. #define TAG_IMAGE_DESCRIPTION 0x010E
  44. #define TAG_EQUIP_MAKE 0x010F
  45. #define TAG_EQUIP_MODEL 0x0110
  46. #define TAG_STRIP_OFFSETS 0x0111
  47. #define TAG_ORIENTATION 0x0112
  48. #define TAG_SAMPLES_PER_PIXEL 0x0115
  49. #define TAG_ROWS_PER_STRIP 0x0116
  50. #define TAG_STRIP_BYTES_COUNT 0x0117
  51. #define TAG_X_RESOLUTION 0x011A
  52. #define TAG_Y_RESOLUTION 0x011B
  53. #define TAG_PLANAR_CONFIG 0x011C
  54. #define TAG_RESOLUTION_UNIT 0x0128
  55. #define TAG_TRANSFER_FUNCTION 0x012D
  56. #define TAG_SOFTWARE_USED 0x0131
  57. #define TAG_DATE_TIME 0x0132
  58. #define TAG_ARTIST 0x013B
  59. #define TAG_WHITE_POINT 0x013E
  60. #define TAG_PRIMAY_CHROMATICS 0x013F
  61. #define TAG_JPEG_INTER_FORMAT 0x0201
  62. #define TAG_JPEG_INTER_LENGTH 0x0202
  63. #define TAG_YCbCr_COEFFICIENTS 0x0211
  64. #define TAG_YCbCr_SUBSAMPLING 0x0212
  65. #define TAG_YCbCr_POSITIONING 0x0213
  66. #define TAG_REF_BLACK_WHITE 0x0214
  67. #define TAG_COPYRIGHT 0x8298
  68. // Extra TAGs (Like Adobe Image Information tags etc.)
  69. #define TAG_RESOLUTION_X_UNIT 0x5001
  70. #define TAG_RESOLUTION_Y_UNIT 0x5002
  71. #define TAG_RESOLUTION_X_LENGTH_UNIT 0x5003
  72. #define TAG_RESOLUTION_Y_LENGTH_UNIT 0x5004
  73. #define TAG_PRINT_FLAGS 0x5005
  74. #define TAG_HALFTONE_LPI 0x5006
  75. #define TAG_HALFTONE_LPI_UNIT 0x5007
  76. #define TAG_HALFTONE_DEGREE 0x5008
  77. #define TAG_HALFTONE_SHAPE 0x5009
  78. #define TAG_HALFTONE_MISC 0x5010
  79. #define TAG_HALFTONE_SCREEN 0x5011
  80. #define TAG_JPEG_QUALITY 0x5012
  81. #define TAG_GRID_SIZE 0x5013
  82. #define TAG_THUMBNAIL_FORMAT 0x5014
  83. #define TAG_THUMBNAIL_WIDTH 0x5015
  84. #define TAG_THUMBNAIL_HEIGHT 0x5016
  85. #define TAG_THUMBNAIL_COLORDEPTH 0x5017
  86. #define TAG_THUMBNAIL_PLANES 0x5018
  87. #define TAG_THUMBNAIL_RAWBYTES 0x5019
  88. #define TAG_THUMBNAIL_SIZE 0x5020
  89. #define TAG_THUMBNAIL_COMPRESSED_SIZE 0x5021
  90. // EXIF specific tag
  91. #define EXIF_TAG_EXPOSURE_TIME 0x829A
  92. #define EXIF_TAG_F_NUMBER 0x829D
  93. #define EXIF_TAG_EXPOSURE_PROG 0x8822
  94. #define EXIF_TAG_SPECTRAL_SENSE 0x8824
  95. #define EXIF_TAG_ISO_SPEED 0x8827
  96. #define EXIF_TAG_OECF 0x8828
  97. #define EXIF_TAG_VER 0x9000
  98. #define EXIF_TAG_D_T_ORIG 0x9003 // Date & time of original
  99. #define EXIF_TAG_D_T_DIGITIZED 0x9004 // Date & time of digital data generation
  100. #define EXIF_TAG_COMP_CONFIG 0x9101
  101. #define EXIF_TAG_COMP_BPP 0x9102
  102. #define EXIF_TAG_SHUTTER_SPEED 0x9201
  103. #define EXIF_TAG_APERATURE 0x9202
  104. #define EXIF_TAG_BRIGHTNESS 0x9203
  105. #define EXIF_TAG_EXPOSURE_BIAS 0x9204
  106. #define EXIF_TAG_MAX_APERATURE 0x9205
  107. #define EXIF_TAG_SUBJECT_DIST 0x9206
  108. #define EXIF_TAG_METERING_MODE 0x9207
  109. #define EXIF_TAG_LIGHT_SOURCE 0x9208
  110. #define EXIF_TAG_FLASH 0x9209
  111. #define EXIF_TAG_FOCAL_LENGTH 0x920A
  112. #define EXIF_TAG_MAKER_NOTE 0x927C
  113. #define EXIF_TAG_USER_COMMENT 0x9286
  114. #define EXIF_TAG_D_T_SUBSEC 0x9290 // Date & Time subseconds
  115. #define EXIF_TAG_D_T_ORIG_SS 0x9291 // Date & Time original subseconds
  116. #define EXIF_TAG_D_T_DIG_SS 0x9292 // Date & TIme digitized subseconds
  117. #define EXIF_TAG_FPX_VER 0xA000
  118. #define EXIF_TAG_COLOR_SPACE 0xA001
  119. #define EXIF_TAG_PIX_X_DIM 0xA002
  120. #define EXIF_TAG_PIX_Y_DIM 0xA003
  121. #define EXIF_TAG_RELATED_WAV 0xA004 // related sound file
  122. #define EXIF_TAG_INTEROP 0xA005
  123. #define EXIF_TAG_FLASH_ENERGY 0xA20B
  124. #define EXIF_TAG_SPATIAL_FR 0xA20C // Spatial Frequency Response
  125. #define EXIF_TAG_FOCAL_X_RES 0xA20E // Focal Plane X Resolution
  126. #define EXIF_TAG_FOCAL_Y_RES 0xA20F // Focal Plane Y Resolution
  127. #define EXIF_TAG_FOCAL_RES_UNIT 0xA210 // Focal Plane Resolution Unit
  128. #define EXIF_TAG_SUBJECT_LOC 0xA214
  129. #define EXIF_TAG_EXPOSURE_INDEX 0xA215
  130. #define EXIF_TAG_SENSING_METHOD 0xA217
  131. #define EXIF_TAG_FILE_SOURCE 0xA300
  132. #define EXIF_TAG_SCENE_TYPE 0xA301
  133. #define EXIF_TAG_CFA_PATTERN 0xA302
  134. #define GPS_TAG_VER 0x0000
  135. #define GPS_TAG_LATTITUDE_REF 0x0001
  136. #define GPS_TAG_LATTITUDE 0x0002
  137. #define GPS_TAG_LONGITUDE_REF 0x0003
  138. #define GPS_TAG_LONGITUDE 0x0004
  139. #define GPS_TAG_ALTITUDE_REF 0x0005
  140. #define GPS_TAG_ALTITUDE 0x0006
  141. #define GPS_TAG_GPS_TIME 0x0007
  142. #define GPS_TAG_GPS_SATELLITES 0x0008
  143. #define GPS_TAG_GPS_STATUS 0x0009
  144. #define GPS_TAG_GPS_MEASURE_MODE 0x00A
  145. #define GPS_TAG_GPS_DOP 0x000B // Measurement precision
  146. #define GPS_TAG_SPEED_REF 0x000C
  147. #define GPS_TAG_SPEED 0x000D
  148. #define GPS_TAG_TRACK_REF 0x000E
  149. #define GPS_TAG_TRACK 0x000F
  150. #define GPS_TAG_IMG_DIR_REF 0x0010
  151. #define GPS_TAG_IMG_DIR 0x0011
  152. #define GPS_TAG_MAP_DATUM 0x0012
  153. #define GPS_TAG_DEST_LAT_REF 0x0013
  154. #define GPS_TAG_DEST_LAT 0x0014
  155. #define GPS_TAG_DEST_LONG_REF 0x0015
  156. #define GPS_TAG_DEST_LONG 0x0016
  157. #define GPS_TAG_DEST_BEAR_REF 0x0017
  158. #define GPS_TAG_DEST_BEAR 0x0018
  159. #define GPS_TAG_DEST_DIST_REF 0x0019
  160. #define GPS_TAG_DEST_DIST 0x001A
  161. //
  162. // Information about image pixel data
  163. //
  164. typedef struct tagBitmapData
  165. {
  166. UINT Width;
  167. UINT Height;
  168. INT Stride;
  169. PixelFormatID PixelFormat;
  170. VOID* Scan0;
  171. UINT_PTR Reserved;
  172. } BitmapData;
  173. //
  174. // Access modes used when calling IImage::LockBits
  175. //
  176. typedef enum ImageLockMode
  177. {
  178. IMGLOCK_READ = 0x0001,
  179. IMGLOCK_WRITE = 0x0002,
  180. IMGLOCK_USERINPUTBUF= 0x0004
  181. } ImageLockMode;
  182. //
  183. // Image flags
  184. //
  185. typedef enum ImageFlag
  186. {
  187. IMGFLAG_NONE = 0,
  188. // Low-word: shared with SINKFLAG_x
  189. IMGFLAG_SCALABLE = 0x0001,
  190. IMGFLAG_HASALPHA = 0x0002,
  191. IMGFLAG_HASTRANSLUCENT = 0x0004,
  192. IMGFLAG_PARTIALLY_SCALABLE = 0x0008,
  193. // Low-word: color space definition
  194. IMGFLAG_COLORSPACE_RGB = 0x0010,
  195. IMGFLAG_COLORSPACE_CMYK = 0x0020,
  196. IMGFLAG_COLORSPACE_GRAY = 0x0040,
  197. IMGFLAG_COLORSPACE_YCBCR = 0x0080,
  198. IMGFLAG_COLORSPACE_YCCK = 0x0100,
  199. // Low-word: image size info
  200. IMGFLAG_HASREALDPI = 0x1000,
  201. IMGFLAG_HASREALPIXELSIZE = 0x2000,
  202. // High-word
  203. IMGFLAG_READONLY = 0x00010000,
  204. IMGFLAG_CACHING = 0x00020000
  205. } ImageFlag;
  206. //
  207. // Decoder flags
  208. //
  209. typedef enum DecoderInitFlag
  210. {
  211. DECODERINIT_NONE = 0,
  212. // DECODERINIT_NOBLOCK indicates that the caller requires non-blocking
  213. // behavior. This will be honored only by non-blocking decoders, that
  214. // is, decoders that don't have the IMGCODEC_BLOCKING_DECODE flag.
  215. DECODERINIT_NOBLOCK = 0x0001,
  216. // Choose built-in decoders first before looking at any
  217. // installed plugin decoders.
  218. DECODERINIT_BUILTIN1ST = 0x0002
  219. } DecoderInitFlag;
  220. //
  221. // Flag to indicate how the memory buffer passed to
  222. // IImagingFactory::CreateImageFromBuffer should be disposed.
  223. //
  224. typedef enum BufferDisposalFlag
  225. {
  226. DISPOSAL_NONE,
  227. DISPOSAL_GLOBALFREE,
  228. DISPOSAL_COTASKMEMFREE,
  229. DISPOSAL_UNMAPVIEW
  230. } BufferDisposalFlag;
  231. //
  232. // Quality hints used by resize/rotation operations
  233. //
  234. typedef enum InterpolationHint
  235. {
  236. INTERP_DEFAULT,
  237. INTERP_NEAREST_NEIGHBOR,
  238. INTERP_BILINEAR,
  239. INTERP_AVERAGING,
  240. INTERP_BICUBIC
  241. } InterpolationHint;
  242. //
  243. // Information about image codecs
  244. //
  245. enum
  246. {
  247. IMGCODEC_ENCODER = 0x00000001,
  248. IMGCODEC_DECODER = 0x00000002,
  249. IMGCODEC_SUPPORT_BITMAP = 0x00000004,
  250. IMGCODEC_SUPPORT_VECTOR = 0x00000008,
  251. IMGCODEC_SEEKABLE_ENCODE = 0x00000010,
  252. IMGCODEC_BLOCKING_DECODE = 0x00000020,
  253. IMGCODEC_BUILTIN = 0x00010000,
  254. IMGCODEC_SYSTEM = 0x00020000,
  255. IMGCODEC_USER = 0x00040000
  256. };
  257. typedef struct tagImageCodecInfo
  258. {
  259. CLSID Clsid;
  260. GUID FormatID;
  261. const WCHAR* CodecName;
  262. const WCHAR* FormatDescription;
  263. const WCHAR* FilenameExtension;
  264. const WCHAR* MimeType;
  265. DWORD Flags;
  266. DWORD SigCount;
  267. DWORD SigSize;
  268. const BYTE* SigPattern;
  269. const BYTE* SigMask;
  270. } ImageCodecInfo;
  271. //
  272. // Identifier for channel(s) in a pixel
  273. //
  274. typedef enum ChannelID
  275. {
  276. ALPHA_CHANNEL = 0x00000001,
  277. RED_CHANNEL = 0x00000002,
  278. GREEN_CHANNEL = 0x00000004,
  279. BLUE_CHANNEL = 0x00000008,
  280. COLOR_CHANNELS = RED_CHANNEL|GREEN_CHANNEL|BLUE_CHANNEL,
  281. ALL_CHANNELS = COLOR_CHANNELS|ALPHA_CHANNEL,
  282. INTENSITY_CHANNEL = 0x00010000
  283. } ChannelID;
  284. //
  285. // Data structure for communicating to an image sink
  286. //
  287. enum
  288. {
  289. // Low-word: shared with IMGFLAG_x
  290. SINKFLAG_SCALABLE = IMGFLAG_SCALABLE,
  291. SINKFLAG_HASALPHA = IMGFLAG_HASALPHA,
  292. SINKFLAG_PARTIALLY_SCALABLE = IMGFLAG_PARTIALLY_SCALABLE,
  293. // High-word
  294. SINKFLAG_TOPDOWN = 0x00010000,
  295. SINKFLAG_BOTTOMUP = 0x00020000,
  296. SINKFLAG_FULLWIDTH = 0x00040000,
  297. SINKFLAG_MULTIPASS = 0x00080000,
  298. SINKFLAG_COMPOSITE = 0x00100000,
  299. SINKFLAG_WANTPROPS = 0x00200000
  300. };
  301. typedef struct tagImageInfo
  302. {
  303. GUID RawDataFormat;
  304. PixelFormatID PixelFormat;
  305. UINT Width, Height;
  306. UINT TileWidth, TileHeight;
  307. double Xdpi, Ydpi;
  308. UINT Flags;
  309. } ImageInfo;
  310. //
  311. // Data structure for passing encoder paramaters
  312. //
  313. // NOTE:
  314. // Should this be in GdiplusTypes.h instead? Leave imaging.h for stuff
  315. // shared between the internal stuff and the API?
  316. typedef struct tagEncoderParam
  317. {
  318. GUID paramGuid;
  319. char* Value;
  320. } EncoderParam;
  321. typedef struct tagEncoderParams
  322. {
  323. UINT Count;
  324. EncoderParam Params[1];
  325. } EncoderParams;
  326. //
  327. // Interface and class identifiers
  328. //
  329. interface IImagingFactory;
  330. interface IImage;
  331. interface IBitmapImage;
  332. interface IImageDecoder;
  333. interface IImageEncoder;
  334. interface IImageSink;
  335. interface IBasicBitmapOps;
  336. //--------------------------------------------------------------------------
  337. // Imaging utility factory object
  338. // This is a CoCreate-able object.
  339. //--------------------------------------------------------------------------
  340. MIDL_INTERFACE("327ABDA7-072B-11D3-9D7B-0000F81EF32E")
  341. IImagingFactory : public IUnknown
  342. {
  343. public:
  344. // Create an image object from an input stream
  345. // stream doesn't have to seekable
  346. // caller should Release the stream if call is successful
  347. STDMETHOD(CreateImageFromStream)(
  348. IN IStream* stream,
  349. OUT IImage** image
  350. ) = 0;
  351. // Create an image object from a file
  352. STDMETHOD(CreateImageFromFile)(
  353. IN const WCHAR* filename,
  354. OUT IImage** image
  355. ) = 0;
  356. // Create an image object from a memory buffer
  357. STDMETHOD(CreateImageFromBuffer)(
  358. IN const VOID* buf,
  359. IN UINT size,
  360. IN BufferDisposalFlag disposalFlag,
  361. OUT IImage** image
  362. ) = 0;
  363. // Create a new bitmap image object
  364. STDMETHOD(CreateNewBitmap)(
  365. IN UINT width,
  366. IN UINT height,
  367. IN PixelFormatID pixelFormat,
  368. OUT IBitmapImage** bitmap
  369. ) = 0;
  370. // Create a bitmap image from an IImage object
  371. STDMETHOD(CreateBitmapFromImage)(
  372. IN IImage* image,
  373. IN OPTIONAL UINT width,
  374. IN OPTIONAL UINT height,
  375. IN OPTIONAL PixelFormatID pixelFormat,
  376. IN InterpolationHint hints,
  377. OUT IBitmapImage** bitmap
  378. ) = 0;
  379. // Create a new bitmap image object on user-supplied memory buffer
  380. STDMETHOD(CreateBitmapFromBuffer)(
  381. IN BitmapData* bitmapData,
  382. OUT IBitmapImage** bitmap
  383. ) = 0;
  384. // Create an image decoder object to process the given input stream
  385. STDMETHOD(CreateImageDecoder)(
  386. IN IStream* stream,
  387. IN DecoderInitFlag flags,
  388. OUT IImageDecoder** decoder
  389. ) = 0;
  390. // Create an image encoder object that can output data in the
  391. // specified image file format.
  392. STDMETHOD(CreateImageEncoderToStream)(
  393. IN const CLSID* clsid,
  394. IN IStream* stream,
  395. OUT IImageEncoder** encoder
  396. ) = 0;
  397. STDMETHOD(CreateImageEncoderToFile)(
  398. IN const CLSID* clsid,
  399. IN const WCHAR* filename,
  400. OUT IImageEncoder** encoder
  401. ) = 0;
  402. // Get a list of all currently installed image decoders
  403. STDMETHOD(GetInstalledDecoders)(
  404. OUT UINT* count,
  405. OUT ImageCodecInfo** decoders
  406. ) = 0;
  407. // Get a list of all currently installed image decoders
  408. STDMETHOD(GetInstalledEncoders)(
  409. OUT UINT* count,
  410. OUT ImageCodecInfo** encoders
  411. ) = 0;
  412. // Install an image encoder / decoder
  413. // caller should do the regular COM component
  414. // installation before calling this method
  415. STDMETHOD(InstallImageCodec)(
  416. IN const ImageCodecInfo* codecInfo
  417. ) = 0;
  418. // Uninstall an image encoder / decoder
  419. STDMETHOD(UninstallImageCodec)(
  420. IN const WCHAR* codecName,
  421. IN UINT flags
  422. ) = 0;
  423. // Create an in-memory IPropertySetStorage object
  424. STDMETHOD(CreateMemoryPropertyStore)(
  425. IN OPTIONAL HGLOBAL hmem,
  426. OUT IPropertySetStorage** propSet
  427. ) = 0;
  428. };
  429. //--------------------------------------------------------------------------
  430. // Image interface
  431. // bitmap image
  432. // vector image
  433. // procedural image
  434. //--------------------------------------------------------------------------
  435. MIDL_INTERFACE("327ABDA9-072B-11D3-9D7B-0000F81EF32E")
  436. IImage : public IUnknown
  437. {
  438. public:
  439. // Get the device-independent physical dimension of the image
  440. // in unit of 0.01mm
  441. STDMETHOD(GetPhysicalDimension)(
  442. OUT SIZE* size
  443. ) = 0;
  444. // Get basic image info
  445. STDMETHOD(GetImageInfo)(
  446. OUT ImageInfo* imageInfo
  447. ) = 0;
  448. // Set image flags
  449. STDMETHOD(SetImageFlags)(
  450. IN UINT flags
  451. ) = 0;
  452. // Display the image in a GDI device context
  453. STDMETHOD(Draw)(
  454. IN HDC hdc,
  455. IN const RECT* dstRect,
  456. IN OPTIONAL const RECT* srcRect
  457. ) = 0;
  458. // Push image data into an IImageSink
  459. STDMETHOD(PushIntoSink)(
  460. IN IImageSink* sink
  461. ) = 0;
  462. // Get a thumbnail representation for the image object
  463. STDMETHOD(GetThumbnail)(
  464. IN OPTIONAL UINT thumbWidth,
  465. IN OPTIONAL UINT thumbHeight,
  466. OUT IImage** thumbImage
  467. ) = 0;
  468. // Get/set the properties in the standard property set
  469. // x-res
  470. // y-res
  471. // gamma
  472. // ICC profile
  473. // thumbnail
  474. // tile width
  475. // tile height
  476. //
  477. // Property-related methods
  478. STDMETHOD(GetProperties)(
  479. IN DWORD mode,
  480. OUT IPropertySetStorage** propSet
  481. ) = 0;
  482. };
  483. //--------------------------------------------------------------------------
  484. // Bitmap interface
  485. //--------------------------------------------------------------------------
  486. MIDL_INTERFACE("327ABDAA-072B-11D3-9D7B-0000F81EF32E")
  487. IBitmapImage : public IUnknown
  488. {
  489. public:
  490. // Get bitmap dimensions in pixels
  491. STDMETHOD(GetSize)(
  492. OUT SIZE* size
  493. ) = 0;
  494. // Get bitmap pixel format
  495. STDMETHOD(GetPixelFormatID)(
  496. OUT PixelFormatID* pixelFormat
  497. ) = 0;
  498. // Access bitmap data in the specified pixel format
  499. // must support at least PIXFMT_DONTCARE and
  500. // the caninocal formats.
  501. STDMETHOD(LockBits)(
  502. IN const RECT* rect,
  503. IN UINT flags,
  504. IN PixelFormatID pixelFormat,
  505. IN OUT BitmapData* lockedBitmapData
  506. ) = 0;
  507. STDMETHOD(UnlockBits)(
  508. IN const BitmapData* lockedBitmapData
  509. ) = 0;
  510. // Set/get palette associated with the bitmap image
  511. STDMETHOD(GetPalette)(
  512. OUT ColorPalette** palette
  513. ) = 0;
  514. STDMETHOD(SetPalette)(
  515. IN const ColorPalette* palette
  516. ) = 0;
  517. };
  518. //--------------------------------------------------------------------------
  519. // Interface for performing basic operations on a bitmap image
  520. // This can be QI'ed from an IBitmapImage object.
  521. //--------------------------------------------------------------------------
  522. MIDL_INTERFACE("327ABDAF-072B-11D3-9D7B-0000F81EF32E")
  523. IBasicBitmapOps : public IUnknown
  524. {
  525. public:
  526. // Clone an area of the bitmap image
  527. STDMETHOD(Clone)(
  528. IN OPTIONAL const RECT* rect,
  529. OUT IBitmapImage** outbmp
  530. );
  531. // Flip the bitmap image in x- and/or y-direction
  532. STDMETHOD(Flip)(
  533. IN BOOL flipX,
  534. IN BOOL flipY,
  535. OUT IBitmapImage** outbmp
  536. ) = 0;
  537. // Resize the bitmap image
  538. STDMETHOD(Resize)(
  539. IN UINT newWidth,
  540. IN UINT newHeight,
  541. IN PixelFormatID pixelFormat,
  542. IN InterpolationHint hints,
  543. OUT IBitmapImage** outbmp
  544. ) = 0;
  545. // Rotate the bitmap image by the specified angle
  546. STDMETHOD(Rotate)(
  547. IN FLOAT angle,
  548. IN InterpolationHint hints,
  549. OUT IBitmapImage** outbmp
  550. ) = 0;
  551. // Adjust the brightness of the bitmap image
  552. STDMETHOD(AdjustBrightness)(
  553. IN FLOAT percent
  554. ) = 0;
  555. // Adjust the contrast of the bitmap image
  556. STDMETHOD(AdjustContrast)(
  557. IN FLOAT shadow,
  558. IN FLOAT highlight
  559. ) = 0;
  560. // Adjust the gamma of the bitmap image
  561. STDMETHOD(AdjustGamma)(
  562. IN FLOAT gamma
  563. ) = 0;
  564. };
  565. //--------------------------------------------------------------------------
  566. // Image decoder interface
  567. //--------------------------------------------------------------------------
  568. MIDL_INTERFACE("327ABDAB-072B-11D3-9D7B-0000F81EF32E")
  569. IImageDecoder : public IUnknown
  570. {
  571. public:
  572. // Initialize the image decoder object
  573. STDMETHOD(InitDecoder)(
  574. IN IStream* stream,
  575. IN DecoderInitFlag flags
  576. ) = 0;
  577. // Clean up the image decoder object
  578. STDMETHOD(TerminateDecoder)() = 0;
  579. // Start decoding the current frame
  580. STDMETHOD(BeginDecode)(
  581. IN IImageSink* sink,
  582. IN OPTIONAL IPropertySetStorage* newPropSet
  583. ) = 0;
  584. // Continue decoding
  585. STDMETHOD(Decode)() = 0;
  586. // Stop decoding the current frame
  587. STDMETHOD(EndDecode)(
  588. IN HRESULT statusCode
  589. ) = 0;
  590. // Query multi-frame dimensions
  591. STDMETHOD(QueryFrameDimensions)(
  592. OUT UINT* count,
  593. OUT GUID** dimensionIDs
  594. ) = 0;
  595. // Get number of frames for the specified dimension
  596. STDMETHOD(GetFrameCount)(
  597. IN const GUID* dimensionID,
  598. OUT UINT* count
  599. ) = 0;
  600. // Select currently active frame
  601. STDMETHOD(SelectActiveFrame)(
  602. IN const GUID* dimensionID,
  603. IN UINT frameIndex
  604. ) = 0;
  605. // Get basic information about the image
  606. STDMETHOD(GetImageInfo)(
  607. OUT ImageInfo* imageInfo
  608. ) = 0;
  609. // Get image thumbnail
  610. STDMETHOD(GetThumbnail)(
  611. IN OPTIONAL UINT thumbWidth,
  612. IN OPTIONAL UINT thumbHeight,
  613. OUT IImage** thumbImage
  614. ) = 0;
  615. // Property/metadata related methods
  616. STDMETHOD(GetProperties)(
  617. OUT IPropertySetStorage** propSet
  618. ) = 0;
  619. // Query decoder parameters
  620. STDMETHOD(QueryDecoderParam)(
  621. IN GUID Guid
  622. ) = 0;
  623. // Set decoder parameters
  624. STDMETHOD(SetDecoderParam)(
  625. IN GUID Guid,
  626. IN UINT Length,
  627. IN PVOID Value
  628. ) = 0;
  629. };
  630. //--------------------------------------------------------------------------
  631. // Image decode sink interface
  632. //--------------------------------------------------------------------------
  633. MIDL_INTERFACE("327ABDAE-072B-11D3-9D7B-0000F81EF32E")
  634. IImageSink : public IUnknown
  635. {
  636. public:
  637. // Begin the sink process
  638. STDMETHOD(BeginSink)(
  639. IN OUT ImageInfo* imageInfo,
  640. OUT OPTIONAL RECT* subarea
  641. ) = 0;
  642. // End the sink process
  643. STDMETHOD(EndSink)(
  644. IN HRESULT statusCode
  645. ) = 0;
  646. // Pass the color palette to the image sink
  647. STDMETHOD(SetPalette)(
  648. IN const ColorPalette* palette
  649. ) = 0;
  650. // Ask the sink to allocate pixel data buffer
  651. STDMETHOD(GetPixelDataBuffer)(
  652. IN const RECT* rect,
  653. IN PixelFormatID pixelFormat,
  654. IN BOOL lastPass,
  655. OUT BitmapData* bitmapData
  656. ) = 0;
  657. // Give the sink pixel data and release data buffer
  658. STDMETHOD(ReleasePixelDataBuffer)(
  659. IN const BitmapData* bitmapData
  660. ) = 0;
  661. // Push pixel data
  662. STDMETHOD(PushPixelData)(
  663. IN const RECT* rect,
  664. IN const BitmapData* bitmapData,
  665. IN BOOL lastPass
  666. ) = 0;
  667. // Push raw image data
  668. STDMETHOD(PushRawData)(
  669. IN const VOID* buffer,
  670. IN UINT bufsize
  671. ) = 0;
  672. // Methods for passing metadata / properties
  673. STDMETHOD(PushProperties)(
  674. IN IPropertySetStorage* propSet
  675. ) = 0;
  676. STDMETHOD(NeedTransform)(
  677. OUT UINT* rotation
  678. ) = 0;
  679. STDMETHOD(PushRawInfo)(
  680. IN OUT void* info
  681. ) = 0;
  682. };
  683. //--------------------------------------------------------------------------
  684. // Image encoder interface
  685. //--------------------------------------------------------------------------
  686. MIDL_INTERFACE("327ABDAC-072B-11D3-9D7B-0000F81EF32E")
  687. IImageEncoder : public IUnknown
  688. {
  689. public:
  690. // Initialize the image encoder object
  691. STDMETHOD(InitEncoder)(
  692. IN IStream* stream
  693. ) = 0;
  694. // Clean up the image encoder object
  695. STDMETHOD(TerminateEncoder)() = 0;
  696. // Get an IImageSink interface for encoding the next frame
  697. STDMETHOD(GetEncodeSink)(
  698. OUT IImageSink** sink
  699. ) = 0;
  700. // Set active frame dimension
  701. STDMETHOD(SetFrameDimension)(
  702. IN const GUID* dimensionID
  703. ) = 0;
  704. // Query encoder parameters
  705. STDMETHOD(QueryEncoderParam)(
  706. OUT EncoderParams** Params
  707. ) = 0;
  708. // Set encoder parameters
  709. STDMETHOD(SetEncoderParam)(
  710. IN EncoderParams* Param
  711. ) = 0;
  712. };
  713. //--------------------------------------------------------------------------
  714. // Imaging library error codes
  715. //
  716. // !!! TODO
  717. // How does one pick a facility code?
  718. //
  719. // Standard error code used:
  720. // E_INVALIDARG
  721. // E_OUTOFMEMORY
  722. // E_NOTIMPL
  723. // E_ACCESSDENIED
  724. // E_PENDING
  725. //--------------------------------------------------------------------------
  726. #define FACILITY_IMAGING 0x87b
  727. #define MAKE_IMGERR(n) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_IMAGING, n)
  728. #define IMGERR_OBJECTBUSY MAKE_IMGERR(1)
  729. #define IMGERR_NOPALETTE MAKE_IMGERR(2)
  730. #define IMGERR_BADLOCK MAKE_IMGERR(3)
  731. #define IMGERR_BADUNLOCK MAKE_IMGERR(4)
  732. #define IMGERR_NOCONVERSION MAKE_IMGERR(5)
  733. #define IMGERR_CODECNOTFOUND MAKE_IMGERR(6)
  734. #define IMGERR_NOFRAME MAKE_IMGERR(7)
  735. #define IMGERR_ABORT MAKE_IMGERR(8)
  736. #endif // !_IMAGING_H