PageRenderTime 93ms CodeModel.GetById 44ms app.highlight 42ms RepoModel.GetById 1ms app.codeStats 2ms

/packages/imlib/src/gdk_imlib.pp

https://github.com/slibre/freepascal
Puppet | 220 lines | 196 code | 24 blank | 0 comment | 2 complexity | 7f19dafaf3134653f2672861e4104190 MD5 | raw file
Possible License(s): LGPL-2.0, LGPL-2.1, LGPL-3.0
  1{
  2
  3   gdk_imlib library
  4
  5   Copyright (C) 1998 By The Rasterman (Carsten Haitzler)
  6
  7   This library is free software; you can redistribute it and/or
  8   modify it under the terms of the GNU Library General Public
  9   License as published by the Free Software Foundation; either
 10   version 2 of the License, or (at your option) any later version.
 11
 12   This library is distributed in the hope that it will be useful,
 13   but WITHOUT ANY WARRANTY; without even the implied warranty of
 14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 15   Library General Public License for more details.
 16
 17   You should have received a copy of the GNU Library General Public
 18   License along with this library; if not, write to the
 19   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 20   Boston, MA 02111-1307, USA.
 21
 22 **********************************************************************}
 23unit gdk_imlib;
 24
 25interface
 26
 27{$PACKRECORDS C}
 28{$mode objfpc}
 29
 30Uses glib, gdk, gtk;
 31
 32const
 33{$ifndef os2}
 34  gdk_imlibdll='gdk_imlib';
 35{$else}
 36  gdk_imlibdll='gdkimlib';
 37{$endif}
 38
 39Type
 40   PGdkImlibBorder = ^TGdkImlibBorder;
 41   TGdkImlibBorder = record
 42        left : gint;
 43        right : gint;
 44        top : gint;
 45        bottom : gint;
 46     end;
 47
 48   PGdkImlibColor = ^TGdkImlibColor;
 49   TGdkImlibColor = record
 50        r : gint;
 51        g : gint;
 52        b : gint;
 53        pixel : gint;
 54     end;
 55
 56   PGdkImlibColorModifier = ^TGdkImlibColorModifier;
 57   TGdkImlibColorModifier = record
 58        gamma : gint;
 59        brightness : gint;
 60        contrast : gint;
 61     end;
 62
 63   PGdkImlibModifierMap = ^TGdkImlibModifierMap;
 64   TGdkImlibModifierMap = record
 65        rmap : array[0..255] of byte;
 66        gmap : array[0..255] of byte;
 67        bmap : array[0..255] of byte;
 68     end;
 69
 70   PGdkImlibImage = ^TGdkImlibImage;
 71   TGdkImlibImage = record
 72        rgb_width : gint;
 73        rgb_height : gint;
 74        rgb_data : Pbyte;
 75        alpha_data : Pbyte;
 76        filename : Pgchar;
 77        width : gint;
 78        height : gint;
 79        shape_color : TGdkImlibColor;
 80        border : TGdkImlibBorder;
 81        pixmap : PGdkPixmap;
 82        shape_mask : PGdkBitmap;
 83        cache : gchar;
 84        mods : TGdkImlibColorModifier;
 85        rmod : TGdkImlibColorModifier;
 86        gmod : TGdkImlibColorModifier;
 87        bmod : TGdkImlibColorModifier;
 88        map : PGdkImlibModifierMap;
 89        ref_count : longint;
 90        pixmaps : PGHashTable;
 91     end;
 92
 93   PGdkImlibSaveInfo = ^TGdkImlibSaveInfo;
 94   TGdkImlibSaveInfo = record
 95        quality : longint;
 96        scaling : longint;
 97        xjustification : longint;
 98        yjustification : longint;
 99        page_size : longint;
100        color : char;
101     end;
102
103   PGdkImlibInitParams = ^TGdkImlibInitParams;
104   TGdkImlibInitParams = record
105        flags : longint;
106        visualid : longint;
107        palettefile : Pchar;
108        sharedmem : char;
109        sharedpixmaps : char;
110        paletteoverride : char;
111        remap : char;
112        fastrender : char;
113        hiquality : char;
114        dither : char;
115        imagecachesize : longint;
116        pixmapcachesize : longint;
117     end;
118
119const
120  PARAMS_VISUALID        = 1 shl 0;
121  PARAMS_PALETTEFILE     = 1 shl 1;
122  PARAMS_SHAREDMEM       = 1 shl 2;
123  PARAMS_SHAREDPIXMAPS   = 1 shl 3;
124  PARAMS_PALETTEOVERRIDE = 1 shl 4;
125  PARAMS_REMAP           = 1 shl 5;
126  PARAMS_FASTRENDER      = 1 shl 6;
127  PARAMS_HIQUALITY       = 1 shl 7;
128  PARAMS_DITHER          = 1 shl 8;
129  PARAMS_IMAGECACHESIZE  = 1 shl 9;
130  PARAMS_PIXMAPCACHESIZE = 1 shl 10;
131
132  PAGE_SIZE_EXECUTIVE    = 0;
133  PAGE_SIZE_LETTER       = 1;
134  PAGE_SIZE_LEGAL        = 2;
135  PAGE_SIZE_A4           = 3;
136  PAGE_SIZE_A3           = 4;
137  PAGE_SIZE_A5           = 5;
138  PAGE_SIZE_FOLIO        = 6;
139
140  RT_PLAIN_PALETTE       = 0;
141  RT_PLAIN_PALETTE_FAST  = 1;
142  RT_DITHER_PALETTE      = 2;
143  RT_DITHER_PALETTE_FAST = 3;
144  RT_PLAIN_TRUECOL       = 4;
145  RT_DITHER_TRUECOL      = 5;
146
147procedure gdk_imlib_init;cdecl;external gdk_imlibdll name 'gdk_imlib_init';
148procedure gdk_imlib_init_params(p:PGdkImlibInitParams);cdecl;external gdk_imlibdll name 'gdk_imlib_init_params';
149function gdk_imlib_get_render_type:gint;cdecl;external gdk_imlibdll name 'gdk_imlib_get_render_type';
150procedure gdk_imlib_set_render_type(rend_type:gint);cdecl;external gdk_imlibdll name 'gdk_imlib_set_render_type';
151function gdk_imlib_load_colors(afile:Pchar):gint;cdecl;external gdk_imlibdll name 'gdk_imlib_load_colors';
152function gdk_imlib_load_image(afile:Pchar):PGdkImlibImage;cdecl;external gdk_imlibdll name 'gdk_imlib_load_image';
153function gdk_imlib_load_alpha(afile:Pchar):PGdkImlibImage;cdecl;external gdk_imlibdll name 'gdk_imlib_load_alpha';
154function gdk_imlib_best_color_match(r:Pgint; g:Pgint; b:Pgint):gint;cdecl;external gdk_imlibdll name 'gdk_imlib_best_color_match';
155procedure gdk_imlib_best_color_get(c:PGdkColor);cdecl;external gdk_imlibdll name 'gdk_imlib_best_color_get';
156function gdk_imlib_render(image:PGdkImlibImage; width:gint; height:gint):gint;cdecl;external gdk_imlibdll name 'gdk_imlib_render';
157function gdk_imlib_copy_image(image:PGdkImlibImage):PGdkPixmap;cdecl;external gdk_imlibdll name 'gdk_imlib_copy_image';
158function gdk_imlib_copy_mask(image:PGdkImlibImage):PGdkBitmap;cdecl;external gdk_imlibdll name 'gdk_imlib_copy_mask';
159function gdk_imlib_move_image(image:PGdkImlibImage):PGdkPixmap;cdecl;external gdk_imlibdll name 'gdk_imlib_move_image';
160function gdk_imlib_move_mask(image:PGdkImlibImage):PGdkBitmap;cdecl;external gdk_imlibdll name 'gdk_imlib_move_mask';
161procedure gdk_imlib_destroy_image(image:PGdkImlibImage);cdecl;external gdk_imlibdll name 'gdk_imlib_destroy_image';
162procedure gdk_imlib_kill_image(image:PGdkImlibImage);cdecl;external gdk_imlibdll name 'gdk_imlib_kill_image';
163procedure gdk_imlib_free_colors;cdecl;external gdk_imlibdll name 'gdk_imlib_free_colors';
164procedure gdk_imlib_free_pixmap(pixmap:PGdkPixmap);cdecl;external gdk_imlibdll name 'gdk_imlib_free_pixmap';
165procedure gdk_imlib_free_bitmap(bitmap:PGdkBitmap);cdecl;external gdk_imlibdll name 'gdk_imlib_free_bitmap';
166procedure gdk_imlib_get_image_border(image:PGdkImlibImage; border:PGdkImlibBorder);cdecl;external gdk_imlibdll name 'gdk_imlib_get_image_border';
167procedure gdk_imlib_set_image_border(image:PGdkImlibImage; border:PGdkImlibBorder);cdecl;external gdk_imlibdll name 'gdk_imlib_set_image_border';
168procedure gdk_imlib_get_image_shape(image:PGdkImlibImage; color:PGdkImlibColor);cdecl;external gdk_imlibdll name 'gdk_imlib_get_image_shape';
169procedure gdk_imlib_set_image_shape(image:PGdkImlibImage; color:PGdkImlibColor);cdecl;external gdk_imlibdll name 'gdk_imlib_set_image_shape';
170function gdk_imlib_save_image_to_eim(image:PGdkImlibImage; afile:Pchar):gint;cdecl;external gdk_imlibdll name 'gdk_imlib_save_image_to_eim';
171function gdk_imlib_add_image_to_eim(image:PGdkImlibImage; afile:Pchar):gint;cdecl;external gdk_imlibdll name 'gdk_imlib_add_image_to_eim';
172function gdk_imlib_save_image_to_ppm(image:PGdkImlibImage; afile:Pchar):gint;cdecl;external gdk_imlibdll name 'gdk_imlib_save_image_to_ppm';
173function gdk_imlib_load_file_to_pixmap(filename:Pchar; pmap:PPGdkPixmap; mask:PPGdkBitmap):gint;cdecl;external gdk_imlibdll name 'gdk_imlib_load_file_to_pixmap';
174procedure gdk_imlib_set_image_modifier(image:PGdkImlibImage; mods:PGdkImlibColorModifier);cdecl;external gdk_imlibdll name 'gdk_imlib_set_image_modifier';
175procedure gdk_imlib_set_image_red_modifier(image:PGdkImlibImage; mods:PGdkImlibColorModifier);cdecl;external gdk_imlibdll name 'gdk_imlib_set_image_red_modifier';
176procedure gdk_imlib_set_image_green_modifier(image:PGdkImlibImage; mods:PGdkImlibColorModifier);cdecl;external gdk_imlibdll name 'gdk_imlib_set_image_green_modifier';
177procedure gdk_imlib_set_image_blue_modifier(image:PGdkImlibImage; mods:PGdkImlibColorModifier);cdecl;external gdk_imlibdll name 'gdk_imlib_set_image_blue_modifier';
178procedure gdk_imlib_get_image_modifier(image:PGdkImlibImage; mods:PGdkImlibColorModifier);cdecl;external gdk_imlibdll name 'gdk_imlib_get_image_modifier';
179procedure gdk_imlib_get_image_red_modifier(image:PGdkImlibImage; mods:PGdkImlibColorModifier);cdecl;external gdk_imlibdll name 'gdk_imlib_get_image_red_modifier';
180procedure gdk_imlib_get_image_green_modifier(image:PGdkImlibImage; mods:PGdkImlibColorModifier);cdecl;external gdk_imlibdll name 'gdk_imlib_get_image_green_modifier';
181procedure gdk_imlib_get_image_blue_modifier(image:PGdkImlibImage; mods:PGdkImlibColorModifier);cdecl;external gdk_imlibdll name 'gdk_imlib_get_image_blue_modifier';
182procedure gdk_imlib_set_image_red_curve(image:PGdkImlibImage; mods:Pbyte);cdecl;external gdk_imlibdll name 'gdk_imlib_set_image_red_curve';
183procedure gdk_imlib_set_image_green_curve(image:PGdkImlibImage; mods:Pbyte);cdecl;external gdk_imlibdll name 'gdk_imlib_set_image_green_curve';
184procedure gdk_imlib_set_image_blue_curve(image:PGdkImlibImage; mods:Pbyte);cdecl;external gdk_imlibdll name 'gdk_imlib_set_image_blue_curve';
185procedure gdk_imlib_get_image_red_curve(image:PGdkImlibImage; mods:Pbyte);cdecl;external gdk_imlibdll name 'gdk_imlib_get_image_red_curve';
186procedure gdk_imlib_get_image_green_curve(image:PGdkImlibImage; mods:Pbyte);cdecl;external gdk_imlibdll name 'gdk_imlib_get_image_green_curve';
187procedure gdk_imlib_get_image_blue_curve(image:PGdkImlibImage; mods:Pbyte);cdecl;external gdk_imlibdll name 'gdk_imlib_get_image_blue_curve';
188procedure gdk_imlib_apply_modifiers_to_rgb(image:PGdkImlibImage);cdecl;external gdk_imlibdll name 'gdk_imlib_apply_modifiers_to_rgb';
189procedure gdk_imlib_changed_image(image:PGdkImlibImage);cdecl;external gdk_imlibdll name 'gdk_imlib_changed_image';
190procedure gdk_imlib_apply_image(image:PGdkImlibImage; p:PGdkWindow);cdecl;external gdk_imlibdll name 'gdk_imlib_apply_image';
191procedure gdk_imlib_paste_image(image:PGdkImlibImage; p:PGdkWindow; x:gint; y:gint; w:gint;
192            h:gint);cdecl;external gdk_imlibdll name 'gdk_imlib_paste_image';
193procedure gdk_imlib_paste_image_border(image:PGdkImlibImage; p:PGdkWindow; x:gint; y:gint; w:gint;
194            h:gint);cdecl;external gdk_imlibdll name 'gdk_imlib_paste_image_border';
195procedure gdk_imlib_flip_image_horizontal(image:PGdkImlibImage);cdecl;external gdk_imlibdll name 'gdk_imlib_flip_image_horizontal';
196procedure gdk_imlib_flip_image_vertical(image:PGdkImlibImage);cdecl;external gdk_imlibdll name 'gdk_imlib_flip_image_vertical';
197procedure gdk_imlib_rotate_image(image:PGdkImlibImage; d:gint);cdecl;external gdk_imlibdll name 'gdk_imlib_rotate_image';
198function gdk_imlib_create_image_from_data(data:Pbyte; alpha:Pbyte; w:gint; h:gint):PGdkImlibImage;cdecl;external gdk_imlibdll name 'gdk_imlib_create_image_from_data';
199function gdk_imlib_clone_image(image:PGdkImlibImage):PGdkImlibImage;cdecl;external gdk_imlibdll name 'gdk_imlib_clone_image';
200function gdk_imlib_clone_scaled_image(image:PGdkImlibImage; w:longint; h:longint):PGdkImlibImage;cdecl;external gdk_imlibdll name 'gdk_imlib_clone_scaled_image';
201function gdk_imlib_get_fallback:gint;cdecl;external gdk_imlibdll name 'gdk_imlib_get_fallback';
202procedure gdk_imlib_set_fallback(fallback:gint);cdecl;external gdk_imlibdll name 'gdk_imlib_set_fallback';
203function gdk_imlib_get_visual:PGdkVisual;cdecl;external gdk_imlibdll name 'gdk_imlib_get_visual';
204function gdk_imlib_get_colormap:PGdkColormap;cdecl;external gdk_imlibdll name 'gdk_imlib_get_colormap';
205function gdk_imlib_get_sysconfig:Pgchar;cdecl;external gdk_imlibdll name 'gdk_imlib_get_sysconfig';
206function gdk_imlib_create_image_from_xpm_data(data:PPchar):PGdkImlibImage;cdecl;external gdk_imlibdll name 'gdk_imlib_create_image_from_xpm_data';
207function gdk_imlib_data_to_pixmap(data:PPchar; pmap:PPGdkPixmap; mask:PPGdkBitmap):gint;cdecl;external gdk_imlibdll name 'gdk_imlib_data_to_pixmap';
208procedure gdk_imlib_crop_image(image:PGdkImlibImage; x:gint; y:gint; w:gint; h:gint);cdecl;external gdk_imlibdll name 'gdk_imlib_crop_image';
209function gdk_imlib_save_image(image:PGdkImlibImage; afile:Pchar; info:PGdkImlibSaveInfo):gint;cdecl;external gdk_imlibdll name 'gdk_imlib_save_image';
210function gdk_imlib_crop_and_clone_image(image:PGdkImlibImage; x:longint; y:longint; w:longint; h:longint):PGdkImlibImage;cdecl;external gdk_imlibdll name 'gdk_imlib_crop_and_clone_image';
211function gdk_imlib_create_image_from_drawable(gwin:PGdkWindow; gmask:PGdkBitmap; x:longint; y:longint; width:longint;
212           height:longint):PGdkImlibImage;cdecl;external gdk_imlibdll name 'gdk_imlib_create_image_from_drawable';
213function gdk_imlib_inlined_png_to_image(data:Pbyte; data_size:longint):PGdkImlibImage;cdecl;external gdk_imlibdll name 'gdk_imlib_inlined_png_to_image';
214procedure gdk_imlib_get_cache_info(cache_pixmaps:Plongint; cache_images:Plongint);cdecl;external gdk_imlibdll name 'gdk_imlib_get_cache_info';
215procedure gdk_imlib_set_cache_info(cache_pixmaps:longint; cache_images:longint);cdecl;external gdk_imlibdll name 'gdk_imlib_set_cache_info';
216
217implementation
218
219
220end.