17#include "nanosvgrast.h"
21 const size_t max_thumb_size,
26 NSVGimage *image = nsvgParseFromFile(filepath,
"px", 96.0f);
28 if (image ==
nullptr) {
32 if (image->width == 0 || image->height == 0) {
37 int w =
int(image->width);
38 int h =
int(image->height);
42 *r_height = size_t(h);
44 NSVGrasterizer *rast = nsvgCreateRasterizer();
45 if (rast ==
nullptr) {
52 const float scale =
float(max_thumb_size) / std::max(
w, h);
53 const int dest_w = std::max(
int(
w * scale), 1);
54 const int dest_h = std::max(
int(h * scale), 1);
57 if (ibuf !=
nullptr) {
58 nsvgRasterize(rast, image, 0, 0, scale, ibuf->
byte_buffer.
data, dest_w, dest_h, dest_w * 4);
59 nsvgDeleteRasterizer(rast);
@ COLOR_ROLE_DEFAULT_BYTE
void IMB_flipy(ImBuf *ibuf)
Contains defines and structs used throughout the imbuf module.
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
void colorspace_set_default_role(char *colorspace, int size, int role)
draw_view in_light_buf[] float
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
struct ImBuf * IMB_allocImBuf(unsigned int, unsigned int, unsigned char, unsigned int)
ImBufByteBuffer byte_buffer