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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
with Interfaces.C;
with System;
use type System.Address;
package body FLTK.Images is
function new_fl_image
(W, H, D : in Interfaces.C.int)
return System.Address;
pragma Import (C, new_fl_image, "new_fl_image");
procedure free_fl_image
(I : in System.Address);
pragma Import (C, free_fl_image, "free_fl_image");
function fl_image_copy
(I : in System.Address;
W, H : in Interfaces.C.int)
return System.Address;
pragma Import (C, fl_image_copy, "fl_image_copy");
function fl_image_copy2
(I : in System.Address)
return System.Address;
pragma Import (C, fl_image_copy2, "fl_image_copy2");
procedure fl_image_color_average
(I : in System.Address;
C : in Interfaces.C.int;
B : in Interfaces.C.C_float);
pragma Import (C, fl_image_color_average, "fl_image_color_average");
procedure fl_image_desaturate
(I : in System.Address);
pragma Import (C, fl_image_desaturate, "fl_image_desaturate");
procedure fl_image_inactive
(I : in System.Address);
pragma Import (C, fl_image_inactive, "fl_image_inactive");
function fl_image_w
(I : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_image_w, "fl_image_w");
function fl_image_h
(I : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_image_h, "fl_image_h");
function fl_image_d
(I : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_image_d, "fl_image_d");
overriding procedure Finalize
(This : in out Image) is
begin
if This.Void_Ptr /= System.Null_Address and then
This in Image'Class
then
free_fl_image (This.Void_Ptr);
This.Void_Ptr := System.Null_Address;
end if;
Finalize (Wrapper (This));
end Finalize;
function Create
(Width, Height, Depth : in Natural)
return Image is
begin
return This : Image do
This.Void_Ptr := new_fl_image
(Interfaces.C.int (Width),
Interfaces.C.int (Height),
Interfaces.C.int (Depth));
end return;
end Create;
function Copy
(This : in Image;
Width, Height : in Natural)
return Image is
begin
return Copied : Image do
Copied.Void_Ptr := fl_image_copy
(This.Void_Ptr,
Interfaces.C.int (Width),
Interfaces.C.int (Height));
end return;
end Copy;
function Copy
(This : in Image)
return Image is
begin
return Copied : Image do
Copied.Void_Ptr := fl_image_copy2 (This.Void_Ptr);
end return;
end Copy;
procedure Color_Average
(This : in out Image;
Col : in Color;
Amount : in Blend) is
begin
fl_image_color_average
(This.Void_Ptr,
Interfaces.C.int (Col),
Interfaces.C.C_float (Amount));
end Color_Average;
procedure Desaturate
(This : in out Image) is
begin
fl_image_desaturate (This.Void_Ptr);
end Desaturate;
procedure Inactive
(This : in out Image) is
begin
fl_image_inactive (This.Void_Ptr);
end Inactive;
function Get_W
(This : in Image)
return Natural is
begin
return Natural (fl_image_w (This.Void_Ptr));
end Get_W;
function Get_H
(This : in Image)
return Natural is
begin
return Natural (fl_image_h (This.Void_Ptr));
end Get_H;
function Get_D
(This : in Image)
return Natural is
begin
return Natural (fl_image_d (This.Void_Ptr));
end Get_D;
end FLTK.Images;
|