IWICBitmapClipper::Initialize method

Initializes the bitmap clipper with the provided parameters.

Syntax


HRESULT Initialize(
  [in]       IWICBitmapSource *pISource,
  [inconst WICRect          *prc
);

Parameters

pISource [in]

Type: IWICBitmapSource*

he input bitmap source.

prc [in]

Type: const WICRect*

The rectangle of the bitmap source to clip.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Examples

The following function creates and initializes a clipper using the passed in parameters.


HRESULT ClipSource(IWICBitmapSource *pBitmapSource, const WICRect *prect, IWICBitmapClipper **ppClipper)
{
    HRESULT hr = E_INVALIDARG;

    if (pBitmapSource && prect && ppClipper)
    {
        IWICImagingFactory *pFactory = NULL;
        IWICBitmapClipper *pClipper = NULL;

        HRESULT hr = CoCreateInstance(
          CLSID_WICImagingFactory,
          NULL,
          CLSCTX_INPROC_SERVER,
          IID_IWICImagingFactory,
          (LPVOID*)&pFactory
        );

        if (SUCCEEDED(hr))
        {
            hr = pFactory->CreateBitmapClipper(&pClipper);
        }

        if (SUCCEEDED(hr))
        {
            hr = pClipper->Initialize(pBitmapSource, prect);
        }

        if (SUCCEEDED(hr))
        {
            *ppClipper = pClipper;
        }

        if (pClipper)
        {
            pClipper->Release();
        }

        if (pFactory)
        {
            pFactory->Release();
        }
    }

    return hr;
}

Requirements

Minimum supported client

Windows XP with SP2, Windows Vista [desktop apps | UWP apps]

Minimum supported server

Windows Server 2008 [desktop apps | UWP apps]

Header

Wincodec.h

IDL

Wincodec.idl

Library

Windowscodecs.lib

DLL

Windowscodecs.dll

 

 

Show: