本文整理汇总了C++中CImage::GetFrameCount方法的典型用法代码示例。如果您正苦于以下问题:C++ CImage::GetFrameCount方法的具体用法?C++ CImage::GetFrameCount怎么用?C++ CImage::GetFrameCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CImage
的用法示例。
在下文中一共展示了CImage::GetFrameCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: inputBuffer
bool
CIMGCodec::Encode( const CImage& inputImage ,
CORE::CIOAccess& encodedOutput )
{GUCEF_TRACE;
if ( inputImage.HasFrames() )
{
CORE::CDynamicBuffer inputBuffer( 102400, true );
CORE::CDynamicBufferAccess bufferAccess( &inputBuffer, false );
// Fill our header
TImageInfo imageInfo;
imageInfo.version = GUCEF_IMAGE_TIMAGEINFO_VERSION;
imageInfo.nrOfFramesInImage = inputImage.GetFrameCount();
// write header
bufferAccess.Write( &imageInfo, sizeof( TImageInfo ), 1 );
// Now we add each frame's info + mipmap info
TImageFrameInfo frameInfo;
frameInfo.version = GUCEF_IMAGE_TIMAGEFRAMEINFO_VERSION;
TImageMipMapLevelInfo mipMapInfo;
mipMapInfo.version = GUCEF_IMAGE_TIMAGEMIPMAPLEVELINFO_VERSION;
const CImage::TMipMapList* mipMapList = NULL;
const TPixelMapPtr* pixelMap = NULL;
for ( UInt32 frameNr=0; frameNr<imageInfo.nrOfFramesInImage; ++frameNr )
{
mipMapList = &inputImage.GetFrame( frameNr );
frameInfo.nrOfMipmapLevels = static_cast< UInt32 >( mipMapList->size() );
bufferAccess.Write( &frameInfo, sizeof( TImageFrameInfo ), 1 );
// Now we add the info for each mipmap level
for ( UInt32 mipLvl=0; mipLvl<frameInfo.nrOfMipmapLevels; ++mipLvl )
{
pixelMap = &(*mipMapList)[ mipLvl ];
mipMapInfo.frameWidth = (*pixelMap)->GetWidthInPixels();
mipMapInfo.frameHeight = (*pixelMap)->GetHeightInPixels();
mipMapInfo.pixelStorageFormat = (*pixelMap)->GetPixelStorageFormat();
mipMapInfo.pixelComponentDataType = (*pixelMap)->GetPixelComponentDataType();
bufferAccess.Write( &mipMapInfo, sizeof( TImageMipMapLevelInfo ), 1 );
}
}
// Now it is time to add the pixel data itself
for ( UInt32 frameNr=0; frameNr<imageInfo.nrOfFramesInImage; ++frameNr )
{
mipMapList = &inputImage.GetFrame( frameNr );
for ( UInt32 mipLvl=0; mipLvl<mipMapList->size(); ++mipLvl )
{
pixelMap = &(*mipMapList)[ mipLvl ];
bufferAccess.Write( (*pixelMap)->GetDataPtr(), (*pixelMap)->GetTotalSizeInBytes(), 1 );
}
}
// We have now merged all the image object data into a single buffer using the decoded 'ImageCodec' format
// It is time to perform the actual Encode()
return Encode( bufferAccess ,
encodedOutput );
}
return false;
}