gdk_imlib.pp 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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., 51 Franklin Street, Fifth Floor,
  15. Boston, MA 02110-1301, USA.
  16. **********************************************************************}
  17. {$IFNDEF FPC_DOTTEDUNITS}
  18. unit gdk_imlib;
  19. {$ENDIF FPC_DOTTEDUNITS}
  20. interface
  21. {$PACKRECORDS C}
  22. {$mode objfpc}
  23. {$IFDEF FPC_DOTTEDUNITS}
  24. Uses Api.Gtk1.Glib, Api.Gtk1.Gdk, Api.Gtk1.Gtk;
  25. {$ELSE FPC_DOTTEDUNITS}
  26. Uses glib, gdk, gtk;
  27. {$ENDIF FPC_DOTTEDUNITS}
  28. const
  29. {$ifndef os2}
  30. gdk_imlibdll='gdk_imlib';
  31. {$else}
  32. gdk_imlibdll='gdkimlib';
  33. {$endif}
  34. Type
  35. PGdkImlibBorder = ^TGdkImlibBorder;
  36. TGdkImlibBorder = record
  37. left : gint;
  38. right : gint;
  39. top : gint;
  40. bottom : gint;
  41. end;
  42. PGdkImlibColor = ^TGdkImlibColor;
  43. TGdkImlibColor = record
  44. r : gint;
  45. g : gint;
  46. b : gint;
  47. pixel : gint;
  48. end;
  49. PGdkImlibColorModifier = ^TGdkImlibColorModifier;
  50. TGdkImlibColorModifier = record
  51. gamma : gint;
  52. brightness : gint;
  53. contrast : gint;
  54. end;
  55. PGdkImlibModifierMap = ^TGdkImlibModifierMap;
  56. TGdkImlibModifierMap = record
  57. rmap : array[0..255] of byte;
  58. gmap : array[0..255] of byte;
  59. bmap : array[0..255] of byte;
  60. end;
  61. PGdkImlibImage = ^TGdkImlibImage;
  62. TGdkImlibImage = record
  63. rgb_width : gint;
  64. rgb_height : gint;
  65. rgb_data : Pbyte;
  66. alpha_data : Pbyte;
  67. filename : Pgchar;
  68. width : gint;
  69. height : gint;
  70. shape_color : TGdkImlibColor;
  71. border : TGdkImlibBorder;
  72. pixmap : PGdkPixmap;
  73. shape_mask : PGdkBitmap;
  74. cache : gchar;
  75. mods : TGdkImlibColorModifier;
  76. rmod : TGdkImlibColorModifier;
  77. gmod : TGdkImlibColorModifier;
  78. bmod : TGdkImlibColorModifier;
  79. map : PGdkImlibModifierMap;
  80. ref_count : longint;
  81. pixmaps : PGHashTable;
  82. end;
  83. PGdkImlibSaveInfo = ^TGdkImlibSaveInfo;
  84. TGdkImlibSaveInfo = record
  85. quality : longint;
  86. scaling : longint;
  87. xjustification : longint;
  88. yjustification : longint;
  89. page_size : longint;
  90. color : AnsiChar;
  91. end;
  92. PGdkImlibInitParams = ^TGdkImlibInitParams;
  93. TGdkImlibInitParams = record
  94. flags : longint;
  95. visualid : longint;
  96. palettefile : PAnsiChar;
  97. sharedmem : AnsiChar;
  98. sharedpixmaps : AnsiChar;
  99. paletteoverride : AnsiChar;
  100. remap : AnsiChar;
  101. fastrender : AnsiChar;
  102. hiquality : AnsiChar;
  103. dither : AnsiChar;
  104. imagecachesize : longint;
  105. pixmapcachesize : longint;
  106. end;
  107. const
  108. PARAMS_VISUALID = 1 shl 0;
  109. PARAMS_PALETTEFILE = 1 shl 1;
  110. PARAMS_SHAREDMEM = 1 shl 2;
  111. PARAMS_SHAREDPIXMAPS = 1 shl 3;
  112. PARAMS_PALETTEOVERRIDE = 1 shl 4;
  113. PARAMS_REMAP = 1 shl 5;
  114. PARAMS_FASTRENDER = 1 shl 6;
  115. PARAMS_HIQUALITY = 1 shl 7;
  116. PARAMS_DITHER = 1 shl 8;
  117. PARAMS_IMAGECACHESIZE = 1 shl 9;
  118. PARAMS_PIXMAPCACHESIZE = 1 shl 10;
  119. PAGE_SIZE_EXECUTIVE = 0;
  120. PAGE_SIZE_LETTER = 1;
  121. PAGE_SIZE_LEGAL = 2;
  122. PAGE_SIZE_A4 = 3;
  123. PAGE_SIZE_A3 = 4;
  124. PAGE_SIZE_A5 = 5;
  125. PAGE_SIZE_FOLIO = 6;
  126. RT_PLAIN_PALETTE = 0;
  127. RT_PLAIN_PALETTE_FAST = 1;
  128. RT_DITHER_PALETTE = 2;
  129. RT_DITHER_PALETTE_FAST = 3;
  130. RT_PLAIN_TRUECOL = 4;
  131. RT_DITHER_TRUECOL = 5;
  132. procedure gdk_imlib_init;cdecl;external gdk_imlibdll name 'gdk_imlib_init';
  133. procedure gdk_imlib_init_params(p:PGdkImlibInitParams);cdecl;external gdk_imlibdll name 'gdk_imlib_init_params';
  134. function gdk_imlib_get_render_type:gint;cdecl;external gdk_imlibdll name 'gdk_imlib_get_render_type';
  135. procedure gdk_imlib_set_render_type(rend_type:gint);cdecl;external gdk_imlibdll name 'gdk_imlib_set_render_type';
  136. function gdk_imlib_load_colors(afile:PAnsiChar):gint;cdecl;external gdk_imlibdll name 'gdk_imlib_load_colors';
  137. function gdk_imlib_load_image(afile:PAnsiChar):PGdkImlibImage;cdecl;external gdk_imlibdll name 'gdk_imlib_load_image';
  138. function gdk_imlib_load_alpha(afile:PAnsiChar):PGdkImlibImage;cdecl;external gdk_imlibdll name 'gdk_imlib_load_alpha';
  139. function gdk_imlib_best_color_match(r:Pgint; g:Pgint; b:Pgint):gint;cdecl;external gdk_imlibdll name 'gdk_imlib_best_color_match';
  140. procedure gdk_imlib_best_color_get(c:PGdkColor);cdecl;external gdk_imlibdll name 'gdk_imlib_best_color_get';
  141. function gdk_imlib_render(image:PGdkImlibImage; width:gint; height:gint):gint;cdecl;external gdk_imlibdll name 'gdk_imlib_render';
  142. function gdk_imlib_copy_image(image:PGdkImlibImage):PGdkPixmap;cdecl;external gdk_imlibdll name 'gdk_imlib_copy_image';
  143. function gdk_imlib_copy_mask(image:PGdkImlibImage):PGdkBitmap;cdecl;external gdk_imlibdll name 'gdk_imlib_copy_mask';
  144. function gdk_imlib_move_image(image:PGdkImlibImage):PGdkPixmap;cdecl;external gdk_imlibdll name 'gdk_imlib_move_image';
  145. function gdk_imlib_move_mask(image:PGdkImlibImage):PGdkBitmap;cdecl;external gdk_imlibdll name 'gdk_imlib_move_mask';
  146. procedure gdk_imlib_destroy_image(image:PGdkImlibImage);cdecl;external gdk_imlibdll name 'gdk_imlib_destroy_image';
  147. procedure gdk_imlib_kill_image(image:PGdkImlibImage);cdecl;external gdk_imlibdll name 'gdk_imlib_kill_image';
  148. procedure gdk_imlib_free_colors;cdecl;external gdk_imlibdll name 'gdk_imlib_free_colors';
  149. procedure gdk_imlib_free_pixmap(pixmap:PGdkPixmap);cdecl;external gdk_imlibdll name 'gdk_imlib_free_pixmap';
  150. procedure gdk_imlib_free_bitmap(bitmap:PGdkBitmap);cdecl;external gdk_imlibdll name 'gdk_imlib_free_bitmap';
  151. procedure gdk_imlib_get_image_border(image:PGdkImlibImage; border:PGdkImlibBorder);cdecl;external gdk_imlibdll name 'gdk_imlib_get_image_border';
  152. procedure gdk_imlib_set_image_border(image:PGdkImlibImage; border:PGdkImlibBorder);cdecl;external gdk_imlibdll name 'gdk_imlib_set_image_border';
  153. procedure gdk_imlib_get_image_shape(image:PGdkImlibImage; color:PGdkImlibColor);cdecl;external gdk_imlibdll name 'gdk_imlib_get_image_shape';
  154. procedure gdk_imlib_set_image_shape(image:PGdkImlibImage; color:PGdkImlibColor);cdecl;external gdk_imlibdll name 'gdk_imlib_set_image_shape';
  155. function gdk_imlib_save_image_to_eim(image:PGdkImlibImage; afile:PAnsiChar):gint;cdecl;external gdk_imlibdll name 'gdk_imlib_save_image_to_eim';
  156. function gdk_imlib_add_image_to_eim(image:PGdkImlibImage; afile:PAnsiChar):gint;cdecl;external gdk_imlibdll name 'gdk_imlib_add_image_to_eim';
  157. function gdk_imlib_save_image_to_ppm(image:PGdkImlibImage; afile:PAnsiChar):gint;cdecl;external gdk_imlibdll name 'gdk_imlib_save_image_to_ppm';
  158. function gdk_imlib_load_file_to_pixmap(filename:PAnsiChar; pmap:PPGdkPixmap; mask:PPGdkBitmap):gint;cdecl;external gdk_imlibdll name 'gdk_imlib_load_file_to_pixmap';
  159. procedure gdk_imlib_set_image_modifier(image:PGdkImlibImage; mods:PGdkImlibColorModifier);cdecl;external gdk_imlibdll name 'gdk_imlib_set_image_modifier';
  160. procedure gdk_imlib_set_image_red_modifier(image:PGdkImlibImage; mods:PGdkImlibColorModifier);cdecl;external gdk_imlibdll name 'gdk_imlib_set_image_red_modifier';
  161. procedure gdk_imlib_set_image_green_modifier(image:PGdkImlibImage; mods:PGdkImlibColorModifier);cdecl;external gdk_imlibdll name 'gdk_imlib_set_image_green_modifier';
  162. procedure gdk_imlib_set_image_blue_modifier(image:PGdkImlibImage; mods:PGdkImlibColorModifier);cdecl;external gdk_imlibdll name 'gdk_imlib_set_image_blue_modifier';
  163. procedure gdk_imlib_get_image_modifier(image:PGdkImlibImage; mods:PGdkImlibColorModifier);cdecl;external gdk_imlibdll name 'gdk_imlib_get_image_modifier';
  164. procedure gdk_imlib_get_image_red_modifier(image:PGdkImlibImage; mods:PGdkImlibColorModifier);cdecl;external gdk_imlibdll name 'gdk_imlib_get_image_red_modifier';
  165. procedure gdk_imlib_get_image_green_modifier(image:PGdkImlibImage; mods:PGdkImlibColorModifier);cdecl;external gdk_imlibdll name 'gdk_imlib_get_image_green_modifier';
  166. procedure gdk_imlib_get_image_blue_modifier(image:PGdkImlibImage; mods:PGdkImlibColorModifier);cdecl;external gdk_imlibdll name 'gdk_imlib_get_image_blue_modifier';
  167. procedure gdk_imlib_set_image_red_curve(image:PGdkImlibImage; mods:Pbyte);cdecl;external gdk_imlibdll name 'gdk_imlib_set_image_red_curve';
  168. procedure gdk_imlib_set_image_green_curve(image:PGdkImlibImage; mods:Pbyte);cdecl;external gdk_imlibdll name 'gdk_imlib_set_image_green_curve';
  169. procedure gdk_imlib_set_image_blue_curve(image:PGdkImlibImage; mods:Pbyte);cdecl;external gdk_imlibdll name 'gdk_imlib_set_image_blue_curve';
  170. procedure gdk_imlib_get_image_red_curve(image:PGdkImlibImage; mods:Pbyte);cdecl;external gdk_imlibdll name 'gdk_imlib_get_image_red_curve';
  171. procedure gdk_imlib_get_image_green_curve(image:PGdkImlibImage; mods:Pbyte);cdecl;external gdk_imlibdll name 'gdk_imlib_get_image_green_curve';
  172. procedure gdk_imlib_get_image_blue_curve(image:PGdkImlibImage; mods:Pbyte);cdecl;external gdk_imlibdll name 'gdk_imlib_get_image_blue_curve';
  173. procedure gdk_imlib_apply_modifiers_to_rgb(image:PGdkImlibImage);cdecl;external gdk_imlibdll name 'gdk_imlib_apply_modifiers_to_rgb';
  174. procedure gdk_imlib_changed_image(image:PGdkImlibImage);cdecl;external gdk_imlibdll name 'gdk_imlib_changed_image';
  175. procedure gdk_imlib_apply_image(image:PGdkImlibImage; p:PGdkWindow);cdecl;external gdk_imlibdll name 'gdk_imlib_apply_image';
  176. procedure gdk_imlib_paste_image(image:PGdkImlibImage; p:PGdkWindow; x:gint; y:gint; w:gint;
  177. h:gint);cdecl;external gdk_imlibdll name 'gdk_imlib_paste_image';
  178. procedure gdk_imlib_paste_image_border(image:PGdkImlibImage; p:PGdkWindow; x:gint; y:gint; w:gint;
  179. h:gint);cdecl;external gdk_imlibdll name 'gdk_imlib_paste_image_border';
  180. procedure gdk_imlib_flip_image_horizontal(image:PGdkImlibImage);cdecl;external gdk_imlibdll name 'gdk_imlib_flip_image_horizontal';
  181. procedure gdk_imlib_flip_image_vertical(image:PGdkImlibImage);cdecl;external gdk_imlibdll name 'gdk_imlib_flip_image_vertical';
  182. procedure gdk_imlib_rotate_image(image:PGdkImlibImage; d:gint);cdecl;external gdk_imlibdll name 'gdk_imlib_rotate_image';
  183. 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';
  184. function gdk_imlib_clone_image(image:PGdkImlibImage):PGdkImlibImage;cdecl;external gdk_imlibdll name 'gdk_imlib_clone_image';
  185. function gdk_imlib_clone_scaled_image(image:PGdkImlibImage; w:longint; h:longint):PGdkImlibImage;cdecl;external gdk_imlibdll name 'gdk_imlib_clone_scaled_image';
  186. function gdk_imlib_get_fallback:gint;cdecl;external gdk_imlibdll name 'gdk_imlib_get_fallback';
  187. procedure gdk_imlib_set_fallback(fallback:gint);cdecl;external gdk_imlibdll name 'gdk_imlib_set_fallback';
  188. function gdk_imlib_get_visual:PGdkVisual;cdecl;external gdk_imlibdll name 'gdk_imlib_get_visual';
  189. function gdk_imlib_get_colormap:PGdkColormap;cdecl;external gdk_imlibdll name 'gdk_imlib_get_colormap';
  190. function gdk_imlib_get_sysconfig:Pgchar;cdecl;external gdk_imlibdll name 'gdk_imlib_get_sysconfig';
  191. function gdk_imlib_create_image_from_xpm_data(data:PPAnsiChar):PGdkImlibImage;cdecl;external gdk_imlibdll name 'gdk_imlib_create_image_from_xpm_data';
  192. function gdk_imlib_data_to_pixmap(data:PPAnsiChar; pmap:PPGdkPixmap; mask:PPGdkBitmap):gint;cdecl;external gdk_imlibdll name 'gdk_imlib_data_to_pixmap';
  193. procedure gdk_imlib_crop_image(image:PGdkImlibImage; x:gint; y:gint; w:gint; h:gint);cdecl;external gdk_imlibdll name 'gdk_imlib_crop_image';
  194. function gdk_imlib_save_image(image:PGdkImlibImage; afile:PAnsiChar; info:PGdkImlibSaveInfo):gint;cdecl;external gdk_imlibdll name 'gdk_imlib_save_image';
  195. 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';
  196. function gdk_imlib_create_image_from_drawable(gwin:PGdkWindow; gmask:PGdkBitmap; x:longint; y:longint; width:longint;
  197. height:longint):PGdkImlibImage;cdecl;external gdk_imlibdll name 'gdk_imlib_create_image_from_drawable';
  198. function gdk_imlib_inlined_png_to_image(data:Pbyte; data_size:longint):PGdkImlibImage;cdecl;external gdk_imlibdll name 'gdk_imlib_inlined_png_to_image';
  199. procedure gdk_imlib_get_cache_info(cache_pixmaps:Plongint; cache_images:Plongint);cdecl;external gdk_imlibdll name 'gdk_imlib_get_cache_info';
  200. procedure gdk_imlib_set_cache_info(cache_pixmaps:longint; cache_images:longint);cdecl;external gdk_imlibdll name 'gdk_imlib_set_cache_info';
  201. implementation
  202. end.