diff options
author | Jed Barber <jjbarber@y7mail.com> | 2017-05-22 12:32:04 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2017-05-22 12:32:04 +1000 |
commit | a504cffaf55d090fea44b4d16e538f77974f842a (patch) | |
tree | 54764e4fa505245d63b63c322ae3339455e9dbe1 /src/fltk-images-bitmaps-xbm.adb | |
parent | 26c270964941639d75d7a4dead0903116e5b62b0 (diff) |
Added XBM Images
Diffstat (limited to 'src/fltk-images-bitmaps-xbm.adb')
-rw-r--r-- | src/fltk-images-bitmaps-xbm.adb | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/fltk-images-bitmaps-xbm.adb b/src/fltk-images-bitmaps-xbm.adb new file mode 100644 index 0000000..2241332 --- /dev/null +++ b/src/fltk-images-bitmaps-xbm.adb @@ -0,0 +1,50 @@ + + +with Interfaces.C; +with System; +use type System.Address; + + +package body FLTK.Images.Bitmaps.XBM is + + + function new_fl_xbm_image + (F : in Interfaces.C.char_array) + return System.Address; + pragma Import (C, new_fl_xbm_image, "new_fl_xbm_image"); + + procedure free_fl_xbm_image + (P : in System.Address); + pragma Import (C, free_fl_xbm_image, "free_fl_xbm_image"); + + + + + overriding procedure Finalize + (This : in out XBM_Image) is + begin + if This.Void_Ptr /= System.Null_Address and then + This in XBM_Image'Class + then + free_fl_xbm_image (This.Void_Ptr); + This.Void_Ptr := System.Null_Address; + end if; + Finalize (Bitmap (This)); + end Finalize; + + + + + function Create + (Filename : in String) + return XBM_Image is + begin + return This : XBM_Image do + This.Void_Ptr := new_fl_xbm_image + (Interfaces.C.To_C (Filename)); + end return; + end Create; + + +end FLTK.Images.Bitmaps.XBM; + |