diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/c_fl_bmp_image.cpp | 16 | ||||
-rw-r--r-- | src/c_fl_bmp_image.h | 15 | ||||
-rw-r--r-- | src/c_fl_jpeg_image.cpp | 16 | ||||
-rw-r--r-- | src/c_fl_jpeg_image.h | 15 | ||||
-rw-r--r-- | src/c_fl_pnm_image.cpp | 16 | ||||
-rw-r--r-- | src/c_fl_pnm_image.h | 15 | ||||
-rw-r--r-- | src/fltk-images-rgb-bmp.adb | 50 | ||||
-rw-r--r-- | src/fltk-images-rgb-bmp.ads | 25 | ||||
-rw-r--r-- | src/fltk-images-rgb-jpeg.adb | 50 | ||||
-rw-r--r-- | src/fltk-images-rgb-jpeg.ads | 25 | ||||
-rw-r--r-- | src/fltk-images-rgb-pnm.adb | 50 | ||||
-rw-r--r-- | src/fltk-images-rgb-pnm.ads | 25 |
12 files changed, 318 insertions, 0 deletions
diff --git a/src/c_fl_bmp_image.cpp b/src/c_fl_bmp_image.cpp new file mode 100644 index 0000000..23ec928 --- /dev/null +++ b/src/c_fl_bmp_image.cpp @@ -0,0 +1,16 @@ + + +#include <FL/Fl_BMP_Image.H> +#include "c_fl_bmp_image.h" + + +BMP_IMAGE new_fl_bmp_image(const char * f) { + Fl_BMP_Image *b = new Fl_BMP_Image(f); + return b; +} + + +void free_fl_bmp_image(BMP_IMAGE b) { + delete reinterpret_cast<Fl_BMP_Image*>(b); +} + diff --git a/src/c_fl_bmp_image.h b/src/c_fl_bmp_image.h new file mode 100644 index 0000000..84e7987 --- /dev/null +++ b/src/c_fl_bmp_image.h @@ -0,0 +1,15 @@ + + +#ifndef FL_BMP_IMAGE_GUARD +#define FL_BMP_IMAGE_GUARD + + +typedef void* BMP_IMAGE; + + +extern "C" BMP_IMAGE new_fl_bmp_image(const char * f); +extern "C" void free_fl_bmp_image(BMP_IMAGE b); + + +#endif + diff --git a/src/c_fl_jpeg_image.cpp b/src/c_fl_jpeg_image.cpp new file mode 100644 index 0000000..763c55f --- /dev/null +++ b/src/c_fl_jpeg_image.cpp @@ -0,0 +1,16 @@ + + +#include <FL/Fl_JPEG_Image.H> +#include "c_fl_jpeg_image.h" + + +JPEG_IMAGE new_fl_jpeg_image(const char * f) { + Fl_JPEG_Image *j = new Fl_JPEG_Image(f); + return j; +} + + +void free_fl_jpeg_image(JPEG_IMAGE j) { + delete reinterpret_cast<Fl_JPEG_Image*>(j); +} + diff --git a/src/c_fl_jpeg_image.h b/src/c_fl_jpeg_image.h new file mode 100644 index 0000000..1086f34 --- /dev/null +++ b/src/c_fl_jpeg_image.h @@ -0,0 +1,15 @@ + + +#ifndef FL_JPEG_IMAGE_GUARD +#define FL_JPEG_IMAGE_GUARD + + +typedef void* JPEG_IMAGE; + + +extern "C" JPEG_IMAGE new_fl_jpeg_image(const char * f); +extern "C" void free_fl_jpeg_image(JPEG_IMAGE j); + + +#endif + diff --git a/src/c_fl_pnm_image.cpp b/src/c_fl_pnm_image.cpp new file mode 100644 index 0000000..ce79413 --- /dev/null +++ b/src/c_fl_pnm_image.cpp @@ -0,0 +1,16 @@ + + +#include <FL/Fl_PNM_Image.H> +#include "c_fl_pnm_image.h" + + +PNM_IMAGE new_fl_pnm_image(const char * f) { + Fl_PNM_Image *p = new Fl_PNM_Image(f); + return p; +} + + +void free_fl_pnm_image(PNM_IMAGE p) { + delete reinterpret_cast<Fl_PNM_Image*>(p); +} + diff --git a/src/c_fl_pnm_image.h b/src/c_fl_pnm_image.h new file mode 100644 index 0000000..cf4eb4c --- /dev/null +++ b/src/c_fl_pnm_image.h @@ -0,0 +1,15 @@ + + +#ifndef FL_PNM_IMAGE_GUARD +#define FL_PNM_IMAGE_GUARD + + +typedef void* PNM_IMAGE; + + +extern "C" PNM_IMAGE new_fl_pnm_image(const char * f); +extern "C" void free_fl_pnm_image(PNM_IMAGE p); + + +#endif + diff --git a/src/fltk-images-rgb-bmp.adb b/src/fltk-images-rgb-bmp.adb new file mode 100644 index 0000000..8d112c8 --- /dev/null +++ b/src/fltk-images-rgb-bmp.adb @@ -0,0 +1,50 @@ + + +with Interfaces.C; +with System; +use type System.Address; + + +package body FLTK.Images.RGB.BMP is + + + function new_fl_bmp_image + (F : in Interfaces.C.char_array) + return System.Address; + pragma Import (C, new_fl_bmp_image, "new_fl_bmp_image"); + + procedure free_fl_bmp_image + (P : in System.Address); + pragma Import (C, free_fl_bmp_image, "free_fl_bmp_image"); + + + + + overriding procedure Finalize + (This : in out BMP_Image) is + begin + if This.Void_Ptr /= System.Null_Address and then + This in BMP_Image'Class + then + free_fl_bmp_image (This.Void_Ptr); + This.Void_Ptr := System.Null_Address; + end if; + Finalize (RGB_Image (This)); + end Finalize; + + + + + function Create + (Filename : in String) + return BMP_Image is + begin + return This : BMP_Image do + This.Void_Ptr := new_fl_bmp_image + (Interfaces.C.To_C (Filename)); + end return; + end Create; + + +end FLTK.Images.RGB.BMP; + diff --git a/src/fltk-images-rgb-bmp.ads b/src/fltk-images-rgb-bmp.ads new file mode 100644 index 0000000..7b9da93 --- /dev/null +++ b/src/fltk-images-rgb-bmp.ads @@ -0,0 +1,25 @@ + + +package FLTK.Images.RGB.BMP is + + + type BMP_Image is new RGB_Image with private; + + + function Create + (Filename : in String) + return BMP_Image; + + +private + + + type BMP_Image is new RGB_Image with null record; + + + overriding procedure Finalize + (This : in out BMP_Image); + + +end FLTK.Images.RGB.BMP; + diff --git a/src/fltk-images-rgb-jpeg.adb b/src/fltk-images-rgb-jpeg.adb new file mode 100644 index 0000000..2cb0e1f --- /dev/null +++ b/src/fltk-images-rgb-jpeg.adb @@ -0,0 +1,50 @@ + + +with Interfaces.C; +with System; +use type System.Address; + + +package body FLTK.Images.RGB.JPEG is + + + function new_fl_jpeg_image + (F : in Interfaces.C.char_array) + return System.Address; + pragma Import (C, new_fl_jpeg_image, "new_fl_jpeg_image"); + + procedure free_fl_jpeg_image + (P : in System.Address); + pragma Import (C, free_fl_jpeg_image, "free_fl_jpeg_image"); + + + + + overriding procedure Finalize + (This : in out JPEG_Image) is + begin + if This.Void_Ptr /= System.Null_Address and then + This in JPEG_Image'Class + then + free_fl_jpeg_image (This.Void_Ptr); + This.Void_Ptr := System.Null_Address; + end if; + Finalize (RGB_Image (This)); + end Finalize; + + + + + function Create + (Filename : in String) + return JPEG_Image is + begin + return This : JPEG_Image do + This.Void_Ptr := new_fl_jpeg_image + (Interfaces.C.To_C (Filename)); + end return; + end Create; + + +end FLTK.Images.RGB.JPEG; + diff --git a/src/fltk-images-rgb-jpeg.ads b/src/fltk-images-rgb-jpeg.ads new file mode 100644 index 0000000..9d06e28 --- /dev/null +++ b/src/fltk-images-rgb-jpeg.ads @@ -0,0 +1,25 @@ + + +package FLTK.Images.RGB.JPEG is + + + type JPEG_Image is new RGB_Image with private; + + + function Create + (Filename : in String) + return JPEG_Image; + + +private + + + type JPEG_Image is new RGB_Image with null record; + + + overriding procedure Finalize + (This : in out JPEG_Image); + + +end FLTK.Images.RGB.JPEG; + diff --git a/src/fltk-images-rgb-pnm.adb b/src/fltk-images-rgb-pnm.adb new file mode 100644 index 0000000..ec325ce --- /dev/null +++ b/src/fltk-images-rgb-pnm.adb @@ -0,0 +1,50 @@ + + +with Interfaces.C; +with System; +use type System.Address; + + +package body FLTK.Images.RGB.PNM is + + + function new_fl_pnm_image + (F : in Interfaces.C.char_array) + return System.Address; + pragma Import (C, new_fl_pnm_image, "new_fl_pnm_image"); + + procedure free_fl_pnm_image + (P : in System.Address); + pragma Import (C, free_fl_pnm_image, "free_fl_pnm_image"); + + + + + overriding procedure Finalize + (This : in out PNM_Image) is + begin + if This.Void_Ptr /= System.Null_Address and then + This in PNM_Image'Class + then + free_fl_pnm_image (This.Void_Ptr); + This.Void_Ptr := System.Null_Address; + end if; + Finalize (RGB_Image (This)); + end Finalize; + + + + + function Create + (Filename : in String) + return PNM_Image is + begin + return This : PNM_Image do + This.Void_Ptr := new_fl_pnm_image + (Interfaces.C.To_C (Filename)); + end return; + end Create; + + +end FLTK.Images.RGB.PNM; + diff --git a/src/fltk-images-rgb-pnm.ads b/src/fltk-images-rgb-pnm.ads new file mode 100644 index 0000000..144dd08 --- /dev/null +++ b/src/fltk-images-rgb-pnm.ads @@ -0,0 +1,25 @@ + + +package FLTK.Images.RGB.PNM is + + + type PNM_Image is new RGB_Image with private; + + + function Create + (Filename : in String) + return PNM_Image; + + +private + + + type PNM_Image is new RGB_Image with null record; + + + overriding procedure Finalize + (This : in out PNM_Image); + + +end FLTK.Images.RGB.PNM; + |