本文整理汇总了C++中ZStreamW::WriteUInt16LE方法的典型用法代码示例。如果您正苦于以下问题:C++ ZStreamW::WriteUInt16LE方法的具体用法?C++ ZStreamW::WriteUInt16LE怎么用?C++ ZStreamW::WriteUInt16LE使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZStreamW
的用法示例。
在下文中一共展示了ZStreamW::WriteUInt16LE方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Imp_Write
void ZDCPixmapEncoder_GIF::Imp_Write(const ZStreamW& iStream,
const void* iBaseAddress,
const ZDCPixmapNS::RasterDesc& iRasterDesc,
const ZDCPixmapNS::PixelDesc& iPixelDesc,
const ZRect& iBounds)
{
ZRef<ZDCPixmapNS::PixelDescRep_Indexed> thePixelDescRep_Indexed
= ZRefDynamicCast<ZDCPixmapNS::PixelDescRep_Indexed>(iPixelDesc.GetRep());
ZAssertStop(2, thePixelDescRep_Indexed);
if (fTransparent)
iStream.WriteString("GIF89a");
else
iStream.WriteString("GIF87a");
iStream.WriteUInt16LE(iBounds.Width());
iStream.WriteUInt16LE(iBounds.Height());
uint8 globalStrmFlags = 0;
globalStrmFlags |= 0x80; // hasGlobalColorTable
globalStrmFlags |= 0x70; // colorResolution (8 bits per component)
// globalStrmFlags |= 0x08; // set this if the color table is sorted in priority order
ZAssertStop(2, iRasterDesc.fPixvalDesc.fDepth > 0 && iRasterDesc.fPixvalDesc.fDepth <= 8);
globalStrmFlags |= iRasterDesc.fPixvalDesc.fDepth - 1; // globalColorTableSize & depth
iStream.WriteUInt8(globalStrmFlags);
iStream.WriteUInt8(0); // backgroundColorIndex
iStream.WriteUInt8(0); // Pixel aspect ratio -- 0 == none specified.
const ZRGBColorPOD* theColors;
size_t theColorsCount;
thePixelDescRep_Indexed->GetColors(theColors, theColorsCount);
sWriteColorTable(iStream, theColors, theColorsCount, 1 << iRasterDesc.fPixvalDesc.fDepth);
if (fTransparent)
{
iStream.WriteUInt8('!'); // Extension block
iStream.WriteUInt8(0xF9); // Graphic Control Extension
iStream.WriteUInt8(4); // Block size
// The next byte encodes four fields:
// 3 bits, Reserved == 0
// 3 bits, Disposal Method == none (0),
// 1 bit, User Input Flag == none (0)
// 1 bit, Transparent Color Flag = yes (1)
iStream.WriteUInt8(1);
iStream.WriteUInt16LE(0); // Delay time
iStream.WriteUInt8(fTransparentPixval);
iStream.WriteUInt8(0); // Block terminator
}
iStream.WriteUInt8(','); // Start of image
iStream.WriteUInt16LE(0); // Origin h
iStream.WriteUInt16LE(0); // Origin v
iStream.WriteUInt16LE(iBounds.Width());
iStream.WriteUInt16LE(iBounds.Height());
uint8 localStrmFlags = 0;
// localStrmFlags |= 0x80; // hasLocalColorTable
if (fInterlace)
localStrmFlags |= 0x40; // interlaced
// localStrmFlags |= 0x20; // sorted
// localStrmFlags |= 0x70; // localColorTableSize
iStream.WriteUInt8(localStrmFlags);
iStream.WriteUInt8(iRasterDesc.fPixvalDesc.fDepth); // Initial code size.
{ // Scope theSC.
StreamW_Chunk theSC(iStream);
ZStreamW_LZWEncode* theSLZW = nil;
ZStreamW_LZWEncodeNoPatent* theSLZWNP = nil;
ZStreamW* theStream;
if (fNoPatent)
{
theSLZWNP = new ZStreamW_LZWEncodeNoPatent(iRasterDesc.fPixvalDesc.fDepth, theSC);
theStream = theSLZWNP;
}
else
{
theSLZW = new ZStreamW_LZWEncode(iRasterDesc.fPixvalDesc.fDepth, theSC);
theStream = theSLZW;
}
ZDCPixmapNS::PixvalDesc destPixvalDesc(8, true);
vector<uint8> theRowBufferVector(iBounds.Width());
void* theRowBuffer = &theRowBufferVector[0];
try
{
if (fInterlace)
{
for (int pass = 0; pass < 4; ++pass)
{
for (ZCoord currentY = iBounds.top + sInterlaceStart[pass];
currentY < iBounds.bottom; currentY += sInterlaceIncrement[pass])
{
const void* sourceRowAddress
//.........这里部分代码省略.........