ID2D1DeviceContext2::CreateImageSourceFromDxgi method
Creates an image source from a set of DXGI surface(s). The YCbCr surface(s) are converted to RGBA automatically during subsequent drawing.
Syntax
HRESULT CreateImageSourceFromDxgi( [in] IDXGISurface **surfaces, [in, optional] const D2D1_RECT_U *sourceRectangles, UINT32 surfaceCount, DXGI_COLOR_SPACE_TYPE colorSpace, D2D1_IMAGE_SOURCE_FROM_DXGI_OPTIONS options, [out] ID2D1ImageSource **imageSource );
Parameters
- surfaces [in]
-
Type: IDXGISurface**
The DXGI surfaces to create the image source from.
- sourceRectangles [in, optional]
-
Type: const D2D1_RECT_U*
The regions of the surfaces to create the image source from.
- surfaceCount
-
Type: UINT32
The number of surfaces provided; must be between one and three.
- colorSpace
-
Type: DXGI_COLOR_SPACE_TYPE
The color space of the input.
- options
-
Type: D2D1_IMAGE_SOURCE_FROM_DXGI_OPTIONS
Options controlling color space conversions.
- imageSource [out]
-
Type: ID2D1ImageSource**
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. 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 2:
When Surface Count is 3:
|
|
DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601
DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P601 DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P709 DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020 DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020 | 1,2,3 |
When Surface count is 1:
When Surface Count is 2:
When Surface Count is 3:
|
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.
Requirements
|
Minimum supported client |
Windows 10 [desktop apps | UWP apps] |
|---|---|
|
Minimum supported server |
Windows Server 2016 [desktop apps | Windows Store apps] |
|
Minimum supported phone |
Windows 10 Mobile |
|
Header |
|
|
DLL |
|
See also