diff options
author | Jedidiah Barber <contact@jedbarber.id.au> | 2024-12-23 17:02:34 +1300 |
---|---|---|
committer | Jedidiah Barber <contact@jedbarber.id.au> | 2024-12-23 17:02:34 +1300 |
commit | b3f9e96403aa5cb9d7db2330aa579356d1d58b6f (patch) | |
tree | a2f6b68e3582b128e3a7e475757696f156084962 /src/fltk-devices-surface-copy.adb | |
parent | db014c7a249b319e40052f2cff6305b0d09d7ca5 (diff) |
Tweaked the names of Surface_Device subhierarchy
Diffstat (limited to 'src/fltk-devices-surface-copy.adb')
-rw-r--r-- | src/fltk-devices-surface-copy.adb | 156 |
1 files changed, 156 insertions, 0 deletions
diff --git a/src/fltk-devices-surface-copy.adb b/src/fltk-devices-surface-copy.adb new file mode 100644 index 0000000..fe96f91 --- /dev/null +++ b/src/fltk-devices-surface-copy.adb @@ -0,0 +1,156 @@ + + +-- Programmed by Jedidiah Barber +-- Released into the public domain + + +with + + Interfaces.C; + + +package body FLTK.Devices.Surface.Copy is + + + function new_fl_copy_surface + (W, H : in Interfaces.C.int) + return Storage.Integer_Address; + pragma Import (C, new_fl_copy_surface, "new_fl_copy_surface"); + pragma Inline (new_fl_copy_surface); + + procedure free_fl_copy_surface + (S : in Storage.Integer_Address); + pragma Import (C, free_fl_copy_surface, "free_fl_copy_surface"); + pragma Inline (free_fl_copy_surface); + + + + + function fl_copy_surface_get_w + (S : in Storage.Integer_Address) + return Interfaces.C.int; + pragma Import (C, fl_copy_surface_get_w, "fl_copy_surface_get_w"); + pragma Inline (fl_copy_surface_get_w); + + function fl_copy_surface_get_h + (S : in Storage.Integer_Address) + return Interfaces.C.int; + pragma Import (C, fl_copy_surface_get_h, "fl_copy_surface_get_h"); + pragma Inline (fl_copy_surface_get_h); + + + + + procedure fl_copy_surface_draw + (S, W : in Storage.Integer_Address; + OX, OY : in Interfaces.C.int); + pragma Import (C, fl_copy_surface_draw, "fl_copy_surface_draw"); + pragma Inline (fl_copy_surface_draw); + + procedure fl_copy_surface_draw_decorated_window + (S, W : in Storage.Integer_Address; + OX, OY : in Interfaces.C.int); + pragma Import (C, fl_copy_surface_draw_decorated_window, + "fl_copy_surface_draw_decorated_window"); + pragma Inline (fl_copy_surface_draw_decorated_window); + + + + + procedure fl_copy_surface_set_current + (S : in Storage.Integer_Address); + pragma Import (C, fl_copy_surface_set_current, "fl_copy_surface_set_current"); + pragma Inline (fl_copy_surface_set_current); + + + + + procedure Finalize + (This : in out Copy_Surface) is + begin + if This.Void_Ptr /= Null_Pointer and This.Needs_Dealloc then + free_fl_copy_surface (This.Void_Ptr); + This.Void_Ptr := Null_Pointer; + end if; + end Finalize; + + + + + package body Forge is + + function Create + (W, H : in Natural) + return Copy_Surface is + begin + return This : Copy_Surface do + This.Void_Ptr := new_fl_copy_surface + (Interfaces.C.int (W), + Interfaces.C.int (H)); + end return; + end Create; + + pragma Inline (Create); + + end Forge; + + + + + function Get_W + (This : in Copy_Surface) + return Integer is + begin + return Integer (fl_copy_surface_get_w (This.Void_Ptr)); + end Get_W; + + + function Get_H + (This : in Copy_Surface) + return Integer is + begin + return Integer (fl_copy_surface_get_h (This.Void_Ptr)); + end Get_H; + + + + + procedure Draw_Widget + (This : in out Copy_Surface; + Item : in FLTK.Widgets.Widget'Class; + Offset_X, Offset_Y : in Integer := 0) is + begin + fl_copy_surface_draw + (This.Void_Ptr, + Wrapper (Item).Void_Ptr, + Interfaces.C.int (Offset_X), + Interfaces.C.int (Offset_Y)); + end Draw_Widget; + + + procedure Draw_Decorated_Window + (This : in out Copy_Surface; + Item : in FLTK.Widgets.Groups.Windows.Window'Class; + Offset_X, Offset_Y : in Integer := 0) is + begin + fl_copy_surface_draw_decorated_window + (This.Void_Ptr, + Wrapper (Item).Void_Ptr, + Interfaces.C.int (Offset_X), + Interfaces.C.int (Offset_Y)); + end Draw_Decorated_Window; + + + + + procedure Set_Current + (This : in out Copy_Surface) is + begin + fl_copy_surface_set_current (This.Void_Ptr); + Current_Ptr := This'Unchecked_Access; + end Set_Current; + + +end FLTK.Devices.Surface.Copy; + + |