comparison Core/Images/JpegWriter.cpp @ 1916:5bcf721bde4f

IImageWriter
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 09 Feb 2016 15:26:37 +0100
parents 501769757bf9
children 08ce34cfacad
comparison
equal deleted inserted replaced
1915:7454019be8f3 1916:5bcf721bde4f
109 109
110 quality_ = quality; 110 quality_ = quality;
111 } 111 }
112 112
113 113
114 void JpegWriter::WriteToFile(const char* filename, 114 void JpegWriter::WriteToFileInternal(const std::string& filename,
115 unsigned int width, 115 unsigned int width,
116 unsigned int height, 116 unsigned int height,
117 unsigned int pitch, 117 unsigned int pitch,
118 PixelFormat format, 118 PixelFormat format,
119 const void* buffer) 119 const void* buffer)
120 { 120 {
121 FILE* fp = fopen(filename, "wb"); 121 // TODO This will not work on Windows system if the path contains non-ASCII characters
122 FILE* fp = fopen(filename.c_str(), "wb");
122 if (fp == NULL) 123 if (fp == NULL)
123 { 124 {
124 throw OrthancException(ErrorCode_FullStorage); 125 throw OrthancException(ErrorCode_FullStorage);
125 } 126 }
126 127
154 155
155 fclose(fp); 156 fclose(fp);
156 } 157 }
157 158
158 159
159 void JpegWriter::WriteToMemory(std::string& jpeg, 160 void JpegWriter::WriteToMemoryInternal(std::string& jpeg,
160 unsigned int width, 161 unsigned int width,
161 unsigned int height, 162 unsigned int height,
162 unsigned int pitch, 163 unsigned int pitch,
163 PixelFormat format, 164 PixelFormat format,
164 const void* buffer) 165 const void* buffer)
165 { 166 {
166 std::vector<uint8_t*> lines; 167 std::vector<uint8_t*> lines;
167 GetLines(lines, height, pitch, format, buffer); 168 GetLines(lines, height, pitch, format, buffer);
168 169
169 struct jpeg_compress_struct cinfo; 170 struct jpeg_compress_struct cinfo;