summaryrefslogtreecommitdiff
path: root/src/fltk-images-shared.ads
blob: ff1245757729eec8b8a490de823d446c665c0be3 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153


with

    FLTK.Images.RGB;


package FLTK.Images.Shared is


    -------------
    --  Types  --
    -------------

    type Shared_Image is new Image with private;

    type Shared_Image_Reference (Data : not null access Shared_Image'Class) is
        limited null record with Implicit_Dereference => Data;




    --------------------
    --  Construction  --
    --------------------

    package Forge is

        function Create
               (Filename : in String;
                W, H     : in Integer)
            return Shared_Image;

        function Create
               (From : in FLTK.Images.RGB.RGB_Image'Class)
            return Shared_Image;

        function Find
               (Name : in String;
                W, H : in Integer := 0)
            return Shared_Image;

    end Forge;

    function Copy
           (This          : in Shared_Image;
            Width, Height : in Natural)
        return Shared_Image'Class;

    function Copy
           (This : in Shared_Image)
        return Shared_Image'Class;




    --------------
    --  Colors  --
    --------------

    procedure Color_Average
           (This   : in out Shared_Image;
            Col    : in     Color;
            Amount : in     Blend);

    procedure Desaturate
           (This : in out Shared_Image);




    ----------------
    --  Activity  --
    ----------------

    function Number_Of_Images
        return Natural;

    function Name
           (This : in Shared_Image)
        return String;

    function Original
           (This : in Shared_Image)
        return Boolean;

    function Reference_Count
           (This : in Shared_Image)
        return Natural;

    procedure Reload
           (This : in out Shared_Image);

    procedure Uncache
           (This : in out Shared_Image);




    ---------------
    --  Drawing  --
    ---------------

    procedure Set_Scaling_Algorithm
           (To : in Scaling_Kind);

    procedure Scale
           (This         : in out Shared_Image;
            W, H         : in     Integer;
            Proportional : in     Boolean := True;
            Can_Expand   : in     Boolean := False);

    procedure Draw
           (This       : in Shared_Image;
            X, Y, W, H : in Integer;
            CX, CY     : in Integer := 0);

    procedure Draw
           (This : in Shared_Image;
            X, Y : in Integer);


private


    type Shared_Image is new Image with null record;

    overriding procedure Finalize
           (This : in out Shared_Image);


    pragma Inline (Copy);


    pragma Inline (Color_Average);
    pragma Inline (Desaturate);


    pragma Inline (Number_Of_Images);
    pragma Inline (Name);
    pragma Inline (Original);
    pragma Inline (Reference_Count);
    pragma Inline (Reload);
    pragma Inline (Uncache);


    pragma Inline (Set_Scaling_Algorithm);
    pragma Inline (Scale);
    pragma Inline (Draw);


end FLTK.Images.Shared;