Exemplo n.º 1
0
        /**
         * Gets the data for this blip so that it can be written out
         *
         * @return the data for the blip
         */
        public override byte[] getData()
        {
            if (write)
            {
                // Drawing has been specified by API

                // Type on win32
                data[0] = (byte)type.getValue();

                // Type on MacOs
                data[1] = (byte)type.getValue();

                // The blip identifier
                //    IntegerHelper.getTwoBytes(0xfce1, data, 2);

                // Unused tags - 18 bytes
                //    System.Array.Copy(stuff, 0, data, 2, stuff.Length);

                // The size of the file
                IntegerHelper.getFourBytes(imageDataLength + 8 + 17, data, 20);

                // The reference count on the blip
                IntegerHelper.getFourBytes(referenceCount, data, 24);

                // Offset in the delay stream
                IntegerHelper.getFourBytes(0, data, 28);

                // Usage byte
                data[32] = (byte)0;

                // Length of the blip name
                data[33] = (byte)0;

                // Last two bytes unused
                data[34] = (byte)0x7e;
                data[35] = (byte)0x01;

                // The blip itself
                data[36] = (byte)0;
                data[37] = (byte)0x6e;

                // The blip identifier
                IntegerHelper.getTwoBytes(0xf01e, data, 38);

                // The length of the blip.  This is the length of the image file plus
                // 16 bytes
                IntegerHelper.getFourBytes(imageDataLength + 17, data, 40);

                // Unknown stuff
                //    System.Array.Copy(stuff, 0, data, 44, stuff.Length);
            }
            else
            {
                // drawing has been read in
                data = getBytes();
            }

            return(setHeaderData(data));
        }
Exemplo n.º 2
0
        /**
         * Constructor
         *
         * @param d the drawing
         * @exception IOException
         */
        public BlipStoreEntry(Drawing d)
            : base(EscherRecordType.BSE)
        {
            type = BlipType.PNG;
            setVersion(2);
            setInstance(type.getValue());

            byte[] imageData = d.getImageBytes();
            imageDataLength = imageData.Length;
            data            = new byte[imageDataLength + IMAGE_DATA_OFFSET];
            System.Array.Copy(imageData, 0, data, IMAGE_DATA_OFFSET, imageDataLength);
            referenceCount = d.getReferenceCount();
            write          = true;
        }
        /**
         * Constructor
         *
         * @param d the drawing
         * @exception IOException
         */
        public BlipStoreEntry(Drawing d)
            : base(EscherRecordType.BSE)
        {
            type = BlipType.PNG;
            setVersion(2);
            setInstance(type.getValue());

            byte[] imageData = d.getImageBytes();
            imageDataLength = imageData.Length;
            data = new byte[imageDataLength + IMAGE_DATA_OFFSET];
            System.Array.Copy(imageData,0,data,IMAGE_DATA_OFFSET,imageDataLength);
            referenceCount = d.getReferenceCount();
            write = true;
        }