Implementing IWICBitmapSource


IWICBitmapSource is important for working with images from an application perspective. It represents the highest level abstraction for an image source, and all Windows Imaging Component (WIC) interfaces that represent an image, including IWICBitmapFrameDecode, IWICBitmap, and all the transform interfaces (IWICBitmapScaler, IWICBitmapClipper, IWICBitmapFlipRotator, and IWICFormatConverter) are derived from it. At any specific time, an IWICBitmapSource object may or may not be backed by an actual bitmap in memory. This enables very efficient processing by an application, because an image can be dealt with as an abstraction. Transform operations can be chained in a transform pipeline without consuming memory resources until the application is ready to render or print the image, at which time it invokes the CopyPixels method on the final transform to get a bitmap in memory of the image with the selected transforms applied.

interface IWICBitmapSource : IUnknown
   // Required methods
   HRESULT GetSize ( UINT *puiWidth, UINT *puiHeight );
   HRESULT GetPixelFormat ( WICPixelFormatGUID *pPixelFormat );
   HRESULT GetResolution ( double *pDpiX, double *pDpiY );
   HRESULT CopyPixels ( const WICRect *prc,
      UINT cbStride,
      UINT cbBufferSize, 
      BYTE *pbBuffer );
   // Optional method
   HRESULT CopyPalette ( IWICPalette *pIPalette );

From a codec perspective, the IWICBitmapSource methods are implemented on the frame decoder object. These methods are described in Implementing IWICBitmapSource, along with the other methods on IWICBitmapFrameDecode, which is derived from IWICBitmapSource.

Related topics

Implementing IWICBitmapCodecProgressNotification (Decoder)
Implementing IWICBitmapFrameDecode
How to Write a WIC-Enabled CODEC
Windows Imaging Component Overview