public TextZone(DjvuReader reader, TextZone parent, TextZone sibling, TextChunk chunkParent) { _parent = parent; _chunkParent = chunkParent; DecodeZoneData(reader, sibling, chunkParent); }
/// <summary> /// Decodes the data for the zone /// </summary> /// <param name="reader"></param> private void DecodeZoneData(DjvuReader reader, TextZone sibling, TextChunk chunkParent) { _zoneType = (ZoneTypes)reader.ReadByte(); _x = reader.ReadUInt16MSB() - 0x8000; _y = reader.ReadUInt16MSB() - 0x8000; _width = reader.ReadUInt16MSB() - 0x8000; _height = reader.ReadUInt16MSB() - 0x8000; _textOffset = reader.ReadUInt16MSB() - 0x8000; _textLength = reader.ReadInt24MSB(); ResolveOffsets(_parent, sibling); _rectangle = new Rectangle(_x, _y, _width, _height); int childrenZones = reader.ReadInt24MSB(); List<TextZone> children = new List<TextZone>(); TextZone childrenSibling = null; for (int x = 0; x < childrenZones; x++) { TextZone newZone = new TextZone(reader, this, childrenSibling, chunkParent); childrenSibling = newZone; children.Add(newZone); } _children = children.ToArray(); }