summaryrefslogtreecommitdiff
path: root/src/fltk-images-rgb-pnm.adb
blob: ec325cea48aebcbb386d7f31c9381920828854f0 (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


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;