Esempio n. 1
0
 /** <summary> Constructs the base object data. </summary> */
 internal ObjectData(ObjectDataHeader objectHeader, ChunkHeader chunkHeader)
 {
     this.objectHeader   = objectHeader;
     this.chunkHeader    = chunkHeader;
     this.stringTable    = new StringTable();
     this.groupInfo      = new GroupInfo();
     this.imageDirectory = new ImageDirectory();
     this.graphicsData   = new GraphicsData(this.imageDirectory);
 }
Esempio n. 2
0
        /** <summary> Constructs the default graphics data with the specified image directory. </summary> */
        public GraphicsData(ImageDirectory imageDirectory)
        {
            this.imageDirectory = imageDirectory;

            this.paletteImages = new List <PaletteImage>();
            this.palettes      = new List <Palette>();
            this.numImages     = 0;
            this.numPalettes   = 0;
        }
Esempio n. 3
0
        /** <summary> Returns a palette image loaded from the specified stream. </summary> */
        public static PaletteImage FromStream(Stream stream)
        {
            BinaryReader   reader         = new BinaryReader(stream);
            ImageDirectory imageDirectory = new ImageDirectory();
            GraphicsData   graphicsData   = new GraphicsData(imageDirectory);

            imageDirectory.Read(reader);
            graphicsData.Read(reader);
            reader.Close();
            return(graphicsData.GetPaletteImage(0));
        }
Esempio n. 4
0
        //=========== READING ============
        #region Reading

        /** <summary> Saves the palette image to the specified file path. </summary> */
        public void Save(string path)
        {
            BinaryWriter   writer         = new BinaryWriter(new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write));
            ImageDirectory imageDirectory = new ImageDirectory();
            GraphicsData   graphicsData   = new GraphicsData(imageDirectory);

            graphicsData.Add(this);

            long imageDirectoryPosition = writer.BaseStream.Position;

            imageDirectory.Write(writer);
            graphicsData.Write(writer);
            writer.BaseStream.Position = imageDirectoryPosition;
            imageDirectory.Write(writer);

            writer.Close();
        }