/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

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