本文整理汇总了C++中common::DumpFile::writeUint16BE方法的典型用法代码示例。如果您正苦于以下问题:C++ DumpFile::writeUint16BE方法的具体用法?C++ DumpFile::writeUint16BE怎么用?C++ DumpFile::writeUint16BE使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::DumpFile
的用法示例。
在下文中一共展示了DumpFile::writeUint16BE方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cacheFontData
bool BdfFont::cacheFontData(const BdfFont &font, const Common::String &filename) {
Common::DumpFile cacheFile;
if (!cacheFile.open(filename)) {
warning("BdfFont::cacheFontData: Couldn't open file '%s' for writing", filename.c_str());
return false;
}
const BdfFontData &data = font._data;
cacheFile.writeUint32BE(BDF_FONTCACHE_TAG);
cacheFile.writeUint32BE(BDF_FONTCACHE_VERSION);
cacheFile.writeUint16BE(data.maxAdvance);
cacheFile.writeByte(data.height);
cacheFile.writeByte(data.defaultBox.width);
cacheFile.writeByte(data.defaultBox.height);
cacheFile.writeSByte(data.defaultBox.xOffset);
cacheFile.writeSByte(data.defaultBox.yOffset);
cacheFile.writeByte(data.ascent);
cacheFile.writeUint16BE(data.firstCharacter);
cacheFile.writeSint16BE(data.defaultCharacter);
cacheFile.writeUint16BE(data.numCharacters);
for (int i = 0; i < data.numCharacters; ++i) {
const BdfBoundingBox &box = data.boxes ? data.boxes[i] : data.defaultBox;
if (data.bitmaps[i]) {
const int bytes = ((box.width + 7) / 8) * box.height;
cacheFile.writeUint32BE(bytes);
cacheFile.write(data.bitmaps[i], bytes);
} else {
cacheFile.writeUint32BE(0);
}
}
if (data.advances) {
cacheFile.writeByte(0xFF);
cacheFile.write(data.advances, data.numCharacters);
} else {
cacheFile.writeByte(0x00);
}
if (data.boxes) {
cacheFile.writeByte(0xFF);
for (int i = 0; i < data.numCharacters; ++i) {
const BdfBoundingBox &box = data.boxes[i];
cacheFile.writeByte(box.width);
cacheFile.writeByte(box.height);
cacheFile.writeSByte(box.xOffset);
cacheFile.writeSByte(box.yOffset);
}
} else {
cacheFile.writeByte(0x00);
}
return !cacheFile.err();
}
示例2: cacheFontData
bool NewFont::cacheFontData(const NewFont &font, const Common::String &filename) {
Common::DumpFile cacheFile;
if (!cacheFile.open(filename)) {
warning("Couldn't open file '%s' for writing", filename.c_str());
return false;
}
cacheFile.writeUint16BE(font.desc.maxwidth);
cacheFile.writeUint16BE(font.desc.height);
cacheFile.writeUint16BE(font.desc.fbbw);
cacheFile.writeUint16BE(font.desc.fbbh);
cacheFile.writeSint16BE(font.desc.fbbx);
cacheFile.writeSint16BE(font.desc.fbby);
cacheFile.writeUint16BE(font.desc.ascent);
cacheFile.writeUint16BE(font.desc.firstchar);
cacheFile.writeUint16BE(font.desc.size);
cacheFile.writeUint16BE(font.desc.defaultchar);
cacheFile.writeUint32BE(font.desc.bits_size);
for (long i = 0; i < font.desc.bits_size; ++i) {
cacheFile.writeUint16BE(font.desc.bits[i]);
}
if (font.desc.offset) {
cacheFile.writeByte(1);
for (int i = 0; i < font.desc.size; ++i) {
cacheFile.writeUint32BE(font.desc.offset[i]);
}
} else {
cacheFile.writeByte(0);
}
if (font.desc.width) {
cacheFile.writeByte(1);
for (int i = 0; i < font.desc.size; ++i) {
cacheFile.writeByte(font.desc.width[i]);
}
} else {
cacheFile.writeByte(0);
}
if (font.desc.bbx) {
cacheFile.writeByte(1);
for (int i = 0; i < font.desc.size; ++i) {
cacheFile.writeByte(font.desc.bbx[i].w);
cacheFile.writeByte(font.desc.bbx[i].h);
cacheFile.writeByte(font.desc.bbx[i].x);
cacheFile.writeByte(font.desc.bbx[i].y);
}
} else {
cacheFile.writeByte(0);
}
return !cacheFile.err();
}