diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/c_fl.cpp | 8 | ||||
-rw-r--r-- | src/c_fl.h | 3 | ||||
-rw-r--r-- | src/fltk.adb | 22 | ||||
-rw-r--r-- | src/fltk.ads | 7 |
4 files changed, 39 insertions, 1 deletions
diff --git a/src/c_fl.cpp b/src/c_fl.cpp index 1e8fd1c..50eed9e 100644 --- a/src/c_fl.cpp +++ b/src/c_fl.cpp @@ -4,6 +4,7 @@ // Released into the public domain +#include <FL/Enumerations.H> #include <FL/Fl.H> #include "c_fl.h" @@ -22,6 +23,13 @@ size_t c_pointer_size() { +unsigned int fl_enum_rgb_color(unsigned char r, unsigned char g, unsigned char b) { + return fl_rgb_color(r, g, b); +} + + + + int fl_abi_check(int v) { return Fl::abi_check(v); } @@ -14,6 +14,9 @@ extern "C" const short fl_mod_command; extern "C" size_t c_pointer_size(); +extern "C" unsigned int fl_enum_rgb_color(unsigned char r, unsigned char g, unsigned char b); + + extern "C" int fl_abi_check(int v); extern "C" int fl_abi_version(); extern "C" int fl_api_version(); diff --git a/src/fltk.adb b/src/fltk.adb index 61491d9..f302b47 100644 --- a/src/fltk.adb +++ b/src/fltk.adb @@ -17,6 +17,15 @@ use type package body FLTK is + function fl_enum_rgb_color + (R, G, B : in Interfaces.C.unsigned_char) + return Interfaces.C.unsigned; + pragma Import (C, fl_enum_rgb_color, "fl_enum_rgb_color"); + pragma Inline (fl_enum_rgb_color); + + + + function fl_abi_check (V : in Interfaces.C.int) return Interfaces.C.int; @@ -100,6 +109,19 @@ package body FLTK is + function RGB_Color + (R, G, B : in Color_Component) + return Color is + begin + return Color (fl_enum_rgb_color + (Interfaces.C.unsigned_char (R), + Interfaces.C.unsigned_char (G), + Interfaces.C.unsigned_char (B))); + end RGB_Color; + + + + function Press (Key : in Pressable_Key) return Keypress is diff --git a/src/fltk.ads b/src/fltk.ads index f6b7292..785ad23 100644 --- a/src/fltk.ads +++ b/src/fltk.ads @@ -44,7 +44,11 @@ package FLTK is type Color_Component is mod 256; type Color_Component_Array is array (Positive range <>) of aliased Color_Component; - -- Examples of RGB colors + function RGB_Color + (R, G, B : in Color_Component) + return Color; + + -- Examples of RGB colors without the above function -- The lowest byte has to be 00 for the color to be RGB RGB_Red_Color : constant Color := 16#ff000000#; RGB_Green_Color : constant Color := 16#00ff0000#; @@ -423,6 +427,7 @@ private for Color_Component_Array'Component_Size use Interfaces.C.CHAR_BIT; pragma Convention (C, Color_Component_Array); + pragma Pack (Color_Component_Array); |