Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. /*
  2. * libpipi Pathetic image processing interface library
  3. * Copyright (c) 2004-2009 Sam Hocevar <sam@hocevar.net>
  4. * 2008 Jean-Yves Lamoureux <jylam@lnxscene.org
  5. * All Rights Reserved
  6. *
  7. * $Id$
  8. *
  9. * This library is free software. It comes without any warranty, to
  10. * the extent permitted by applicable law. You can redistribute it
  11. * and/or modify it under the terms of the Do What The Fuck You Want
  12. * To Public License, Version 2, as published by Sam Hocevar. See
  13. * http://sam.zoy.org/wtfpl/COPYING for more details.
  14. */
  15. /*
  16. * pipi.h: the full libpipi public API
  17. */
  18. #ifndef __PIPI_H__
  19. #define __PIPI_H__
  20. #include <pipi_types.h>
  21. #undef __extern
  22. #if defined(_DOXYGEN_SKIP_ME)
  23. #elif defined(_WIN32) && defined(__LIBPIPI__)
  24. # define __extern extern __declspec(dllexport)
  25. #else
  26. # define __extern extern
  27. #endif
  28. #ifdef __cplusplus
  29. extern "C"
  30. {
  31. #endif
  32. /* pipi_scan_t: this enum is a list of all possible scanning methods when
  33. * parsing an image’s pixels. Not all functions support all scanning paths. */
  34. typedef enum
  35. {
  36. PIPI_SCAN_RASTER = 0,
  37. PIPI_SCAN_SERPENTINE = 1
  38. }
  39. pipi_scan_t;
  40. /* pipi_format_t: this enum is a list of all possible pixel formats for
  41. * our internal images. RGBA_U8 is the most usual format when an image has
  42. * just been loaded, but RGBA_F32 is a lot better for complex operations. */
  43. typedef enum
  44. {
  45. PIPI_PIXELS_UNINITIALISED = -1,
  46. PIPI_PIXELS_RGBA_U8 = 0,
  47. PIPI_PIXELS_BGR_U8 = 1,
  48. PIPI_PIXELS_RGBA_F32 = 2,
  49. PIPI_PIXELS_Y_F32 = 3,
  50. PIPI_PIXELS_MASK_U8 = 4,
  51. PIPI_PIXELS_MAX = 5
  52. }
  53. pipi_format_t;
  54. typedef enum
  55. {
  56. PIPI_COLOR_R = 1,
  57. PIPI_COLOR_G = 2,
  58. PIPI_COLOR_B = 4,
  59. PIPI_COLOR_A = 8,
  60. PIPI_COLOR_Y = 16
  61. }
  62. pipi_color_flag_t;
  63. struct pixel_u32
  64. {
  65. uint8_t r, g, b, a;
  66. };
  67. struct pixel_float
  68. {
  69. float r, g, b, a;
  70. };
  71. typedef struct
  72. {
  73. union
  74. {
  75. struct pixel_float pixel_float;
  76. struct pixel_u32 pixel_u32;
  77. };
  78. }
  79. pipi_pixel_t;
  80. /* pipi_pixels_t: this structure stores a pixel view of an image. */
  81. typedef struct
  82. {
  83. void *pixels;
  84. int w, h, pitch, bpp;
  85. size_t bytes;
  86. }
  87. pipi_pixels_t;
  88. /* pipi_tile_t: the internal tile type */
  89. typedef struct pipi_tile pipi_tile_t;
  90. /* pipi_image_t: the main image type */
  91. typedef struct pipi_image pipi_image_t;
  92. /* pipi_sequence_t: the image sequence type */
  93. typedef struct pipi_sequence pipi_sequence_t;
  94. /* pipi_context_t: the processing stack */
  95. typedef struct pipi_context pipi_context_t;
  96. /* pipi_histogram_t: the histogram type */
  97. typedef struct pipi_histogram pipi_histogram_t;
  98. /* pipi_command_t: the command type */
  99. typedef struct
  100. {
  101. char const *name;
  102. int argc;
  103. }
  104. pipi_command_t;
  105. __extern pipi_pixel_t *pipi_get_color_from_string(const char* s);
  106. __extern char const * pipi_get_version(void);
  107. __extern pipi_context_t *pipi_create_context(void);
  108. __extern void pipi_destroy_context(pipi_context_t *);
  109. __extern pipi_command_t const *pipi_get_command_list(void);
  110. __extern int pipi_command(pipi_context_t *, char const *, ...);
  111. __extern pipi_tile_t *pipi_get_tile(pipi_image_t *, int, int, int,
  112. pipi_format_t, int);
  113. __extern void pipi_release_tile(pipi_image_t *, pipi_tile_t *);
  114. __extern pipi_tile_t *pipi_create_tile(pipi_format_t, int);
  115. __extern pipi_image_t *pipi_load(char const *);
  116. __extern pipi_image_t *pipi_load_stock(char const *);
  117. __extern pipi_image_t *pipi_new(int, int);
  118. __extern pipi_image_t *pipi_copy(pipi_image_t *);
  119. __extern void pipi_free(pipi_image_t *);
  120. __extern int pipi_save(pipi_image_t *, const char *);
  121. __extern void pipi_set_gamma(double);
  122. __extern pipi_pixels_t *pipi_get_pixels(pipi_image_t *, pipi_format_t);
  123. __extern void pipi_release_pixels(pipi_image_t *, pipi_pixels_t *);
  124. __extern void pipi_set_colorspace(pipi_image_t *, pipi_format_t);
  125. __extern int pipi_get_image_width(pipi_image_t *img);
  126. __extern int pipi_get_image_height(pipi_image_t *img);
  127. __extern int pipi_get_image_pitch(pipi_image_t *img);
  128. __extern int pipi_get_image_last_modified(pipi_image_t *img);
  129. __extern const char* pipi_get_format_name(int format);
  130. __extern double pipi_measure_msd(pipi_image_t *, pipi_image_t *);
  131. __extern double pipi_measure_rmsd(pipi_image_t *, pipi_image_t *);
  132. __extern pipi_image_t *pipi_resize_bresenham(pipi_image_t *, int, int);
  133. __extern pipi_image_t *pipi_resize_bicubic(pipi_image_t *, int, int);
  134. __extern pipi_image_t *pipi_crop(pipi_image_t *, int, int, int, int);
  135. __extern pipi_image_t *pipi_render_random(int, int);
  136. __extern pipi_image_t *pipi_render_bayer(int, int);
  137. __extern pipi_image_t *pipi_render_halftone(int, int);
  138. __extern pipi_image_t *pipi_rgb(pipi_image_t *, pipi_image_t *, pipi_image_t *);
  139. __extern pipi_image_t *pipi_red(pipi_image_t *);
  140. __extern pipi_image_t *pipi_green(pipi_image_t *);
  141. __extern pipi_image_t *pipi_blue(pipi_image_t *);
  142. __extern pipi_image_t *pipi_blit(pipi_image_t *, pipi_image_t *, int, int);
  143. __extern pipi_image_t *pipi_merge(pipi_image_t *, pipi_image_t *, double);
  144. __extern pipi_image_t *pipi_mean(pipi_image_t *, pipi_image_t *);
  145. __extern pipi_image_t *pipi_min(pipi_image_t *, pipi_image_t *);
  146. __extern pipi_image_t *pipi_max(pipi_image_t *, pipi_image_t *);
  147. __extern pipi_image_t *pipi_add(pipi_image_t *, pipi_image_t *);
  148. __extern pipi_image_t *pipi_sub(pipi_image_t *, pipi_image_t *);
  149. __extern pipi_image_t *pipi_difference(pipi_image_t *, pipi_image_t *);
  150. __extern pipi_image_t *pipi_multiply(pipi_image_t *, pipi_image_t *);
  151. __extern pipi_image_t *pipi_divide(pipi_image_t *, pipi_image_t *);
  152. __extern pipi_image_t *pipi_screen(pipi_image_t *, pipi_image_t *);
  153. __extern pipi_image_t *pipi_overlay(pipi_image_t *, pipi_image_t *);
  154. __extern pipi_image_t *pipi_convolution(pipi_image_t *, int, int, double[]);
  155. __extern pipi_image_t *pipi_gaussian_blur(pipi_image_t *, float);
  156. __extern pipi_image_t *pipi_gaussian_blur_ext(pipi_image_t *,
  157. float, float, float, float, float);
  158. __extern pipi_image_t *pipi_box_blur(pipi_image_t *, int);
  159. __extern pipi_image_t *pipi_box_blur_ext(pipi_image_t *, int, int);
  160. __extern pipi_image_t *pipi_brightness(pipi_image_t *, double);
  161. __extern pipi_image_t *pipi_contrast(pipi_image_t *, double);
  162. __extern pipi_image_t *pipi_autocontrast(pipi_image_t *);
  163. __extern pipi_image_t *pipi_invert(pipi_image_t *);
  164. __extern pipi_image_t *pipi_threshold(pipi_image_t *, double);
  165. __extern pipi_image_t *pipi_hflip(pipi_image_t *);
  166. __extern pipi_image_t *pipi_vflip(pipi_image_t *);
  167. __extern pipi_image_t *pipi_rotate(pipi_image_t *, double);
  168. __extern pipi_image_t *pipi_rotate90(pipi_image_t *);
  169. __extern pipi_image_t *pipi_rotate180(pipi_image_t *);
  170. __extern pipi_image_t *pipi_rotate270(pipi_image_t *);
  171. __extern pipi_image_t *pipi_median(pipi_image_t *, int);
  172. __extern pipi_image_t *pipi_median_ext(pipi_image_t *, int, int);
  173. __extern pipi_image_t *pipi_dilate(pipi_image_t *);
  174. __extern pipi_image_t *pipi_erode(pipi_image_t *);
  175. __extern pipi_image_t *pipi_sine(pipi_image_t *, double, double,
  176. double, double);
  177. __extern pipi_image_t *pipi_wave(pipi_image_t *, double, double,
  178. double, double);
  179. __extern pipi_image_t *pipi_order(pipi_image_t *);
  180. __extern pipi_image_t *pipi_tile(pipi_image_t *, int, int);
  181. __extern int pipi_flood_fill(pipi_image_t *,
  182. int, int, float, float, float, float);
  183. __extern int pipi_draw_line(pipi_image_t *, int, int, int, int, uint32_t, int);
  184. __extern int pipi_draw_rectangle(pipi_image_t *, int, int, int, int, uint32_t, int);
  185. __extern int pipi_draw_polyline(pipi_image_t *, int const[], int const[],
  186. int , uint32_t, int);
  187. __extern int pipi_draw_bezier4(pipi_image_t *,int, int, int, int, int, int, int, int, uint32_t, int, int);
  188. __extern pipi_image_t *pipi_reduce(pipi_image_t *, int, double const *);
  189. __extern pipi_image_t *pipi_dither_ediff(pipi_image_t *, pipi_image_t *,
  190. pipi_scan_t);
  191. __extern pipi_image_t *pipi_dither_ordered(pipi_image_t *, pipi_image_t *);
  192. __extern pipi_image_t *pipi_dither_ordered_ext(pipi_image_t *, pipi_image_t *,
  193. double, double);
  194. __extern pipi_image_t *pipi_dither_halftone(pipi_image_t *, double, double);
  195. __extern pipi_image_t *pipi_dither_random(pipi_image_t *);
  196. __extern pipi_image_t *pipi_dither_ostromoukhov(pipi_image_t *, pipi_scan_t);
  197. __extern pipi_image_t *pipi_dither_dbs(pipi_image_t *);
  198. __extern void pipi_dither_24to16(pipi_image_t *);
  199. __extern pipi_histogram_t* pipi_new_histogram(void);
  200. __extern int pipi_get_image_histogram(pipi_image_t *, pipi_histogram_t *, int);
  201. __extern int pipi_free_histogram(pipi_histogram_t*);
  202. __extern int pipi_render_histogram(pipi_image_t *, pipi_histogram_t*, int);
  203. __extern pipi_sequence_t *pipi_open_sequence(char const *, int, int, int,
  204. int, int, int);
  205. __extern int pipi_feed_sequence(pipi_sequence_t *, uint8_t const *, int, int);
  206. __extern int pipi_close_sequence(pipi_sequence_t *);
  207. #ifdef __cplusplus
  208. }
  209. #endif
  210. #endif /* __PIPI_H__ */