00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00031
00032 #pragma once
00033
00034 #include "../api_display.h"
00035 #include "../Image/pixel_buffer.h"
00036 #include "../../Core/Text/string_types.h"
00037
00038 class CL_IODevice;
00039 class CL_JPEGCompressor_Impl;
00040
00044 class CL_API_DISPLAY CL_JPEGCompressor
00045 {
00048
00049 public:
00050 CL_JPEGCompressor();
00051
00055
00056 public:
00057
00061
00062 public:
00063 enum ColorSpace
00064 {
00065 grayscale,
00066 rgb,
00067 ycbcr,
00068 cmyk,
00069 ycck
00070 };
00071
00072 enum SpecialMarker
00073 {
00074 marker_rst0 = 0xD0,
00075 marker_eoi = 0xD9,
00076 marker_app0 = 0xe0,
00077 marker_app1 = 0xe1,
00078 marker_app2 = 0xe2,
00079 marker_app3 = 0xe3,
00080 marker_app4 = 0xe4,
00081 marker_app5 = 0xe5,
00082 marker_app6 = 0xe6,
00083 marker_app7 = 0xe7,
00084 marker_app8 = 0xe8,
00085 marker_app9 = 0xe9,
00086 marker_app10 = 0xea,
00087 marker_app11 = 0xeb,
00088 marker_app12 = 0xec,
00089 marker_app13 = 0xed,
00090 marker_app14 = 0xee,
00091 marker_com = 0xfe
00092 };
00093
00097 void set_output(CL_IODevice output_source);
00098
00102 void set_quality(int quality);
00103
00108 void set_size(int width, int height);
00109
00116 void set_color_space(ColorSpace in_color_space, int in_components, ColorSpace out_color_space, int out_components);
00117
00121 void start(bool raw_data = false);
00122
00128 void write_marker(int marker, const void * const data, int length);
00129
00133 void write_comment_marker(const CL_StringRef &comment);
00134
00139 void write_scanlines(const unsigned char **data, unsigned int lines);
00140
00145 void write_raw_data(const unsigned char ***data, unsigned int lines);
00146
00148 void finish();
00149
00153
00154 private:
00155 CL_SharedPtr<CL_JPEGCompressor_Impl> impl;
00157 };
00158