IWICPlanarBitmapSourceTransform::D oesSupportTransform 方法 (wincodec.h)

使用這個方法來判斷是否支援所需的平面輸出,並允許呼叫端在支援時選擇優化的程式代碼路徑。 否則,呼叫端應該回到 IWICBitmapSourceTransformIWICBitmapSource 並擷取交錯的圖元。

您可以檢查下列轉換:

  • 判斷是否支援透過 WICBitmapTransformOptions 指定的翻轉/旋轉選項。
  • 判斷是否支援要求的平面像素格式設定。
  • 判斷實作可以原生調整為指定所需維度的最接近維度。

支持轉換時,這個方法會傳回 pPlaneDescriptions 參數中產生的平面描述。

語法

HRESULT DoesSupportTransform(
  [in, out] UINT                      *puiWidth,
  [in, out] UINT                      *puiHeight,
            WICBitmapTransformOptions dstTransform,
            WICPlanarOptions          dstPlanarOptions,
  [in]      const WICPixelFormatGUID  *pguidDstFormats,
  [out]     WICBitmapPlaneDescription *pPlaneDescriptions,
            UINT                      cPlanes,
  [out]     BOOL                      *pfIsSupported
);

參數

[in, out] puiWidth

類型: UINT*

在輸入時,所需的寬度。 在輸出上,最接近所需寬度的支持寬度;這大小或大於所需的寬度。

[in, out] puiHeight

類型: UINT*

在輸入時,所需的高度。 在輸出上,最接近所需高度的支援高度;這大小或大於所需的寬度。

dstTransform

類型: WICBitmapTransformOptions

所需的旋轉或翻轉作業。 您可以在此旗標參數中結合多個 WICBitmapTransformOptions ,請參閱 WICBitmapTransformOptions

dstPlanarOptions

類型: WICPlanarOptions

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

WIC JPEG 譯碼器:

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

[in] pguidDstFormats

類型: const WICPixelFormatGUID*

個別平面的要求圖元格式。

[out] pPlaneDescriptions

類型: WICBitmapPlaneDescription*

當 *pfIsSupported == TRUE 時,平面描述的陣列包含每個平面的大小和格式。

WIC JPEG 譯碼器:Cb 和 Cr 平面的大小可能會與 puiWidthpuiHeight 傳回的值不同,因為 chroma 子取樣。

cPlanes

類型: UINT

要求的元件平面數目。

[out] pfIsSupported

類型: BOOL*

如果原生支援要求的轉換,請將 設定為 TRUE。

傳回值

類型: HRESULT

檢查 pfIsSupported 的值,以判斷是否透過 IWICPlanarBitmapSourceTransform::CopyPixels 支持轉換。 如果此方法失敗,寬度、高度和平面描述的輸出參數會初始化為零。 其他傳回值表示失敗。

規格需求

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

另請參閱

IWICPlanarBitmapSourceTransform

IWicPlanarBitmapSourceTransform::CopyPixels

WICBitmapPlaneDescription

WICBitmapTransformOptions

WICPlanarOptions