summaryrefslogtreecommitdiff
path: root/packages/imlib/src/imlib.pp
blob: 1d574fc80ebb91fefa5ff007b7241e85ac16fe07 (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
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
{

   Imlib library

   Copyright (C) 1998 By The Rasterman (Carsten Haitzler)

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public
   License along with this library; if not, write to the
   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.

 **********************************************************************}
unit Imlib;

interface

{$PACKRECORDS C}
{$mode objfpc}

Uses X, Xlib, XUtil;

const
{$ifndef os2}
  Imlibdll='Imlib';
{$else}
  Imlibdll='Imlib195';
{$endif}

Type
   PImlibBorder = ^TImlibBorder;
   TImlibBorder = record
        left : longint;
        right : longint;
        top : longint;
        bottom : longint;
     end;

   PImlibColor = ^TImlibColor;
   TImlibColor = record
        r : longint;
        g : longint;
        b : longint;
        pixel : longint;
     end;

   PImlibColorModifier = ^TImlibColorModifier;
   TImlibColorModifier = record
        gamma : longint;
        brightness : longint;
        contrast : longint;
     end;

   PImlibImage = ^TImlibImage;
   TImlibImage = record
        rgb_width : longint;
        rgb_height : longint;
        rgb_data : Pbyte;
        alpha_data : Pbyte;
        filename : PChar;
        width : longint;
        height : longint;
        shape_color : TImlibColor;
        border : TImlibBorder;
        pixmap : TPixmap;
        shape_mask : TPixmap;
        cache : char;
        mods : TImlibColorModifier;
        rmod : TImlibColorModifier;
        gmod : TImlibColorModifier;
        bmod : TImlibColorModifier;
        rmap : array[0..255] of byte;
        gmap : array[0..255] of byte;
        bmap : array[0..255] of byte;
     end;

   Pxdata = ^Txdata;
   Txdata = record
        disp : PDisplay;
        screen : longint;
        root : TWindow;
        visual : PVisual;
        depth : longint;
        render_depth : longint;
        root_cmap : TColormap;
        shm : char;
        shmp : char;
        shm_event : longint;
        last_xim : PXImage;
        last_sxim : PXImage;
        last_shminfo : Pointer;//XShmSegmentInfo;
        last_sshminfo :Pointer;//XShmSegmentInfo;
        base_window : TWindow;
        byte_order : longint;
        bit_order : longint;
     end;

   PImlibData = ^TImlibData;
   TImlibData = record
        num_colors : longint;
        palette : PImlibColor;
        palette_orig : PImlibColor;
        fast_rgb : Pbyte;
        fast_err : Plongint;
        fast_erg : Plongint;
        fast_erb : Plongint;
        render_type : longint;
        max_shm : longint;
        x : TXdata;
        byte_order : longint;
        cache : record
             on_image : char;
             size_image : longint;
             num_image : longint;
             used_image : longint;
             image : Pointer;//image_cache;
             on_pixmap : char;
             size_pixmap : longint;
             num_pixmap : longint;
             used_pixmap : longint;
             pixmap : Pointer;//pixmap_cache;
          end;
        fastrend : char;
        hiq : char;
        mods : TImlibColorModifier;
        rmod : TImlibColorModifier;
        gmod : TImlibColorModifier;
        bmod : TImlibColorModifier;
        rmap : array[0..255] of byte;
        gmap : array[0..255] of byte;
        bmap : array[0..255] of byte;
        fallback : char;
        ordered_dither : char;
     end;

   PImlibSaveInfo = ^TImlibSaveInfo;
   TImlibSaveInfo = record
        quality : longint;
        scaling : longint;
        xjustification : longint;
        yjustification : longint;
        page_size : longint;
        color : char;
     end;

   PImlibInitParams = ^TImlibInitParams;
   TImlibInitParams = record
        flags : longint;
        visualid : longint;
        palettefile : Pchar;
        sharedmem : char;
        sharedpixmaps : char;
        paletteoverride : char;
        remap : char;
        fastrender : char;
        hiquality : char;
        dither : char;
        imagecachesize : longint;
        pixmapcachesize : longint;
        cmap : TColormap;
     end;

const
  PARAMS_VISUALID        = 1 shl 0;
  PARAMS_PALETTEFILE     = 1 shl 1;
  PARAMS_SHAREDMEM       = 1 shl 2;
  PARAMS_SHAREDPIXMAPS   = 1 shl 3;
  PARAMS_PALETTEOVERRIDE = 1 shl 4;
  PARAMS_REMAP           = 1 shl 5;
  PARAMS_FASTRENDER      = 1 shl 6;
  PARAMS_HIQUALITY       = 1 shl 7;
  PARAMS_DITHER          = 1 shl 8;
  PARAMS_IMAGECACHESIZE  = 1 shl 9;
  PARAMS_PIXMAPCACHESIZE = 1 shl 10;

  PAGE_SIZE_EXECUTIVE    = 0;
  PAGE_SIZE_LETTER       = 1;
  PAGE_SIZE_LEGAL        = 2;
  PAGE_SIZE_A4           = 3;
  PAGE_SIZE_A3           = 4;
  PAGE_SIZE_A5           = 5;
  PAGE_SIZE_FOLIO        = 6;

  RT_PLAIN_PALETTE       = 0;
  RT_PLAIN_PALETTE_FAST  = 1;
  RT_DITHER_PALETTE      = 2;
  RT_DITHER_PALETTE_FAST = 3;
  RT_PLAIN_TRUECOL       = 4;
  RT_DITHER_TRUECOL      = 5;

function Imlib_init(disp:PDisplay):PImlibData;cdecl;external imlibdll name 'Imlib_init';
function Imlib_init_with_params(disp:PDisplay; p:PImlibInitParams):PImlibData;cdecl;external imlibdll name 'Imlib_init_with_params';
function Imlib_get_render_type(id:PImlibData):longint;cdecl;external imlibdll name 'Imlib_get_render_type';
procedure Imlib_set_render_type(id:PImlibData; rend_type:longint);cdecl;external imlibdll name 'Imlib_set_render_type';
function Imlib_load_colors(id:PImlibData; thefile:Pchar):longint;cdecl;external imlibdll name 'Imlib_load_colors';
function Imlib_load_image(id:PImlibData; thefile:Pchar):PImlibImage;cdecl;external imlibdll name 'Imlib_load_image';
function Imlib_best_color_match(id:PImlibData; r:Plongint; g:Plongint; b:Plongint):longint;cdecl;external imlibdll name 'Imlib_best_color_match';
function Imlib_render(id:PImlibData; image:PImlibImage; width:longint; height:longint):longint;cdecl;external imlibdll name 'Imlib_render';
function Imlib_copy_image(id:PImlibData; image:PImlibImage):TPixmap;cdecl;external imlibdll name 'Imlib_copy_image';
function Imlib_copy_mask(id:PImlibData; image:PImlibImage):TPixmap;cdecl;external imlibdll name 'Imlib_copy_mask';
function Imlib_move_image(id:PImlibData; image:PImlibImage):TPixmap;cdecl;external imlibdll name 'Imlib_move_image';
function Imlib_move_mask(id:PImlibData; image:PImlibImage):TPixmap;cdecl;external imlibdll name 'Imlib_move_mask';
procedure Imlib_destroy_image(id:PImlibData; image:PImlibImage);cdecl;external imlibdll name 'Imlib_destroy_image';
procedure Imlib_kill_image(id:PImlibData; image:PImlibImage);cdecl;external imlibdll name 'Imlib_kill_image';
procedure Imlib_free_colors(id:PImlibData);cdecl;external imlibdll name 'Imlib_free_colors';
procedure Imlib_free_pixmap(id:PImlibData; pixmap:TPixmap);cdecl;external imlibdll name 'Imlib_free_pixmap';
procedure Imlib_get_image_border(id:PImlibData; image:PImlibImage; border:PImlibBorder);cdecl;external imlibdll name 'Imlib_get_image_border';
procedure Imlib_set_image_border(id:PImlibData; image:PImlibImage; border:PImlibBorder);cdecl;external imlibdll name 'Imlib_set_image_border';
procedure Imlib_get_image_shape(id:PImlibData; image:PImlibImage; color:PImlibColor);cdecl;external imlibdll name 'Imlib_get_image_shape';
procedure Imlib_set_image_shape(id:PImlibData; image:PImlibImage; color:PImlibColor);cdecl;external imlibdll name 'Imlib_set_image_shape';
function Imlib_save_image_to_eim(id:PImlibData; image:PImlibImage; thefile:Pchar):longint;cdecl;external imlibdll name 'Imlib_save_image_to_eim';
function Imlib_add_image_to_eim(id:PImlibData; image:PImlibImage; thefile:Pchar):longint;cdecl;external imlibdll name 'Imlib_add_image_to_eim';
function Imlib_save_image_to_ppm(id:PImlibData; image:PImlibImage; thefile:Pchar):longint;cdecl;external imlibdll name 'Imlib_save_image_to_ppm';
function Imlib_load_file_to_pixmap(id:PImlibData; filename:Pchar; pmap:PPixmap; mask:PPixmap):longint;cdecl;external imlibdll name 'Imlib_load_file_to_pixmap';
procedure Imlib_set_image_modifier(id:PImlibData; image:PImlibImage; mods:PImlibColorModifier);cdecl;external imlibdll name 'Imlib_set_image_modifier';
procedure Imlib_set_image_red_modifier(id:PImlibData; image:PImlibImage; mods:PImlibColorModifier);cdecl;external imlibdll name 'Imlib_set_image_red_modifier';
procedure Imlib_set_image_green_modifier(id:PImlibData; image:PImlibImage; mods:PImlibColorModifier);cdecl;external imlibdll name 'Imlib_set_image_green_modifier';
procedure Imlib_set_image_blue_modifier(id:PImlibData; image:PImlibImage; mods:PImlibColorModifier);cdecl;external imlibdll name 'Imlib_set_image_blue_modifier';
procedure Imlib_get_image_modifier(id:PImlibData; image:PImlibImage; mods:PImlibColorModifier);cdecl;external imlibdll name 'Imlib_get_image_modifier';
procedure Imlib_get_image_red_modifier(id:PImlibData; image:PImlibImage; mods:PImlibColorModifier);cdecl;external imlibdll name 'Imlib_get_image_red_modifier';
procedure Imlib_get_image_green_modifier(id:PImlibData; image:PImlibImage; mods:PImlibColorModifier);cdecl;external imlibdll name 'Imlib_get_image_green_modifier';
procedure Imlib_get_image_blue_modifier(id:PImlibData; image:PImlibImage; mods:PImlibColorModifier);cdecl;external imlibdll name 'Imlib_get_image_blue_modifier';
procedure Imlib_set_image_red_curve(id:PImlibData; image:PImlibImage; mods:Pbyte);cdecl;external imlibdll name 'Imlib_set_image_red_curve';
procedure Imlib_set_image_green_curve(id:PImlibData; image:PImlibImage; mods:Pbyte);cdecl;external imlibdll name 'Imlib_set_image_green_curve';
procedure Imlib_set_image_blue_curve(id:PImlibData; image:PImlibImage; mods:Pbyte);cdecl;external imlibdll name 'Imlib_set_image_blue_curve';
procedure Imlib_get_image_red_curve(id:PImlibData; image:PImlibImage; mods:Pbyte);cdecl;external imlibdll name 'Imlib_get_image_red_curve';
procedure Imlib_get_image_green_curve(id:PImlibData; image:PImlibImage; mods:Pbyte);cdecl;external imlibdll name 'Imlib_get_image_green_curve';
procedure Imlib_get_image_blue_curve(id:PImlibData; image:PImlibImage; mods:Pbyte);cdecl;external imlibdll name 'Imlib_get_image_blue_curve';
procedure Imlib_apply_modifiers_to_rgb(id:PImlibData; image:PImlibImage);cdecl;external imlibdll name 'Imlib_apply_modifiers_to_rgb';
procedure Imlib_changed_image(id:PImlibData; image:PImlibImage);cdecl;external imlibdll name 'Imlib_changed_image';
procedure Imlib_apply_image(id:PImlibData; image:PImlibImage; p:TWindow);cdecl;external imlibdll name 'Imlib_apply_image';
procedure Imlib_paste_image(id:PImlibData; image:PImlibImage; p:TWindow; x:longint; y:longint;
            w:longint; h:longint);cdecl;external imlibdll name 'Imlib_paste_image';
procedure Imlib_paste_image_border(id:PImlibData; image:PImlibImage; p:TWindow; x:longint; y:longint;
            w:longint; h:longint);cdecl;external imlibdll name 'Imlib_paste_image_border';
procedure Imlib_bevel_image(id:PImlibData; image:PImlibImage; bord:PImlibBorder; up:byte);cdecl;external imlibdll name 'Imlib_bevel_image';
procedure Imlib_bevel_pixmap(id:PImlibData; p:TPixmap; w:longint; h:longint; bord:PImlibBorder;
            up:byte);cdecl;external imlibdll name 'Imlib_bevel_pixmap';
procedure Imlib_flip_image_horizontal(id:PImlibData; image:PImlibImage);cdecl;external imlibdll name 'Imlib_flip_image_horizontal';
procedure Imlib_flip_image_vertical(id:PImlibData; image:PImlibImage);cdecl;external imlibdll name 'Imlib_flip_image_vertical';
procedure Imlib_rotate_image(id:PImlibData; image:PImlibImage; d:longint);cdecl;external imlibdll name 'Imlib_rotate_image';
function Imlib_create_image_from_data(id:PImlibData; data:Pbyte; alpha:Pbyte; w:longint; h:longint):PImlibimage;cdecl;external imlibdll name 'Imlib_create_image_from_data';
function Imlib_clone_image(id:PImlibData; image:PImlibImage):PImlibImage;cdecl;external imlibdll name 'Imlib_clone_image';
function Imlib_clone_scaled_image(id:PImlibData; image:PImlibImage; w:longint; h:longint):PImlibImage;cdecl;external imlibdll name 'Imlib_clone_scaled_image';
function Imlib_get_fallback(id:PImlibData):longint;cdecl;external imlibdll name 'Imlib_get_fallback';
procedure Imlib_set_fallback(id:PImlibData; fallback:longint);cdecl;external imlibdll name 'Imlib_set_fallback';
function Imlib_get_visual(id:PImlibData):PVisual;cdecl;external imlibdll name 'Imlib_get_visual';
function Imlib_get_colormap(id:PImlibData):TColormap;cdecl;external imlibdll name 'Imlib_get_colormap';
function Imlib_get_sysconfig(id:PImlibData):Pchar;cdecl;external imlibdll name 'Imlib_get_sysconfig';
function Imlib_create_image_from_xpm_data(id:PImlibData; data:PPchar):PImlibImage;cdecl;external imlibdll name 'Imlib_create_image_from_xpm_data';
function Imlib_data_to_pixmap(id:PImlibData; data:PPchar; pmap:PPixmap; mask:PPixmap):longint;cdecl;external imlibdll name 'Imlib_data_to_pixmap';
procedure Imlib_crop_image(id:PImlibData; image:PImlibImage; x:longint; y:longint; w:longint;
            h:longint);cdecl;external imlibdll name 'Imlib_crop_image';
function Imlib_save_image(id:PImlibData; image:PImlibImage; thefile:Pchar; info:PImlibSaveInfo):longint;cdecl;external imlibdll name 'Imlib_save_image';
function Imlib_crop_and_clone_image(id:PImlibData; image:PImlibImage; x:longint; y:longint; w:longint;
           h:longint):PImlibImage;cdecl;external imlibdll name 'Imlib_crop_and_clone_image';
function Imlib_create_image_from_drawable(id:PImlibData; win:TDrawable; mask:TPixmap; x:longint; y:longint;
           width:longint; height:longint):PImlibImage;cdecl;external imlibdll name 'Imlib_create_image_from_drawable';
function Imlib_inlined_png_to_image(id:PImlibData; data:Pbyte; data_size:longint):PImlibImage;cdecl;external imlibdll name 'Imlib_inlined_png_to_image';

implementation


end.