IWICPlanarBitmapSourceTransform::CopyPixels method

Copies pixels into the destination planes. Configured by the supplied input parameters.

If a dstTransform, scale, or format conversion is specified, cbStride is the transformed stride and is based on the destination pixel format of the pDstPlanes parameter, not the original source's pixel format.

Syntax


HRESULT CopyPixels(
  [in, unique] const WICRect                   *prcSource,
                     UINT                      uiWidth,
                     UINT                      uiHeight,
                     WICBitmapTransformOptions dstTransform,
  [in]         const WICPlanarOptions          dstPlanarOptions,
                     WICBitmapPlane            pDstPlanes,
                     UINT                      cPlanes
);

Parameters

prcSource [in]

Type: const WICRect*

The source rectangle of pixels to copy.

uiWidth

Type: UINT

The width to scale the source bitmap. This parameter must be equal to a value obtainable through IWICPlanarBitmapSourceTransform:: DoesSupportTransform.

uiHeight

Type: UINT

The height to scale the source bitmap. This parameter must be equal to a value obtainable through IWICPlanarBitmapSourceTransform:: DoesSupportTransform.

dstTransform

Type: WICBitmapTransformOptions

The desired rotation or flip to perform prior to the pixel copy. A rotate can be combined with a flip horizontal or a flip vertical, see WICBitmapTransformOptions.

dstPlanarOptions [in]

Type: const WICPlanarOptions

Used to specify additional configuration options for the transform. See WICPlanarOptions for more detail.

WIC JPEG Decoder: WICPlanarOptionsPreserveSubsampling can be specified to retain the subsampling ratios when downscaling. By default, the JPEG decoder attempts to preserve quality by downscaling only the Y plane in some cases, changing the image to 4:4:4 chroma subsampling.

pDstPlanes

Type: WICBitmapPlane

Specifies the pixel format and output buffer for each component plane. The number of planes and pixel format of each plane must match values obtainable through IWICPlanarBitmapSourceTransform::DoesSupportTransform.

cPlanes

Type: UINT

The number of component planes specified by the pDstPlanes parameter.

Return value

Type: HRESULT

If the specified scale, flip/rotate, and planar format configuration is not supported this method fails with WINCODEC_ERR_INVALIDPARAMETER. You can check if a transform is supported by calling IWICPlanarBitmapSourceTransform::DoesSupportTransform.

Remarks

WIC JPEG Decoder: Depending on the configured chroma subsampling of the image, the source rectangle has the following restrictions:

Chroma SubsamplingX CoordinateY CoordinateChroma WidthChroma Height
4:2:0Multiple of 2Multiple of 2lumaWidth / 2 Rounded up to the nearest integer.lumaHeight / 2 Rounded up to the nearest integer.
4:2:2Multiple of 2AnylumaWidth / 2 Rounded up to the nearest integer.lumaHeight
4:4:4AnyAnyllumaWidthllumaHeight
4:4:0AnyMultiple of 2lumaWidthllumaHeight / 2 Rounded up to the nearest integer.

 

The pDstPlanes parameter supports the following pixel formats.

Plane CountPlane 1Plane 2Plane 3
3GUID_WICPixelFormat8bppYGUID_WICPixelFormat8bppCbGUID_WICPixelFormat8bppCr
2GUID_WICPixelFormat8bppYGUID_WICPixelFormat16bppCbCrN/A

 

Requirements

Minimum supported client

Windows 8.1 [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2012 R2 [desktop apps | Windows Store apps]

Header

Wincodec.h

IDL

Wincodec.idl

Library

Windowscodecs.lib

DLL

Windowscodecs.dll

See also

IWICPlanarBitmapSourceTransform

 

 

Show: