S
sc000
Guest
HRESULT hr = S_OK;
IWICImagingFactory *m_pIWICFactory = NULL;
hr = CoCreateInstance(
CLSID_WICImagingFactory,
NULL,
CLSCTX_INPROC_SERVER,
IID_PPV_ARGS(&m_pIWICFactory)
);
IWICBitmapDecoder *pIDecoder = NULL;
IWICBitmapFrameDecode *pIDecoderFrame = NULL;
hr = m_pIWICFactory->CreateDecoderFromFilename(
strFileName.GetBuffer(strFileName.GetLength()), // Image to be decoded
NULL, // Do not prefer a particular vendor
GENERIC_READ, // Desired read access to the file
WICDecodeMetadataCacheOnDemand, // Cache metadata when needed
&pIDecoder // Pointer to the decoder
);
// Retrieve the first bitmap frame.
if (SUCCEEDED(hr))
{
hr = pIDecoder->GetFrame(0, &pIDecoderFrame);
}
IWICBitmapClipper *pIClipper = NULL;
if (SUCCEEDED(hr))
{
hr = m_pIWICFactory->CreateBitmapClipper(&pIClipper);
}
UINT uiWidth = 100;
UINT uiHeight = 100;
WICRect rcClip = { 0, 0, uiWidth/2, uiHeight/2 };
// Initialize the clipper with the given rectangle of the frames image data.
if (SUCCEEDED(hr))
{
hr = pIClipper->Initialize(pIDecoderFrame, &rcClip);
}
HI,
I want to clip a gif. And I find the code at http://msdn.microsoft.com/en-us/library/windows/desktop/ee719657(v=vs.85).aspx.
The hr is S_OK and strFileName is correct.
But I dont understand the sixth step that Draw or process the clipped image.
And how to save the .gif?
Regards!
what?
Continue reading...
IWICImagingFactory *m_pIWICFactory = NULL;
hr = CoCreateInstance(
CLSID_WICImagingFactory,
NULL,
CLSCTX_INPROC_SERVER,
IID_PPV_ARGS(&m_pIWICFactory)
);
IWICBitmapDecoder *pIDecoder = NULL;
IWICBitmapFrameDecode *pIDecoderFrame = NULL;
hr = m_pIWICFactory->CreateDecoderFromFilename(
strFileName.GetBuffer(strFileName.GetLength()), // Image to be decoded
NULL, // Do not prefer a particular vendor
GENERIC_READ, // Desired read access to the file
WICDecodeMetadataCacheOnDemand, // Cache metadata when needed
&pIDecoder // Pointer to the decoder
);
// Retrieve the first bitmap frame.
if (SUCCEEDED(hr))
{
hr = pIDecoder->GetFrame(0, &pIDecoderFrame);
}
IWICBitmapClipper *pIClipper = NULL;
if (SUCCEEDED(hr))
{
hr = m_pIWICFactory->CreateBitmapClipper(&pIClipper);
}
UINT uiWidth = 100;
UINT uiHeight = 100;
WICRect rcClip = { 0, 0, uiWidth/2, uiHeight/2 };
// Initialize the clipper with the given rectangle of the frames image data.
if (SUCCEEDED(hr))
{
hr = pIClipper->Initialize(pIDecoderFrame, &rcClip);
}
HI,
I want to clip a gif. And I find the code at http://msdn.microsoft.com/en-us/library/windows/desktop/ee719657(v=vs.85).aspx.
The hr is S_OK and strFileName is correct.
But I dont understand the sixth step that Draw or process the clipped image.
And how to save the .gif?
Regards!
what?
Continue reading...