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


C++ ZStreamR::ReadUInt16LE方法代码示例

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


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

示例1: Imp_Read

void ZDCPixmapDecoder_GIF::Imp_Read(const ZStreamR& iStream, ZDCPixmap& oPixmap)
	{
	oPixmap = ZDCPixmap();
	if (fReadEnd)
		return;

	if (!fReadHeader)
		{
		fReadHeader = true;
		if ('G' != iStream.ReadUInt8()
			|| 'I' != iStream.ReadUInt8()
			|| 'F' != iStream.ReadUInt8()
			|| '8' != iStream.ReadUInt8())
			{
			sThrowBadFormat();
			}

		uint8 version = iStream.ReadUInt8();
		if ('7' != version && '9' != version)
			sThrowBadFormat();

		if ('a' != iStream.ReadUInt8())
			sThrowBadFormat();

		fIs89a = version == '9';
	
		fSize.h = iStream.ReadUInt16LE();
		fSize.v = iStream.ReadUInt16LE();
	
		uint8 strmFlags = iStream.ReadUInt8();
			bool strmHasGlobalColorTable = (strmFlags & 0x80) != 0;
			uint8 strmColorResolution = (strmFlags & 0x7) >> 4;
			bool strmSortFlag = (strmFlags & 0x08) != 0;
			uint8 strmGlobalColorTableSize = (strmFlags & 0x7);
	
		uint8 strmBackgroundColorIndex = iStream.ReadUInt8();
		uint8 strmPixelAspectRatio = iStream.ReadUInt8();
	
		if (strmHasGlobalColorTable)
			{
			vector<ZRGBColorPOD> theColors;
			sReadColorTable(iStream, 1 << (strmGlobalColorTableSize + 1), theColors);
			fPixelDesc = ZDCPixmapNS::PixelDesc(&theColors[0], theColors.size());
			}

		static int sPhysicalDepths[] =
			{
			1, // 0
			2, // 1
			4, // 2
			4, // 3
			8, // 4
			8, // 5
			8, // 6
			8, // 7
			};
		int rowBytes
			= ZDCPixmapNS::sCalcRowBytes(sPhysicalDepths[strmGlobalColorTableSize], fSize.h);

		ZDCPixmapNS::RasterDesc theRasterDesc(
			ZDCPixmapNS::PixvalDesc(strmGlobalColorTableSize + 1, true),
			rowBytes, fSize.v, false);

		fRaster = new ZDCPixmapRaster_Simple(theRasterDesc);
		fRaster->Fill(strmBackgroundColorIndex);
		}
开发者ID:,项目名称:,代码行数:66,代码来源:

示例2: Imp_Read

void ZDCPixmapDecoder_GIF::Imp_Read(const ZStreamR& iStream, ZDCPixmap& oPixmap)
	{
	oPixmap = ZDCPixmap();
	if (fReadEnd)
		return;

	if (!fReadHeader)
		{
		fReadHeader = true;
		if ('G' != iStream.ReadUInt8()
			|| 'I' != iStream.ReadUInt8()
			|| 'F' != iStream.ReadUInt8()
			|| '8' != iStream.ReadUInt8())
			{
			spThrowBadFormat();
			}

		uint8 version = iStream.ReadUInt8();
		if ('7' != version && '9' != version)
			spThrowBadFormat();

		if ('a' != iStream.ReadUInt8())
			spThrowBadFormat();

		fIs89a = version == '9';

		fSize.h = iStream.ReadUInt16LE();
		fSize.v = iStream.ReadUInt16LE();

		uint8 strmFlags = iStream.ReadUInt8();
			bool strmHasGlobalColorTable = (strmFlags & 0x80) != 0;
			//uint8 strmColorResolution = (strmFlags & 0x7) >> 4;
			//bool strmSortFlag = (strmFlags & 0x08) != 0;
			uint8 strmGlobalColorTableSize = (strmFlags & 0x7);

		uint8 strmBackgroundColorIndex = iStream.ReadUInt8();
		/*uint8 strmPixelAspectRatio = */iStream.ReadUInt8();

		if (strmHasGlobalColorTable)
			{
			vector<ZRGBA_POD> theColors;
			spReadColorTable(iStream, 1 << (strmGlobalColorTableSize + 1), theColors);
			fPixelDesc = PixelDesc(&theColors[0], theColors.size());
			}

		static int sPhysicalDepths[] =
			{
			1, // 0
			2, // 1
			4, // 2
			4, // 3
			8, // 4
			8, // 5
			8, // 6
			8, // 7
			};
		int rowBytes =
			sCalcRowBytes(sPhysicalDepths[strmGlobalColorTableSize], fSize.h, 4);

		RasterDesc theRasterDesc(
			PixvalDesc(strmGlobalColorTableSize + 1, true),
			rowBytes, fSize.v, false);

		fRaster = new ZDCPixmapRaster_Simple(theRasterDesc);
		fRaster->Fill(strmBackgroundColorIndex);
		}
	else
		{
		// Clone our existing raster which contains the pixels
		// making up the pixmap we last returned.
		fRaster = new ZDCPixmapRaster_Simple(fRaster);
		}

	for (;;)
		{
		uint8 blockType = iStream.ReadUInt8();
		if (blockType == ';')
			{
			// We've reached the end of the GIF stream.
			fReadEnd = true;
			return;
			}
		else if (blockType == '!')
			{
			// It's an extension.

			// Ignore the extension type
			iStream.ReadUInt8();

			// Skip any data blocks.
			StreamR_Chunk(iStream).SkipAll();
			}
		else if (blockType == ',')
			{
			// It's an image.
			ZRectPOD curBounds;
			curBounds.left = iStream.ReadUInt16LE();
			curBounds.top = iStream.ReadUInt16LE();
			curBounds.right = curBounds.left + iStream.ReadUInt16LE();
			curBounds.bottom = curBounds.top + iStream.ReadUInt16LE();
//.........这里部分代码省略.........
开发者ID:zoolib,项目名称:zoolib_old,代码行数:101,代码来源:ZDCPixmapCoder_GIF.cpp


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