Example #1
0
        /// <summary>
        /// Used to encode a Bitmap as a JPEG along with a message
        /// </summary>
        public void Encode(byte[] message) {
            //Instantiate a JpegWriter, which has an internal list of bytes 
            //and the logic required to write those to a file
            _jw = new JpegWriter();

            const int fourteenBitMax = 16884;
            int capacity = GetCapacity();

            if (message.Length > fourteenBitMax) {
                throw new ImageCannotContainDataException(message.Length, fourteenBitMax);
            } else if (message.Length > capacity) {
                throw new ImageCannotContainDataException(message.Length, capacity);
            }

            _breakDownMessage(message);

            _writeHeaders();
            _writeScanData();
            _writeEndOfImage();
        }
Example #2
0
        /// <summary>
        /// Used to encode a Bitmap as a JPEG along with a message
        /// </summary>
        public void Encode(byte[] message) {
            if (message.Length > 16884) {
                throw new ArgumentException("Message cannot be longer than 16884 bytes!");
            }
            _breakDownMessage(message);

            _jw = new JpegWriter();
            _writeHeaders();
            _writeScanData();
            _writeEndOfImage();
        }
Example #3
0
        /// <summary>
        /// Used to encode a Bitmap as a JPEG along with a message
        /// </summary>
        public void Encode(byte[] message) {
            //Instantiate a JpegWriter, which has an internal list of bytes 
            //and the logic required to write those to a file
            _jw = new JpegWriter();

            if (message.Length > 16884) {
                throw new ArgumentException("Message cannot be longer than 16884 bytes!");
            }
            _breakDownMessage(message);

            _writeHeaders();
            _writeScanData();
            _writeEndOfImage();
        }