当前位置: 首页>>代码示例>>C++>>正文


C++ IWICImagingFactory::CreateBitmapFlipRotator方法代码示例

本文整理汇总了C++中IWICImagingFactory::CreateBitmapFlipRotator方法的典型用法代码示例。如果您正苦于以下问题:C++ IWICImagingFactory::CreateBitmapFlipRotator方法的具体用法?C++ IWICImagingFactory::CreateBitmapFlipRotator怎么用?C++ IWICImagingFactory::CreateBitmapFlipRotator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IWICImagingFactory的用法示例。


在下文中一共展示了IWICImagingFactory::CreateBitmapFlipRotator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CopyPixelsHelper

static HRESULT CopyPixelsHelper(IWICBitmapSource* source, bool flipVertically, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
{
    HRESULT hr = S_OK;

    IWICImagingFactory* pWIC = _GetWIC();
    if (!pWIC)
        return E_NOINTERFACE;

    if (flipVertically)
    {
        ComPtr<IWICBitmapFlipRotator> pFlipRotator;
        hr = pWIC->CreateBitmapFlipRotator(&pFlipRotator);
        if (FAILED(hr))
            return hr;

        hr = pFlipRotator->Initialize(source, WICBitmapTransformFlipVertical);
        if (FAILED(hr))
            return hr;

        hr = pFlipRotator->CopyPixels(0, cbStride, cbBufferSize, pbBuffer);
        if (FAILED(hr))
            return hr;
    }
    else
    {
        hr = source->CopyPixels(0, cbStride, cbBufferSize, pbBuffer);
        if (FAILED(hr))
            return hr;
    }

    return hr;
}
开发者ID:wpbest,项目名称:UWP,代码行数:32,代码来源:WICTextureLoader.cpp

示例2: _PerformFlipRotateUsingWIC

//-------------------------------------------------------------------------------------
// Do flip/rotate operation using WIC
//-------------------------------------------------------------------------------------
static HRESULT _PerformFlipRotateUsingWIC( _In_ const Image& srcImage, _In_ DWORD flags,
                                           _In_ const WICPixelFormatGUID& pfGUID, _In_ const Image& destImage )
{
    if ( !srcImage.pixels || !destImage.pixels )
        return E_POINTER;

    assert( srcImage.format == destImage.format );

    IWICImagingFactory* pWIC = _GetWIC();
    if ( !pWIC )
        return E_NOINTERFACE;

    ScopedObject<IWICBitmap> source;
    HRESULT hr = pWIC->CreateBitmapFromMemory( static_cast<UINT>( srcImage.width ), static_cast<UINT>( srcImage.height ), pfGUID,
                                               static_cast<UINT>( srcImage.rowPitch ), static_cast<UINT>( srcImage.slicePitch ),
                                               srcImage.pixels, &source );
    if ( FAILED(hr) )
        return hr;

    ScopedObject<IWICBitmapFlipRotator> FR;
    hr = pWIC->CreateBitmapFlipRotator( &FR );
    if ( FAILED(hr) )
        return hr;

    hr = FR->Initialize( source.Get(), static_cast<WICBitmapTransformOptions>( flags ) );
    if ( FAILED(hr) )
        return hr;

    WICPixelFormatGUID pfFR;
    hr = FR->GetPixelFormat( &pfFR );
    if ( FAILED(hr) )
        return hr;

    if ( memcmp( &pfFR, &pfGUID, sizeof(GUID) ) != 0 )
    {
        // Flip/rotate should return the same format as the source...
        return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
    }

    UINT nwidth, nheight;
    hr = FR->GetSize( &nwidth, &nheight );
    if ( FAILED(hr) )
        return hr;

    if ( destImage.width != nwidth || destImage.height != nheight )
        return E_FAIL;

    hr = FR->CopyPixels( 0, static_cast<UINT>( destImage.rowPitch ), static_cast<UINT>( destImage.slicePitch ), destImage.pixels );
    if ( FAILED(hr) )
        return hr;

    return S_OK;
}
开发者ID:rivimey,项目名称:rwmapmaker,代码行数:56,代码来源:DirectXTexFlipRotate.cpp


注:本文中的IWICImagingFactory::CreateBitmapFlipRotator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。