ID2D1DeviceContext2::CreateImageSourceFromWicHardware method

[This documentation is preliminary and is subject to change.]

Creates an image source object from a WIC bitmap source, while scaling the image and populating all pixel memory within the image source using GPU decoding.

Syntax

HRESULT CreateImageSourceFromWicHardware(
  [in]            IWICBitmapFrameDecode *wicBitmapFrame,
  D2D1_IMAGE_SOURCE_LOADING_OPTIONS loadingOptions,
  [in, optional]  const D2D1_IMAGE_SOURCE_DECODING_PARAMETERS *decodingParameters,
  [in, optional]  HANDLE completionEvent,
  [out]           ID2D1ImageSourceFromWicHardware **imageSource
);

Parameters

  • wicBitmapFrame [in]
    Type: IWICBitmapFrameDecode*

    The WIC bitmap frame decode to create the image source from.

  • loadingOptions
    Type: D2D1_IMAGE_SOURCE_LOADING_OPTIONS

    Options for creating the image source. Default options are used if NULL.

  • decodingParameters [in, optional]
    Type: const D2D1_IMAGE_SOURCE_DECODING_PARAMETERS*

    Parameters for the decoding pipeline used to create the image source. Default options are used if NULL.

  • completionEvent [in, optional]
    Type: HANDLE

    If provided, this method will not wait for GPU decoding to complete before returning. The event will be signaled upon completion.

  • imageSource [out]
    Type: ID2D1ImageSourceFromWicHardware**

    Receives the new image source instance.

Return value

Type: HRESULT

S_OK if successful, otherwise a failure HRESULT.

Remarks

This method creates an image source which can be used to draw the image, and populates the image source using GPU decoding. If GPU decoding is unsupported for this file, this method fails with D2DERR_INSUFFICIENT_DEVICE_CAPABILITIES. To determine whether GPU decoding is supported, call GetImageSourceHardwareDecodeSupport.

 

The image reflects an initial scale that is determined by the maximumDimension field within the decodingParameters parameter, if non-zero. The maximumDimension size must be supported, or this method will fail with D2DERR_INSUFFICIENT_DEVICE_CAPABILITIES. To determine the nearest supported maximumDimension value, call GetImageSourceHardwareDecodeSupport.

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

   

If the completionEvent parameter is not NULL, ID2D1ImageSourceFromWicHardware::GetStatus should be called to check for errors after the event is signaled. Otherwise, this API waits for GPU decoding to complete before returning, and returns the result operation.

 

If the decodingParameters argument is NULL, D2D uses the following parameters:

orientation D2D1_ORIENTATION_DEFAULT
maximumSize (0,0) (No maximum size)

 

Requirements

Header

D2d1_3.h

Library

D2d1_3.lib

DLL

D2d1_3.dll

See also

ID2D1DeviceContext2