ID2D1DeviceContext2::CreateImageSourceFromDxgi method (d2d1_3.h)
Creates an image source from a set of DXGI surface(s). The YCbCr surface(s) are converted to RGBA automatically during subsequent drawing.
HRESULT CreateImageSourceFromDxgi( IDXGISurface **surfaces, UINT32 surfaceCount, DXGI_COLOR_SPACE_TYPE colorSpace, D2D1_IMAGE_SOURCE_FROM_DXGI_OPTIONS options, ID2D1ImageSource **imageSource );
Type: [in] IDXGISurface**
The DXGI surfaces to create the image source from.
The number of surfaces provided; must be between one and three.
The color space of the input.
Options controlling color space conversions.
Type: [out] ID2D1ImageSource**
Receives the new image source instance.
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 surfaces that use a limited set of DXGI formats and DXGI color space types. Only the below set of combinations of color space types, surface formats, and surface counts are supported:
|Color Space Type||Surface Count(s)||Surface Format(s)|
|DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709||1||Standard D2D-supported pixel formats:
|DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601||1, 2, 3||When Surface count is 1:
When Surface count is 1:
The GPU must also have sufficient support for a pixel format to be supported by D2D. To determine whether D2D supports a format, call IsDxgiFormatSupported.
This API converts YCbCr formats to sRGB using the provided color space type and options. RGBA data is assumed to be in the desired space, and D2D does not apply any conversion.
If multiple surfaces are provided, this method infers whether chroma planes are subsampled (by 2x) from the relative sizes of each corresponding source rectangle (or if the source rectangles parameter is NULL, the bounds of each surface). The second and third rectangle must each be equal in size to the first rectangle, or to the first rectangle with one or both dimensions scaled by 0.5 (while rounding up).
If provided, the source rectangles must be within the bounds of the corresponding surface. The source rectangles may have different origins. In this case, this method shifts the data from each plane to align with one another.
|Minimum supported client||Windows 10 [desktop apps | UWP apps]|
|Minimum supported server||Windows Server 2016 [desktop apps | UWP apps]|