22 void *d_data =
nullptr;
33 void *metadata_obj =
nullptr;
35 void copy_meta(
const Image &img);
125 void draw_pixel(
size_t x,
size_t y, std::vector<double> color);
135 void draw_line(
int x0,
int y0,
int x1,
int y1, std::vector<double> color);
145 void draw_circle(
int x0,
int y0,
int radius, std::vector<double> color,
bool fill =
false);
156 void draw_rectangle(
int x0,
int y0,
int x1,
int y1, std::vector<double> color,
bool fill =
true);
179 int clamp(
int input);
186 double clampf(
double input);
198 int depth()
const {
return d_depth; }
210 size_t width()
const {
return d_width; }
216 size_t height()
const {
return d_height; }
228 size_t size()
const {
return data_size; }
244 void crop(
int x0,
int y0,
int x1,
int y1);
251 void crop(
int x0,
int x1);
279 void mirror(
bool x,
bool y);
339 ((uint16_t *)d_data)[p] = v;
341 ((uint8_t *)d_data)[p] = v;
354 return ((uint16_t *)d_data)[p];
356 return ((uint8_t *)d_data)[p];
369 ((uint16_t *)d_data)[p] = v * (double)d_maxv;
371 ((uint8_t *)d_data)[p] = v * (double)d_maxv;
384 return (
double)((uint16_t *)d_data)[p] / (double)d_maxv;
386 return (
double)((uint8_t *)d_data)[p] / (double)d_maxv;
390 void set(
size_t channel,
size_t p,
int v) {
set(channel * d_width * d_height + p, v); }
391 int get(
size_t channel,
size_t p) {
return get(channel * d_width * d_height + p); }
392 void set(
size_t channel,
size_t x,
size_t y,
int v) {
set(channel * d_width * d_height + y * d_width + x, v); }
393 int get(
size_t channel,
size_t x,
size_t y) {
return get(channel * d_width * d_height + y * d_width + x); }
396 void setf(
size_t channel,
size_t p,
double v) {
setf(channel * d_width * d_height + p, v); }
397 double getf(
size_t channel,
size_t p) {
return getf(channel * d_width * d_height + p); }
398 void setf(
size_t channel,
size_t x,
size_t y,
double v) {
setf(channel * d_width * d_height + y * d_width + x, v); }
399 double getf(
size_t channel,
size_t x,
size_t y) {
return getf(channel * d_width * d_height + y * d_width + x); }
411 void imemcpy(
Image &img1,
size_t pos1,
Image &img2,
size_t pos2,
size_t px_size);
418 void image_to_rgba(
Image &img, uint32_t *output);
425 using namespace satdump::image;
void to_rgb()
Convert this image from B&W to RGB (if it is B&W / RGBA)
Definition image.cpp:127
void resize(int width, int height)
Resize image, using a simple pixel scaling attribution (not the best, but fast)
Definition image.cpp:319
Image()
Init null image, with no data buffer.
Definition image.cpp:13
int typesize() const
Returns image type size (in bytes)
Definition image.h:204
double clampf(double input)
Clamp input value to what this image can handle as float (0, 1)
Definition image.cpp:117
void fill_color(std::vector< double > color)
Fill image with a color.
Definition image.cpp:487
Image resize_to(int width, int height)
Resize image, to another image. Same as resize otherwise.
Definition image.cpp:342
void draw_line(int x0, int y0, int x1, int y1, std::vector< double > color)
Draw a line with Bresenham's algorithm.
Definition image_draw.cpp:96
void mirror(bool x, bool y)
Mirror the image.
Definition image.cpp:278
Image to8bits()
Convert to 8-bits. Returns the current image if it's already 8-bits.
Definition image.cpp:190
Image to_depth(int bit_depth)
Converts to a specific target bit depth.
Definition image.cpp:224
void draw_pixel(size_t x, size_t y, std::vector< double > color)
Set a pixel's color.
Definition image_draw.cpp:87
void draw_circle(int x0, int y0, int radius, std::vector< double > color, bool fill=false)
Draw a circle with Bresenham's Midpoint algorithm.
Definition image_draw.cpp:131
void crop(int x0, int y0, int x1, int y1)
Crop an image region. Must be with x0 <= x1 and y0 <= y1.
Definition image.cpp:232
void fill(int val)
Fill image with a single value.
Definition image.cpp:480
int channels() const
Returns image channel count.
Definition image.h:222
void to_rgba()
Convert this image from to RGBA (if it is B&W / RGB)
Definition image.cpp:149
void * raw_data() const
Returns the RAW void pointer. MUST ONLY BE USED IF YOU KNOW WHAT YOU ARE DOING!
Definition image.h:192
Image to16bits()
Convert to 16-bits. Returns the current image if it's already 16-bits.
Definition image.cpp:207
int maxval() const
Returns image max value.
Definition image.h:234
int clamp(int input)
Clamp input value to what this image can handle.
Definition image.cpp:107
int depth() const
Returns image bit depth.
Definition image.h:198
size_t size() const
Returns image data size.
Definition image.h:228
void resize_bilinear(int width, int height, bool text_mode=false)
Resize image, using a bilinear algorithm.
Definition image.cpp:366
void set(size_t p, int v)
Standard int set. No bound check! Variants to pass a channel index and X / Y position are also availa...
Definition image.h:336
void draw_image(int channel, Image image, int x=0, int y=0)
Draw a B&W Image onto an image channel, or if channel is kept at 0, RGB or RGBA images as well.
Definition image_draw.cpp:8
void init(int bit_depth, size_t width, size_t height, int channels)
Init (empty, filled with zeroes) image buffer.
Definition image.cpp:58
void draw_rectangle(int x0, int y0, int x1, int y1, std::vector< double > color, bool fill=true)
Draw a rectangle onto the image.
Definition image_draw.cpp:200
int get_pixel_bilinear(int channel, double x, double y)
Get a pixel from the image, but with the option to interpolate fractional pixels.
Definition image.cpp:411
int get(size_t p)
Standard int get. No bound check! Variants to pass a channel index and X / Y position are also availa...
Definition image.h:351
void clear()
Delete current buffer (and set size to 0)
Definition image.cpp:90
size_t height() const
Returns image height.
Definition image.h:216
Image crop_to(int x0, int y0, int x1, int y1)
Crop an image region. Must be with x0 <= x1 and y0 <= y1. Provides image as a return value.
Definition image.cpp:259
void draw_image_alpha(Image image, int x=0, int y=0)
Draw an alpha Image onto an image or if channel is kept at 0, RGB or RGBA images as well....
Definition image_draw.cpp:34
size_t width() const
Returns image width.
Definition image.h:210
double getf(size_t p)
Standard float get. No bound check! Variants to pass a channel index and X / Y position are also avai...
Definition image.h:381
void setf(size_t p, double v)
Standard float set. No bound check! Variants to pass a channel index and X / Y position are also avai...
Definition image.h:366