IWICPlanarBitmapSourceTransform::CopyPixels 方法 (wincodec.h)

將圖元複製到目的地平面。 由提供的輸入參數設定。

如果指定 dstTransform、小數位數或格式轉換, cbStride 是已轉換的步幅,而且是以 pDstPlanes 參數的目的地圖元格式為基礎,而不是原始來源的像素格式。

語法

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

參數

[in] prcSource

類型: const WICRect*

要複製的圖元來源矩形。

uiWidth

類型: UINT

縮放來源位圖的寬度。 此參數必須等於可透過 IWICPlanarBitmapSourceTransform:: DoesSupportTransform 取得的值。

uiHeight

類型: UINT

縮放來源位圖的高度。 此參數必須等於可透過 IWICPlanarBitmapSourceTransform:: DoesSupportTransform 取得的值。

dstTransform

類型: WICBitmapTransformOptions

所需的旋轉或翻轉,以在像素複製之前執行。 旋轉可以結合翻轉水準或翻轉垂直,請參閱 WICBitmapTransformOptions

[in] dstPlanarOptions

類型: const WICPlanarOptions

用來指定轉換的其他組態選項。 如需詳細資訊,請參閱 WICPlanarOptions

WIC JPEG 譯碼器:可以指定 WICPlanarOptionsPreserveSubsampling ,以在縮小規模時保留子取樣比例。 根據預設,JPEG 譯碼器會嘗試只減少 Y 平面的品質,在某些情況下,將影像變更為 4:4:4 色度子取樣。

pDstPlanes

類型: WICBitmapPlane

指定每個元件平面的圖元格式和輸出緩衝區。 每個平面的平面和像素格式必須符合可透過 IWICPlanarBitmapSourceTransform::D oesSupportTransform 取得的值。

cPlanes

類型: UINT

pDstPlanes 參數指定的元件平面數目。

傳回值

類型: HRESULT

如果指定的縮放比例、翻轉/旋轉和平面格式設定不受支援,此方法會因為 WINCODEC_ERR_INVALIDPARAMETER而失敗。 您可以呼叫 IWICPlanarBitmapSourceTransform::D oesSupportTransform 來檢查是否支持轉換。

備註

WIC JPEG 譯碼器:根據影像的已設定 chroma 子取樣,來源矩形有下列限制:

Chroma 子取樣 X 座標 Y 座標 Chroma Width Chroma Height
4:2:0 2 的倍數 2 的倍數 lumaWidth / 2 四捨五入至最接近的整數。 lumaHeight / 2 四捨五入至最接近的整數。
4:2:2 2 的倍數 任何 lumaWidth / 2 四捨五入至最接近的整數。 lumaHeight
4:4:4 任意 任意 llumaWidth llumaHeight
4:4:0 任何 2 的倍數 lumaWidth llumaHeight / 2 四捨五入至最接近的整數。
 

pDstPlanes 參數支援下列像素格式。

平面計數 平面 1 平面 2 平面 3
3 GUID_WICPixelFormat8bppY GUID_WICPixelFormat8bppCb GUID_WICPixelFormat8bppCr
2 GUID_WICPixelFormat8bppY GUID_WICPixelFormat16bppCbCr N/A

規格需求

需求
最低支援的用戶端 Windows 8.1 [傳統型應用程式 |UWP 應用程式]
最低支援的伺服器 Windows Server 2012 R2 [傳統型應用程式 |UWP 應用程式]
目標平台 Windows
標頭 wincodec.h
程式庫 Windowscodecs.lib
Dll Windowscodecs.dll

另請參閱

IWICPlanarBitmapSourceTransform