ClanLib  2.3.7
jpeg_compressor.h
Go to the documentation of this file.
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2011 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 */
28 
31 
32 #pragma once
33 
34 #include "../api_display.h"
35 #include "../Image/pixel_buffer.h"
36 #include "../../Core/Text/string_types.h"
37 
38 class CL_IODevice;
39 class CL_JPEGCompressor_Impl;
40 
45 {
48 
49 public:
51 
55 
56 public:
57 
61 
62 public:
64  {
66  rgb,
69  ycck
70  };
71 
73  {
74  marker_rst0 = 0xD0,
75  marker_eoi = 0xD9,
76  marker_app0 = 0xe0,
77  marker_app1 = 0xe1, // EXIF data
78  marker_app2 = 0xe2, // FlashPix Ready data (is that a fancy word for thumbnail?)
79  marker_app3 = 0xe3,
80  marker_app4 = 0xe4,
81  marker_app5 = 0xe5,
82  marker_app6 = 0xe6,
83  marker_app7 = 0xe7,
84  marker_app8 = 0xe8,
85  marker_app9 = 0xe9,
86  marker_app10 = 0xea,
87  marker_app11 = 0xeb,
88  marker_app12 = 0xec,
89  marker_app13 = 0xed,
90  marker_app14 = 0xee,
91  marker_com = 0xfe
92  };
93 
97  void set_output(CL_IODevice output_source);
98 
102  void set_quality(int quality);
103 
108  void set_size(int width, int height);
109 
116  void set_color_space(ColorSpace in_color_space, int in_components, ColorSpace out_color_space, int out_components);
117 
121  void start(bool raw_data = false);
122 
128  void write_marker(int marker, const void * const data, int length);
129 
133  void write_comment_marker(const CL_StringRef &comment);
134 
139  void write_scanlines(const unsigned char **data, unsigned int lines);
140 
145  void write_raw_data(const unsigned char ***data, unsigned int lines);
146 
148  void finish();
149 
153 
154 private:
155  CL_SharedPtr<CL_JPEGCompressor_Impl> impl;
157 };
158