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

emit_sof() private method

Emit a SOF marker
private emit_sof ( JPEG_MARKER code ) : void
code JPEG_MARKER
return void
        private void emit_sof(JPEG_MARKER code)
        {
            emit_marker(code);

            emit_2bytes(3 * m_cinfo.m_num_components + 2 + 5 + 1); /* length */

            /* Make sure image isn't bigger than SOF field can handle */
            if (m_cinfo.jpeg_height > 65535 || m_cinfo.jpeg_width > 65535)
                m_cinfo.ERREXIT(J_MESSAGE_CODE.JERR_IMAGE_TOO_BIG, 65535);

            emit_byte(m_cinfo.m_data_precision);
            emit_2bytes(m_cinfo.jpeg_height);
            emit_2bytes(m_cinfo.jpeg_width);

            emit_byte(m_cinfo.m_num_components);

            for (int ci = 0; ci < m_cinfo.m_num_components; ci++)
            {
                jpeg_component_info componentInfo = m_cinfo.Component_info[ci];
                emit_byte(componentInfo.Component_id);
                emit_byte((componentInfo.H_samp_factor << 4) + componentInfo.V_samp_factor);
                emit_byte(componentInfo.Quant_tbl_no);
            }
        }