public jpeg_calc_output_dimensions ( ) : void | ||
Résultat | void |
private int cur_output_row; /* next row# to write to virtual array */ public bmp_dest_struct(jpeg_decompress_struct cinfo, bool is_os2) { this.cinfo = cinfo; this.is_os2 = is_os2; if (cinfo.Out_color_space == J_COLOR_SPACE.JCS_GRAYSCALE) { m_putGrayRows = true; } else if (cinfo.Out_color_space == J_COLOR_SPACE.JCS_RGB) { if (cinfo.Quantize_colors) m_putGrayRows = true; else m_putGrayRows = false; } else { cinfo.ERREXIT((int)ADDON_MESSAGE_CODE.JERR_BMP_COLORSPACE); } /* Calculate output image dimensions so we can allocate space */ cinfo.jpeg_calc_output_dimensions(); /* Determine width of rows in the BMP file (padded to 4-byte boundary). */ row_width = cinfo.Output_width * cinfo.Output_components; data_width = row_width; while ((row_width & 3) != 0) row_width++; pad_bytes = row_width - data_width; /* Allocate space for inversion array, prepare for write pass */ whole_image = jpeg_common_struct.CreateSamplesArray(row_width, cinfo.Output_height); whole_image.ErrorProcessor = cinfo; cur_output_row = 0; if (cinfo.Progress != null) { cdjpeg_progress_mgr progress = cinfo.Progress as cdjpeg_progress_mgr; if (progress != null) { /* count file input as separate pass */ progress.total_extra_passes++; } } /* Create decompressor output buffer. */ buffer = jpeg_common_struct.AllocJpegSamples(row_width, 1); buffer_height = 1; }