summaryrefslogtreecommitdiff
path: root/body/c_fl_image.cpp
diff options
context:
space:
mode:
authorJedidiah Barber <contact@jedbarber.id.au>2025-01-21 21:04:54 +1300
committerJedidiah Barber <contact@jedbarber.id.au>2025-01-21 21:04:54 +1300
commitb4438b2fbe895694be98e6e8426103deefc51448 (patch)
tree760d86cd7c06420a91dad102cc9546aee73146fc /body/c_fl_image.cpp
parenta4703a65b015140cd4a7a985db66264875ade734 (diff)
Split public API and private implementation files into different directories
Diffstat (limited to 'body/c_fl_image.cpp')
-rw-r--r--body/c_fl_image.cpp142
1 files changed, 142 insertions, 0 deletions
diff --git a/body/c_fl_image.cpp b/body/c_fl_image.cpp
new file mode 100644
index 0000000..328c187
--- /dev/null
+++ b/body/c_fl_image.cpp
@@ -0,0 +1,142 @@
+
+
+// Programmed by Jedidiah Barber
+// Released into the public domain
+
+
+#include <FL/Fl_Image.H>
+#include "c_fl_image.h"
+
+
+
+
+class My_Image : public Fl_Image {
+ public:
+ using Fl_Image::Fl_Image;
+ friend void fl_image_draw_empty(IMAGE i, int x, int y);
+};
+
+
+
+
+IMAGE new_fl_image(int w, int h, int d) {
+ My_Image *i = new My_Image(w, h, d);
+ return i;
+}
+
+void free_fl_image(IMAGE i) {
+ delete static_cast<My_Image*>(i);
+}
+
+
+
+
+int fl_image_get_rgb_scaling() {
+ return Fl_Image::RGB_scaling();
+}
+
+void fl_image_set_rgb_scaling(int t) {
+ Fl_Image::RGB_scaling(static_cast<Fl_RGB_Scaling>(t));
+}
+
+IMAGE fl_image_copy(IMAGE i, int w, int h) {
+ // virtual so disable dispatch
+ return static_cast<Fl_Image*>(i)->Fl_Image::copy(w, h);
+}
+
+IMAGE fl_image_copy2(IMAGE i) {
+ return static_cast<Fl_Image*>(i)->copy();
+}
+
+
+
+
+void fl_image_color_average(IMAGE i, int c, float b) {
+ // virtual so disable dispatch
+ static_cast<Fl_Image*>(i)->Fl_Image::color_average(c, b);
+}
+
+void fl_image_desaturate(IMAGE i) {
+ // virtual so disable dispatch
+ static_cast<Fl_Image*>(i)->Fl_Image::desaturate();
+}
+
+
+
+
+void fl_image_inactive(IMAGE i) {
+ static_cast<Fl_Image*>(i)->inactive();
+}
+
+int fl_image_fail(IMAGE i) {
+ switch (static_cast<Fl_Image*>(i)->fail()) {
+ case Fl_Image::ERR_NO_IMAGE:
+ return 1;
+ case Fl_Image::ERR_FILE_ACCESS:
+ return 2;
+ case Fl_Image::ERR_FORMAT:
+ return 3;
+ default:
+ return 0;
+ }
+}
+
+void fl_image_uncache(IMAGE i) {
+ // virtual so disable dispatch
+ static_cast<Fl_Image*>(i)->Fl_Image::uncache();
+}
+
+
+
+
+int fl_image_w(IMAGE i) {
+ return static_cast<Fl_Image*>(i)->w();
+}
+
+int fl_image_h(IMAGE i) {
+ return static_cast<Fl_Image*>(i)->h();
+}
+
+int fl_image_d(IMAGE i) {
+ return static_cast<Fl_Image*>(i)->d();
+}
+
+int fl_image_ld(IMAGE i) {
+ return static_cast<Fl_Image*>(i)->ld();
+}
+
+int fl_image_count(IMAGE i) {
+ return static_cast<Fl_Image*>(i)->count();
+}
+
+
+
+
+const void * fl_image_data(IMAGE i) {
+ return static_cast<Fl_Image*>(i)->data();
+}
+
+char fl_image_get_pixel(char *c, int off) {
+ return c[off];
+}
+
+void fl_image_set_pixel(char *c, int off, char val) {
+ c[off] = val;
+}
+
+
+
+
+void fl_image_draw(IMAGE i, int x, int y) {
+ static_cast<Fl_Image*>(i)->draw(x, y);
+}
+
+void fl_image_draw2(IMAGE i, int x, int y, int w, int h, int cx, int cy) {
+ // virtual so disable dispatch
+ static_cast<Fl_Image*>(i)->Fl_Image::draw(x, y, w, h, cx, cy);
+}
+
+void fl_image_draw_empty(IMAGE i, int x, int y) {
+ static_cast<My_Image*>(i)->draw_empty(x, y);
+}
+