ID2D1DeviceContext2::CreateImageSourceFromWic(IWICBitmapSource,ID2D1ImageSourceFromWic) method (d2d1_3.h)

Creates an image source object from a WIC bitmap source, while populating all pixel memory within the image source.
The image is loaded and stored while using a minimal amount of memory.


HRESULT CreateImageSourceFromWic(
  [in]  IWICBitmapSource        *wicBitmapSource,
  [out] ID2D1ImageSourceFromWic **imageSource


[in] wicBitmapSource

Type: IWICBitmapSource*

The WIC bitmap source to create the image source from.

[out] imageSource

Type: ID2D1ImageSourceFromWic**

Receives the new image source instance.

Return value


S_OK if successful, otherwise a failure HRESULT.


This method creates an image source which can be used to draw the image.

This method supports images that exceed the maximum texture size. Large images are internally stored within a sparse tile cache.

This API supports the same set of pixel formats and alpha modes supported by CreateBitmapFromWicBitmap.
If the GPU does not support a given pixel format, this method will return D2DERR_UNSUPPORTED_PIXEL_FORMAT. This method does not apply adjustments such as gamma or alpha premultiplication which affect the appearance of the image.

This method automatically selects an appropriate storage format to minimize GPU memory usage, such as using separate luminance and chrominance textures for JPEG images.


Minimum supported client Windows 10 [desktop apps | UWP apps]
Minimum supported server Windows Server 2016 [desktop apps | UWP apps]
Target Platform Windows
Header d2d1_3.h
DLL D2d1.dll

See also