gdk_imlib.pp 13 KB

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