BitMiracle.LibJpeg.Classic.Internal.jpeg_marker_writer.emit_adobe_app14 C# (CSharp) Method

emit_adobe_app14() private method

Emit an Adobe APP14 marker
private emit_adobe_app14 ( ) : void
return void
        private void emit_adobe_app14()
        {
            /*
             * Length of APP14 block    (2 bytes)
             * Block ID         (5 bytes - ASCII "Adobe")
             * Version Number       (2 bytes - currently 100)
             * Flags0           (2 bytes - currently 0)
             * Flags1           (2 bytes - currently 0)
             * Color transform      (1 byte)
             *
             * Although Adobe TN 5116 mentions Version = 101, all the Adobe files
             * now in circulation seem to use Version = 100, so that's what we write.
             *
             * We write the color transform byte as 1 if the JPEG color space is
             * YCbCr, 2 if it's YCCK, 0 otherwise.  Adobe's definition has to do with
             * whether the encoder performed a transformation, which is pretty useless.
             */

            emit_marker(JPEG_MARKER.APP14);

            emit_2bytes(2 + 5 + 2 + 2 + 2 + 1); /* length */

            emit_byte(0x41); /* Identifier: ASCII "Adobe" */
            emit_byte(0x64);
            emit_byte(0x6F);
            emit_byte(0x62);
            emit_byte(0x65);
            emit_2bytes(100);    /* Version */
            emit_2bytes(0);  /* Flags0 */
            emit_2bytes(0);  /* Flags1 */
            switch (m_cinfo.m_jpeg_color_space)
            {
                case J_COLOR_SPACE.JCS_YCbCr:
                    emit_byte(1);    /* Color transform = 1 */
                    break;
                case J_COLOR_SPACE.JCS_YCCK:
                    emit_byte(2);    /* Color transform = 2 */
                    break;
                default:
                    emit_byte(0);    /* Color transform = 0 */
                    break;
            }
        }