OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::png Namespace Reference

Classes

struct  PNGDescr
struct  IStream
struct  Image
struct  ImageColorscale
struct  ReadBuf
struct  ReadBufStream

Typedefs

using ImageGreyscale = Image<uint8_t>

Functions

bool is_png (const ReadBuf &rb)
static void png_read_callback (png_struct *png_ptr, png_bytep outBytes, png_size_t byteCountToRead)
static bool png_read_header_guarded (png_struct *png, png_info *info, IStream *in_buf, int sig_bytes)
static bool png_read_rows_guarded (png_struct *png, png_info *info, png_bytep dst, size_t rows, size_t rowbytes, bool bottom_up, bool read_end)
bool decode_png (IStream &in_buf, ImageGreyscale &out_img)
bool decode_colored_png (IStream &in_buf, ImageColorscale &out_img)
bool decode_colored_png (const ReadBuf &in_buf, ImageColorscale &out_img)
bool is_decodable_8bit_png (const ReadBuf &pngbuf)
static bool write_rgb_or_gray_to_file (const char *file_name_utf8, size_t width, size_t height, int png_color_type, const uint8_t *data)
bool write_rgb_to_file (const char *file_name_utf8, size_t width, size_t height, const uint8_t *data_rgb)
bool write_rgb_to_file (const std::string &file_name_utf8, size_t width, size_t height, const uint8_t *data_rgb)
bool write_rgb_to_file (const std::string &file_name_utf8, size_t width, size_t height, const std::vector< uint8_t > &data_rgb)
bool write_gray_to_file (const char *file_name_utf8, size_t width, size_t height, const uint8_t *data_gray)
bool write_gray_to_file (const std::string &file_name_utf8, size_t width, size_t height, const uint8_t *data_gray)
bool write_gray_to_file (const std::string &file_name_utf8, size_t width, size_t height, const std::vector< uint8_t > &data_gray)
static bool write_rgb_or_gray_to_file_scaled (const char *file_name_utf8, size_t width, size_t height, int png_color_type, const uint8_t *data, size_t scale)
bool write_rgb_to_file_scaled (const char *file_name_utf8, size_t width, size_t height, const uint8_t *data_rgb, size_t scale)
bool write_rgb_to_file_scaled (const std::string &file_name_utf8, size_t width, size_t height, const uint8_t *data_rgb, size_t scale)
bool write_rgb_to_file_scaled (const std::string &file_name_utf8, size_t width, size_t height, const std::vector< uint8_t > &data_rgb, size_t scale)
bool write_gray_to_file_scaled (const char *file_name_utf8, size_t width, size_t height, const uint8_t *data_gray, size_t scale)
bool write_gray_to_file_scaled (const std::string &file_name_utf8, size_t width, size_t height, const uint8_t *data_gray, size_t scale)
bool write_gray_to_file_scaled (const std::string &file_name_utf8, size_t width, size_t height, const std::vector< uint8_t > &data_gray, size_t scale)
template<class Img>
bool decode_png (const ReadBuf &in_buf, Img &out_img)

Class Documentation

◆ Slic3r::png::ReadBuf

struct Slic3r::png::ReadBuf
Class Members
const void * buf = nullptr
const size_t sz = 0

Typedef Documentation

◆ ImageGreyscale

Function Documentation

◆ decode_colored_png() [1/2]

bool Slic3r::png::decode_colored_png ( const ReadBuf & in_buf,
ImageColorscale & out_img )
208{
209 struct ReadBufStream stream{in_buf};
210
211 return decode_colored_png(stream, out_img);
212}
bool decode_colored_png(IStream &in_buf, ImageColorscale &out_img)
Definition PNGReadWrite.cpp:137
Definition PNGReadWrite.hpp:56

References decode_colored_png().

Here is the call graph for this function:

◆ decode_colored_png() [2/2]

bool Slic3r::png::decode_colored_png ( IStream & in_buf,
ImageColorscale & out_img )
138{
139 static const constexpr int PNG_SIG_BYTES = 8;
140
141 std::vector<png_byte> sig(PNG_SIG_BYTES, 0);
142 in_buf.read(sig.data(), PNG_SIG_BYTES);
143 if (!png_check_sig(sig.data(), PNG_SIG_BYTES)) {
144 BOOST_LOG_TRIVIAL(error) << boost::format("decode_colored_png: png_check_sig failed");
145 return false;
146 }
147
148 PNGDescr dsc;
149 dsc.png = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr,
150 nullptr);
151
152 if(!dsc.png) {
153 BOOST_LOG_TRIVIAL(error) << boost::format("decode_colored_png: png_create_read_struct failed");
154 return false;
155 }
156
157 dsc.info = png_create_info_struct(dsc.png);
158 if(!dsc.info) {
159 BOOST_LOG_TRIVIAL(error) << boost::format("decode_colored_png: png_create_info_struct failed");
160 png_destroy_read_struct(&dsc.png, &dsc.info, NULL);
161 return false;
162 }
163
164 if (!png_read_header_guarded(dsc.png, dsc.info, &in_buf, PNG_SIG_BYTES)) {
165 BOOST_LOG_TRIVIAL(error) << "decode_colored_png: corrupt or truncated PNG data";
166 return false;
167 }
168
169 out_img.cols = png_get_image_width(dsc.png, dsc.info);
170 out_img.rows = png_get_image_height(dsc.png, dsc.info);
171 size_t color_type = png_get_color_type(dsc.png, dsc.info);
172 size_t bit_depth = png_get_bit_depth(dsc.png, dsc.info);
173 unsigned long rowbytes = png_get_rowbytes(dsc.png, dsc.info);
174
175 switch(color_type)
176 {
177 case PNG_COLOR_TYPE_RGB:
178 out_img.bytes_per_pixel = 3;
179 break;
180 case PNG_COLOR_TYPE_RGB_ALPHA:
181 out_img.bytes_per_pixel = 4;
182 break;
183 default: //not supported currently
184 png_destroy_read_struct(&dsc.png, &dsc.info, NULL);
185 return false;
186 }
187
188 BOOST_LOG_TRIVIAL(info) << boost::format("png's cols %1%, rows %2%, color_type %3%, bit_depth %4%, bytes_per_pixel %5%, rowbytes %6%")%out_img.cols %out_img.rows %color_type %bit_depth %out_img.bytes_per_pixel %rowbytes;
189 out_img.buf.resize(out_img.rows * rowbytes);
190
191 int filter_type = png_get_filter_type(dsc.png, dsc.info);
192 int compression_type = png_get_compression_type(dsc.png, dsc.info);
193 int interlace_type = png_get_interlace_type(dsc.png, dsc.info);
194 BOOST_LOG_TRIVIAL(info) << boost::format("filter_type %1%, compression_type %2%, interlace_type %3%, rowbytes %4%")%filter_type %compression_type %interlace_type %rowbytes;
195
196 if (!png_read_rows_guarded(dsc.png, dsc.info, static_cast<png_bytep>(out_img.buf.data()), out_img.rows, rowbytes,
197 /* bottom_up */ true, /* read_end */ true)) {
198 BOOST_LOG_TRIVIAL(error) << "decode_colored_png: corrupt or truncated PNG data";
199 return false;
200 }
201
202 png_destroy_read_struct(&dsc.png, &dsc.info, NULL);
203
204 return true;
205}
static bool png_read_rows_guarded(png_struct *png, png_info *info, png_bytep dst, size_t rows, size_t rowbytes, bool bottom_up, bool read_end)
Definition PNGReadWrite.cpp:89
static bool png_read_header_guarded(png_struct *png, png_info *info, IStream *in_buf, int sig_bytes)
Definition PNGReadWrite.cpp:76
virtual size_t read(std::uint8_t *outp, size_t amount)=0
int bytes_per_pixel
Definition PNGReadWrite.hpp:31
size_t rows
Definition PNGReadWrite.hpp:24
std::vector< PxT > buf
Definition PNGReadWrite.hpp:23
size_t cols
Definition PNGReadWrite.hpp:24

References Slic3r::png::Image< PxT >::buf, Slic3r::png::ImageColorscale::bytes_per_pixel, Slic3r::png::Image< PxT >::cols, Slic3r::png::PNGDescr::info, Slic3r::png::PNGDescr::png, png_read_header_guarded(), png_read_rows_guarded(), Slic3r::png::IStream::read(), and Slic3r::png::Image< PxT >::rows.

Referenced by decode_colored_png(), Slic3r::decode_height_texture(), and decode_png_to_thumbnail().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ decode_png() [1/2]

template<class Img>
bool Slic3r::png::decode_png ( const ReadBuf & in_buf,
Img & out_img )
77{
78 struct ReadBufStream stream{in_buf};
79
80 return decode_png(stream, out_img);
81}
bool decode_png(IStream &in_buf, ImageGreyscale &out_img)
Definition PNGReadWrite.cpp:102

References decode_png().

Here is the call graph for this function:

◆ decode_png() [2/2]

bool Slic3r::png::decode_png ( IStream & in_buf,
ImageGreyscale & out_img )
103{
104 static const constexpr int PNG_SIG_BYTES = 8;
105
106 std::vector<png_byte> sig(PNG_SIG_BYTES, 0);
107 in_buf.read(sig.data(), PNG_SIG_BYTES);
108 if (!png_check_sig(sig.data(), PNG_SIG_BYTES))
109 return false;
110
111 PNGDescr dsc;
112 dsc.png = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr,
113 nullptr);
114
115 if(!dsc.png) return false;
116
117 dsc.info = png_create_info_struct(dsc.png);
118 if(!dsc.info) return false;
119
120 if (!png_read_header_guarded(dsc.png, dsc.info, &in_buf, PNG_SIG_BYTES))
121 return false;
122
123 out_img.cols = png_get_image_width(dsc.png, dsc.info);
124 out_img.rows = png_get_image_height(dsc.png, dsc.info);
125 size_t color_type = png_get_color_type(dsc.png, dsc.info);
126 size_t bit_depth = png_get_bit_depth(dsc.png, dsc.info);
127
128 if (color_type != PNG_COLOR_TYPE_GRAY || bit_depth != 8)
129 return false;
130
131 out_img.buf.resize(out_img.rows * out_img.cols);
132
133 return png_read_rows_guarded(dsc.png, dsc.info, static_cast<png_bytep>(out_img.buf.data()), out_img.rows,
134 out_img.cols, /* bottom_up */ false, /* read_end */ false);
135}
Definition PNGReadWrite.cpp:20
png_struct * png
Definition PNGReadWrite.cpp:21
png_info * info
Definition PNGReadWrite.cpp:21

References Slic3r::png::Image< PxT >::buf, Slic3r::png::Image< PxT >::cols, Slic3r::png::PNGDescr::info, Slic3r::png::PNGDescr::png, png_read_header_guarded(), png_read_rows_guarded(), Slic3r::png::IStream::read(), and Slic3r::png::Image< PxT >::rows.

Referenced by Slic3r::decode_height_texture(), decode_png(), and Slic3r::anonymous_namespace{SL1.cpp}::extract_slices_from_sla_archive().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_decodable_8bit_png()

bool Slic3r::png::is_decodable_8bit_png ( const ReadBuf & pngbuf)
215{
216 static const constexpr int PNG_SIG_BYTES = 8;
217
218 struct ReadBufStream stream{pngbuf};
219 std::vector<png_byte> sig(PNG_SIG_BYTES, 0);
220 stream.read(sig.data(), PNG_SIG_BYTES);
221 if (!png_check_sig(sig.data(), PNG_SIG_BYTES))
222 return false;
223
224 PNGDescr dsc;
225 dsc.png = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
226 if (!dsc.png)
227 return false;
228 dsc.info = png_create_info_struct(dsc.png);
229 if (!dsc.info)
230 return false;
231
232 if (!png_read_header_guarded(dsc.png, dsc.info, &stream, PNG_SIG_BYTES))
233 return false;
234
235 const size_t color_type = png_get_color_type(dsc.png, dsc.info);
236 const size_t bit_depth = png_get_bit_depth(dsc.png, dsc.info);
237 const bool grey = color_type == PNG_COLOR_TYPE_GRAY;
238 const bool colour = color_type == PNG_COLOR_TYPE_RGB || color_type == PNG_COLOR_TYPE_RGB_ALPHA;
239 return png_get_image_width(dsc.png, dsc.info) > 0 && png_get_image_height(dsc.png, dsc.info) > 0 &&
240 bit_depth == 8 && (grey || colour);
241}

References Slic3r::png::PNGDescr::info, Slic3r::png::PNGDescr::png, png_read_header_guarded(), and Slic3r::png::ReadBufStream::read().

Referenced by Slic3r::GUI::anonymous_namespace{TextureLibrary.cpp}::is_supported_height_map().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_png()

bool Slic3r::png::is_png ( const ReadBuf & rb)
37{
38 static const constexpr int PNG_SIG_BYTES = 8;
39
40#if PNG_LIBPNG_VER_MINOR <= 2
41 // Earlier libpng versions had png_sig_cmp(png_bytep, ...) which is not
42 // a const pointer. It is not possible to cast away the const qualifier from
43 // the input buffer so... yes... life is challenging...
44 png_byte buf[PNG_SIG_BYTES];
45 auto inbuf = static_cast<const std::uint8_t *>(rb.buf);
46 std::copy(inbuf, inbuf + PNG_SIG_BYTES, buf);
47#else
48 auto buf = static_cast<png_const_bytep>(rb.buf);
49#endif
50
51 return rb.sz >= PNG_SIG_BYTES && !png_sig_cmp(buf, 0, PNG_SIG_BYTES);
52}
const void * buf
Definition PNGReadWrite.hpp:49
const size_t sz
Definition PNGReadWrite.hpp:49

References Slic3r::png::ReadBuf::buf, and Slic3r::png::ReadBuf::sz.

Referenced by Slic3r::decode_height_texture().

Here is the caller graph for this function:

◆ png_read_callback()

void Slic3r::png::png_read_callback ( png_struct * png_ptr,
png_bytep outBytes,
png_size_t byteCountToRead )
static
59{
60 // Retrieve our input buffer through the png_ptr
61 auto reader = static_cast<IStream *>(png_get_io_ptr(png_ptr));
62
63 // libpng expects a short read to be reported through png_error(); returning quietly would leave
64 // it decoding whatever happened to be in outBytes.
65 if (!reader || !reader->is_ok() ||
66 reader->read(static_cast<std::uint8_t *>(outBytes), byteCountToRead) != byteCountToRead)
67 png_error(png_ptr, "PNG data is truncated");
68}
Definition PNGReadWrite.hpp:14

Referenced by png_read_header_guarded().

Here is the caller graph for this function:

◆ png_read_header_guarded()

bool Slic3r::png::png_read_header_guarded ( png_struct * png,
png_info * info,
IStream * in_buf,
int sig_bytes )
static
77{
78 if (setjmp(png_jmpbuf(png)))
79 return false;
80
81 png_set_read_fn(png, static_cast<void *>(in_buf), png_read_callback);
82 // Tell that we have already read the first bytes to check the signature
83 png_set_sig_bytes(png, sig_bytes);
84 png_read_info(png, info);
85 return true;
86}
Definition PNGReadWrite.cpp:18
static void png_read_callback(png_struct *png_ptr, png_bytep outBytes, png_size_t byteCountToRead)
Definition PNGReadWrite.cpp:56

References png_read_callback().

Referenced by decode_colored_png(), decode_png(), and is_decodable_8bit_png().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ png_read_rows_guarded()

bool Slic3r::png::png_read_rows_guarded ( png_struct * png,
png_info * info,
png_bytep dst,
size_t rows,
size_t rowbytes,
bool bottom_up,
bool read_end )
static
91{
92 if (setjmp(png_jmpbuf(png)))
93 return false;
94
95 for (size_t i = 0; i < rows; ++i)
96 png_read_row(png, dst + (bottom_up ? rows - 1 - i : i) * rowbytes, nullptr);
97 if (read_end)
98 png_read_end(png, info);
99 return true;
100}

Referenced by decode_colored_png(), and decode_png().

Here is the caller graph for this function:

◆ write_gray_to_file() [1/3]

bool Slic3r::png::write_gray_to_file ( const char * file_name_utf8,
size_t width,
size_t height,
const uint8_t * data_gray )
342{
343 return write_rgb_or_gray_to_file(file_name_utf8, width, height, PNG_COLOR_TYPE_GRAY, data_gray);
344}
static bool write_rgb_or_gray_to_file(const char *file_name_utf8, size_t width, size_t height, int png_color_type, const uint8_t *data)
Definition PNGReadWrite.cpp:248

References write_rgb_or_gray_to_file().

Referenced by Slic3r::GUI::anonymous_namespace{TextureLibrary.cpp}::encode_gray_png_bytes(), write_gray_to_file(), and write_gray_to_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_gray_to_file() [2/3]

bool Slic3r::png::write_gray_to_file ( const std::string & file_name_utf8,
size_t width,
size_t height,
const std::vector< uint8_t > & data_gray )
352{
353 assert(width * height == data_gray.size());
354 return write_gray_to_file(file_name_utf8.c_str(), width, height, data_gray.data());
355}
bool write_gray_to_file(const char *file_name_utf8, size_t width, size_t height, const uint8_t *data_gray)
Definition PNGReadWrite.cpp:341

References write_gray_to_file().

Here is the call graph for this function:

◆ write_gray_to_file() [3/3]

bool Slic3r::png::write_gray_to_file ( const std::string & file_name_utf8,
size_t width,
size_t height,
const uint8_t * data_gray )
347{
348 return write_gray_to_file(file_name_utf8.c_str(), width, height, data_gray);
349}

References write_gray_to_file().

Here is the call graph for this function:

◆ write_gray_to_file_scaled() [1/3]

bool Slic3r::png::write_gray_to_file_scaled ( const char * file_name_utf8,
size_t width,
size_t height,
const uint8_t * data_gray,
size_t scale )
401{
402 return write_rgb_or_gray_to_file_scaled(file_name_utf8, width, height, PNG_COLOR_TYPE_GRAY, data_gray, scale);
403}
int scale(const int val)
Definition WipeTowerDialog.cpp:58
static bool write_rgb_or_gray_to_file_scaled(const char *file_name_utf8, size_t width, size_t height, int png_color_type, const uint8_t *data, size_t scale)
Definition PNGReadWrite.cpp:360

References scale(), and write_rgb_or_gray_to_file_scaled().

Referenced by Slic3r::SupportGridPattern::SupportGridPattern(), write_gray_to_file_scaled(), and write_gray_to_file_scaled().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_gray_to_file_scaled() [2/3]

bool Slic3r::png::write_gray_to_file_scaled ( const std::string & file_name_utf8,
size_t width,
size_t height,
const std::vector< uint8_t > & data_gray,
size_t scale )
411{
412 assert(width * height == data_gray.size());
413 return write_gray_to_file_scaled(file_name_utf8.c_str(), width, height, data_gray.data(), scale);
414}
bool write_gray_to_file_scaled(const char *file_name_utf8, size_t width, size_t height, const uint8_t *data_gray, size_t scale)
Definition PNGReadWrite.cpp:400

References scale(), and write_gray_to_file_scaled().

Here is the call graph for this function:

◆ write_gray_to_file_scaled() [3/3]

bool Slic3r::png::write_gray_to_file_scaled ( const std::string & file_name_utf8,
size_t width,
size_t height,
const uint8_t * data_gray,
size_t scale )
406{
407 return write_gray_to_file_scaled(file_name_utf8.c_str(), width, height, data_gray, scale);
408}

References scale(), and write_gray_to_file_scaled().

Here is the call graph for this function:

◆ write_rgb_or_gray_to_file()

bool Slic3r::png::write_rgb_or_gray_to_file ( const char * file_name_utf8,
size_t width,
size_t height,
int png_color_type,
const uint8_t * data )
static
249{
250 bool result = false;
251
252 // Forward declaration due to the gotos.
253 png_structp png_ptr = nullptr;
254 png_infop info_ptr = nullptr;
255 png_byte **row_pointers = nullptr;
256
257 FILE *fp = boost::nowide::fopen(file_name_utf8, "wb");
258 if (! fp) {
259 BOOST_LOG_TRIVIAL(error) << "write_png_file: File could not be opened for writing: " << file_name_utf8;
260 goto fopen_failed;
261 }
262
263 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
264 if (! png_ptr) {
265 BOOST_LOG_TRIVIAL(error) << "write_png_file: png_create_write_struct() failed";
266 goto png_create_write_struct_failed;
267 }
268
269 info_ptr = png_create_info_struct(png_ptr);
270 if (! info_ptr) {
271 BOOST_LOG_TRIVIAL(error) << "write_png_file: png_create_info_struct() failed";
272 goto png_create_info_struct_failed;
273 }
274
275 // Set up error handling.
276 if (setjmp(png_jmpbuf(png_ptr))) {
277 BOOST_LOG_TRIVIAL(error) << "write_png_file: setjmp() failed";
278 goto png_failure;
279 }
280
281 // Set image attributes.
282 png_set_IHDR(png_ptr,
283 info_ptr,
284 png_uint_32(width),
285 png_uint_32(height),
286 8, // depth
287 png_color_type,
288 PNG_INTERLACE_NONE,
289 PNG_COMPRESSION_TYPE_DEFAULT,
290 PNG_FILTER_TYPE_DEFAULT);
291
292 // Initialize rows of PNG.
293 row_pointers = reinterpret_cast<png_byte**>(::png_malloc(png_ptr, height * sizeof(png_byte*)));
294 {
295 int line_width = width;
296 if (png_color_type == PNG_COLOR_TYPE_RGB)
297 line_width *= 3;
298 for (size_t y = 0; y < height; ++ y) {
299 auto row = reinterpret_cast<png_byte*>(::png_malloc(png_ptr, line_width));
300 row_pointers[y] = row;
301 memcpy(row, data + line_width * y, line_width);
302 }
303 }
304
305 // Write the image data to "fp".
306 png_init_io(png_ptr, fp);
307 png_set_rows(png_ptr, info_ptr, row_pointers);
308 png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, nullptr);
309
310 for (size_t y = 0; y < height; ++ y)
311 png_free(png_ptr, row_pointers[y]);
312 png_free(png_ptr, row_pointers);
313
314 result = true;
315
316png_failure:
317png_create_info_struct_failed:
318 ::png_destroy_write_struct(&png_ptr, &info_ptr);
319png_create_write_struct_failed:
320 ::fclose(fp);
321fopen_failed:
322 return result;
323}
coord_t width(const BoundingBox &box)
Definition Arrange.cpp:1184
coord_t height(const BoundingBox &box)
Definition Arrange.cpp:1185

Referenced by write_gray_to_file(), write_rgb_or_gray_to_file_scaled(), and write_rgb_to_file().

Here is the caller graph for this function:

◆ write_rgb_or_gray_to_file_scaled()

bool Slic3r::png::write_rgb_or_gray_to_file_scaled ( const char * file_name_utf8,
size_t width,
size_t height,
int png_color_type,
const uint8_t * data,
size_t scale )
static
361{
362 if (scale <= 1)
363 return write_rgb_or_gray_to_file(file_name_utf8, width, height, png_color_type, data);
364 else {
365 size_t pixel_bytes = png_color_type == PNG_COLOR_TYPE_RGB ? 3 : 1;
366 size_t line_width = width * pixel_bytes;
367 std::vector<uint8_t> scaled(line_width * height * scale * scale);
368 uint8_t *dst = scaled.data();
369 for (size_t r = 0; r < height; ++ r) {
370 for (size_t repr = 0; repr < scale; ++ repr) {
371 const uint8_t *row = data + line_width * r;
372 for (size_t c = 0; c < width; ++ c) {
373 for (size_t repc = 0; repc < scale; ++ repc)
374 for (size_t b = 0; b < pixel_bytes; ++ b)
375 *dst ++ = row[b];
376 row += pixel_bytes;
377 }
378 }
379 }
380 return write_rgb_or_gray_to_file(file_name_utf8, width * scale, height * scale, png_color_type, scaled.data());
381 }
382}
BoundingBox scaled(const BoundingBoxf &bb)
Definition BoundingBox.hpp:284

References scale(), Slic3r::scaled(), and write_rgb_or_gray_to_file().

Referenced by write_gray_to_file_scaled(), and write_rgb_to_file_scaled().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_rgb_to_file() [1/3]

bool Slic3r::png::write_rgb_to_file ( const char * file_name_utf8,
size_t width,
size_t height,
const uint8_t * data_rgb )
326{
327 return write_rgb_or_gray_to_file(file_name_utf8, width, height, PNG_COLOR_TYPE_RGB, data_rgb);
328}

References write_rgb_or_gray_to_file().

Referenced by write_rgb_to_file(), and write_rgb_to_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_rgb_to_file() [2/3]

bool Slic3r::png::write_rgb_to_file ( const std::string & file_name_utf8,
size_t width,
size_t height,
const std::vector< uint8_t > & data_rgb )
336{
337 assert(width * height * 3 == data_rgb.size());
338 return write_rgb_to_file(file_name_utf8.c_str(), width, height, data_rgb.data());
339}
bool write_rgb_to_file(const char *file_name_utf8, size_t width, size_t height, const uint8_t *data_rgb)
Definition PNGReadWrite.cpp:325

References write_rgb_to_file().

Here is the call graph for this function:

◆ write_rgb_to_file() [3/3]

bool Slic3r::png::write_rgb_to_file ( const std::string & file_name_utf8,
size_t width,
size_t height,
const uint8_t * data_rgb )
331{
332 return write_rgb_to_file(file_name_utf8.c_str(), width, height, data_rgb);
333}

References write_rgb_to_file().

Here is the call graph for this function:

◆ write_rgb_to_file_scaled() [1/3]

bool Slic3r::png::write_rgb_to_file_scaled ( const char * file_name_utf8,
size_t width,
size_t height,
const uint8_t * data_rgb,
size_t scale )
385{
386 return write_rgb_or_gray_to_file_scaled(file_name_utf8, width, height, PNG_COLOR_TYPE_RGB, data_rgb, scale);
387}

References scale(), and write_rgb_or_gray_to_file_scaled().

Referenced by Slic3r::EdgeGrid::Grid::calculate_sdf(), Slic3r::EdgeGrid::save_png(), write_rgb_to_file_scaled(), and write_rgb_to_file_scaled().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_rgb_to_file_scaled() [2/3]

bool Slic3r::png::write_rgb_to_file_scaled ( const std::string & file_name_utf8,
size_t width,
size_t height,
const std::vector< uint8_t > & data_rgb,
size_t scale )
395{
396 assert(width * height * 3 == data_rgb.size());
397 return write_rgb_to_file_scaled(file_name_utf8.c_str(), width, height, data_rgb.data(), scale);
398}
bool write_rgb_to_file_scaled(const char *file_name_utf8, size_t width, size_t height, const uint8_t *data_rgb, size_t scale)
Definition PNGReadWrite.cpp:384

References scale(), and write_rgb_to_file_scaled().

Here is the call graph for this function:

◆ write_rgb_to_file_scaled() [3/3]

bool Slic3r::png::write_rgb_to_file_scaled ( const std::string & file_name_utf8,
size_t width,
size_t height,
const uint8_t * data_rgb,
size_t scale )
390{
391 return write_rgb_to_file_scaled(file_name_utf8.c_str(), width, height, data_rgb, scale);
392}

References scale(), and write_rgb_to_file_scaled().

Here is the call graph for this function: