void LYTGroup::writeToDataStream(QDataStream &out) const { WriteFixedLengthASCII(out, name, 0x10); // write the contents out << (quint16)panes.count(); WritePadding(2, out); foreach (LYTPane *pane, panes) { WriteFixedLengthASCII(out, pane->name, 0x10); }
size_t AlignedStream::WriteArray(const void *buffer, size_t elem_size, size_t count) { if (_stream) { WritePadding(elem_size); count = _stream->WriteArray(buffer, elem_size, count); _block += count * elem_size; return count; } return 0; }
size_t AlignedStream::WriteArrayOfInt64(const int64_t *buffer, size_t count) { if (_stream) { WritePadding(sizeof(int64_t)); count = _stream->WriteArrayOfInt64(buffer, count); _block += count * sizeof(int64_t); return count; } return 0; }
size_t AlignedStream::WriteInt64(int64_t val) { if (_stream) { WritePadding(sizeof(int64_t)); size_t size = _stream->WriteInt64(val); _block += sizeof(int64_t); return size; } return 0; }
int32_t AlignedStream::WriteByte(uint8_t b) { if (_stream) { WritePadding(sizeof(uint8_t)); b = _stream->WriteByte(b); _block += sizeof(uint8_t); return b; } return 0; }
size_t AlignedStream::Write(const void *buffer, size_t size) { if (_stream) { WritePadding(sizeof(int8_t)); size = _stream->Write(buffer, size); _block += size; return size; } return 0; }
void AlignedStream::FinalizeBlock() { if (!IsValid()) { return; } // Force the stream to read or write remaining padding to match the alignment if (_mode == kAligned_Read) { ReadPadding(_maxAlignment); } else if (_mode == kAligned_Write) { WritePadding(_maxAlignment); } _maxAlignment = 0; _block = 0; }
void LYTTextBox::writeToDataStream(QDataStream &out) const { LYTPane::writeToDataStream(out); // lengths are stored in bytes (including zero terminator) not characters out << (quint16)((bufferLength + 1) * 2); out << (quint16)((text.length() + 1) * 2); // calculate the material and font numbers int materialNum = m_layout.materials.getIndexOfName(materialName); int fontNum = m_layout.m_fontRefs.indexOf(fontName); out << (quint16)materialNum; out << (quint16)fontNum; out << (quint8)alignment; out << (quint8)alignmentOverride; WritePadding(2, out); out << (quint32)0x74; // fixed offset to textbox contents WriteRGBA8Color(colour1, out); WriteRGBA8Color(colour2, out); out << (float)fontSizeX; out << (float)fontSizeY; out << (float)charSpace; out << (float)lineSpace; // write the textbox contents const ushort *convertedText = text.utf16(); for (int i = 0; i < text.length(); i++) out << (quint16)convertedText[i]; out << (quint16)0; // zeroterm }
void LYTTexCoordGen::writeToDataStream(QDataStream &out) const { out << (quint8)genType; out << (quint8)src; out << (quint8)mtx; WritePadding(1, out); }