本文整理汇总了C++中common::WriteStream::writeUint16BE方法的典型用法代码示例。如果您正苦于以下问题:C++ WriteStream::writeUint16BE方法的具体用法?C++ WriteStream::writeUint16BE怎么用?C++ WriteStream::writeUint16BE使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::WriteStream
的用法示例。
在下文中一共展示了WriteStream::writeUint16BE方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveThumbnail
bool saveThumbnail(Common::WriteStream &out, const Graphics::Surface &thumb) {
if (thumb.format.bytesPerPixel != 2) {
warning("trying to save thumbnail with bpp different than 2");
return false;
}
ThumbnailHeader header;
header.type = MKTAG('T','H','M','B');
header.size = ThumbnailHeaderSize + thumb.w*thumb.h*thumb.format.bytesPerPixel;
header.version = THMB_VERSION;
header.width = thumb.w;
header.height = thumb.h;
header.bpp = thumb.format.bytesPerPixel;
out.writeUint32BE(header.type);
out.writeUint32BE(header.size);
out.writeByte(header.version);
out.writeUint16BE(header.width);
out.writeUint16BE(header.height);
out.writeByte(header.bpp);
// TODO: for later this shouldn't be casted to uint16...
uint16 *pixels = (uint16 *)thumb.pixels;
for (uint16 p = 0; p < thumb.w*thumb.h; ++p, ++pixels)
out.writeUint16BE(*pixels);
return true;
}