summaryrefslogtreecommitdiff
path: root/body/fltk-images-pixmaps-xpm.adb
blob: beeb1d2b20bb6ee1e2eda838e33265f82f2ba7f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71


--  Programmed by Jedidiah Barber
--  Released into the public domain


with

    Interfaces.C;


package body FLTK.Images.Pixmaps.XPM is


    ------------------------
    --  Functions From C  --
    ------------------------

    function new_fl_xpm_image
           (F : in Interfaces.C.char_array)
        return Storage.Integer_Address;
    pragma Import (C, new_fl_xpm_image, "new_fl_xpm_image");
    pragma Inline (new_fl_xpm_image);

    procedure free_fl_xpm_image
           (P : in Storage.Integer_Address);
    pragma Import (C, free_fl_xpm_image, "free_fl_xpm_image");
    pragma Inline (free_fl_xpm_image);




    -------------------
    --  Destructors  --
    -------------------

    overriding procedure Finalize
           (This : in out XPM_Image) is
    begin
        if This.Void_Ptr /= Null_Pointer and This.Needs_Dealloc then
            free_fl_xpm_image (This.Void_Ptr);
            This.Void_Ptr := Null_Pointer;
        end if;
    end Finalize;




    --------------------
    --  Constructors  --
    --------------------

    package body Forge is

        function Create
               (Filename : in String)
            return XPM_Image is
        begin
            return This : XPM_Image do
                This.Void_Ptr := new_fl_xpm_image
                   (Interfaces.C.To_C (Filename));
                Raise_Fail_Errors (This);
            end return;
        end Create;

    end Forge;


end FLTK.Images.Pixmaps.XPM;