您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. /*
  2. * libpipi Pathetic image processing interface library
  3. * Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org>
  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 <stdio.h>
  21. #include <string.h>
  22. #include <stdint.h>
  23. #ifdef __cplusplus
  24. extern "C"
  25. {
  26. #endif
  27. /* pipi_scan_t: this enum is a list of all possible scanning methods when
  28. * parsing an image’s pixels. Not all functions support all scanning paths. */
  29. typedef enum
  30. {
  31. PIPI_SCAN_RASTER = 0,
  32. PIPI_SCAN_SERPENTINE = 1
  33. }
  34. pipi_scan_t;
  35. /* pipi_format_t: this enum is a list of all possible pixel formats for
  36. * our internal images. RGBA32 is the most usual format when an image has
  37. * just been loaded, but RGBA_F is a lot better for complex operations. */
  38. typedef enum
  39. {
  40. PIPI_PIXELS_UNINITIALISED = -1,
  41. PIPI_PIXELS_RGBA_C = 0,
  42. PIPI_PIXELS_BGR_C = 1,
  43. PIPI_PIXELS_RGBA_F = 2,
  44. PIPI_PIXELS_Y_F = 3,
  45. PIPI_PIXELS_MASK_C = 4,
  46. PIPI_PIXELS_MAX = 5
  47. }
  48. pipi_format_t;
  49. typedef enum
  50. {
  51. PIPI_COLOR_R = 1,
  52. PIPI_COLOR_G = 2,
  53. PIPI_COLOR_B = 4,
  54. PIPI_COLOR_A = 8,
  55. PIPI_COLOR_Y = 16
  56. }
  57. pipi_color_flag_t;
  58. struct pixel_u32
  59. {
  60. uint8_t r, g, b, a;
  61. };
  62. struct pixel_float
  63. {
  64. float r, g, b, a;
  65. };
  66. typedef struct
  67. {
  68. union
  69. {
  70. struct pixel_float pixel_float;
  71. struct pixel_u32 pixel_u32;
  72. };
  73. }
  74. pipi_pixel_t;
  75. /* pipi_pixels_t: this structure stores a pixel view of an image. */
  76. typedef struct
  77. {
  78. void *pixels;
  79. int w, h, pitch, bpp;
  80. size_t bytes;
  81. }
  82. pipi_pixels_t;
  83. /* pipi_image_t: the main image type */
  84. typedef struct pipi_image pipi_image_t;
  85. /* pipi_context_t: the processing stack */
  86. typedef struct pipi_context pipi_context_t;
  87. /* pipi_histogram_t: the histogram type */
  88. typedef struct pipi_histogram pipi_histogram_t;
  89. extern pipi_pixel_t *pipi_get_color_from_string(const char* s);
  90. extern pipi_context_t *pipi_create_context(void);
  91. extern void pipi_destroy_context(pipi_context_t *);
  92. extern int pipi_command(pipi_context_t *, char const *, ...);
  93. extern pipi_image_t *pipi_load(char const *);
  94. extern pipi_image_t *pipi_load_stock(char const *);
  95. extern pipi_image_t *pipi_new(int, int);
  96. extern pipi_image_t *pipi_copy(pipi_image_t *);
  97. extern void pipi_free(pipi_image_t *);
  98. extern int pipi_save(pipi_image_t *, const char *);
  99. extern void pipi_set_gamma(double);
  100. extern pipi_pixels_t *pipi_getpixels(pipi_image_t *, pipi_format_t);
  101. extern int pipi_get_image_width(pipi_image_t *img);
  102. extern int pipi_get_image_height(pipi_image_t *img);
  103. extern int pipi_get_image_pitch(pipi_image_t *img);
  104. extern int pipi_get_image_last_modified(pipi_image_t *img);
  105. extern const char* pipi_get_format_name(int format);
  106. extern double pipi_measure_msd(pipi_image_t *, pipi_image_t *);
  107. extern double pipi_measure_rmsd(pipi_image_t *, pipi_image_t *);
  108. extern pipi_image_t *pipi_resize(pipi_image_t *, int, int);
  109. extern pipi_image_t *pipi_render_random(int, int);
  110. extern pipi_image_t *pipi_render_bayer(int, int);
  111. extern pipi_image_t *pipi_render_halftone(int, int);
  112. extern pipi_image_t *pipi_rgb(pipi_image_t *, pipi_image_t *, pipi_image_t *);
  113. extern pipi_image_t *pipi_red(pipi_image_t *);
  114. extern pipi_image_t *pipi_green(pipi_image_t *);
  115. extern pipi_image_t *pipi_blue(pipi_image_t *);
  116. extern pipi_image_t *pipi_mean(pipi_image_t *, pipi_image_t *);
  117. extern pipi_image_t *pipi_min(pipi_image_t *, pipi_image_t *);
  118. extern pipi_image_t *pipi_max(pipi_image_t *, pipi_image_t *);
  119. extern pipi_image_t *pipi_add(pipi_image_t *, pipi_image_t *);
  120. extern pipi_image_t *pipi_sub(pipi_image_t *, pipi_image_t *);
  121. extern pipi_image_t *pipi_difference(pipi_image_t *, pipi_image_t *);
  122. extern pipi_image_t *pipi_multiply(pipi_image_t *, pipi_image_t *);
  123. extern pipi_image_t *pipi_divide(pipi_image_t *, pipi_image_t *);
  124. extern pipi_image_t *pipi_screen(pipi_image_t *, pipi_image_t *);
  125. extern pipi_image_t *pipi_overlay(pipi_image_t *, pipi_image_t *);
  126. extern pipi_image_t *pipi_convolution(pipi_image_t *, int, int, double[]);
  127. extern pipi_image_t *pipi_gaussian_blur(pipi_image_t *, float);
  128. extern pipi_image_t *pipi_gaussian_blur_ext(pipi_image_t *,
  129. float, float, float, float, float);
  130. extern pipi_image_t *pipi_box_blur(pipi_image_t *, int);
  131. extern pipi_image_t *pipi_box_blur_ext(pipi_image_t *, int, int);
  132. extern pipi_image_t *pipi_brightness(pipi_image_t *, double);
  133. extern pipi_image_t *pipi_contrast(pipi_image_t *, double);
  134. extern pipi_image_t *pipi_autocontrast(pipi_image_t *);
  135. extern pipi_image_t *pipi_invert(pipi_image_t *);
  136. extern pipi_image_t *pipi_threshold(pipi_image_t *, double);
  137. extern pipi_image_t *pipi_hflip(pipi_image_t *);
  138. extern pipi_image_t *pipi_vflip(pipi_image_t *);
  139. extern pipi_image_t *pipi_rotate90(pipi_image_t *);
  140. extern pipi_image_t *pipi_rotate180(pipi_image_t *);
  141. extern pipi_image_t *pipi_rotate270(pipi_image_t *);
  142. extern pipi_image_t *pipi_median(pipi_image_t *, int);
  143. extern pipi_image_t *pipi_median_ext(pipi_image_t *, int, int);
  144. extern pipi_image_t *pipi_dilate(pipi_image_t *);
  145. extern pipi_image_t *pipi_erode(pipi_image_t *);
  146. extern pipi_image_t *pipi_order(pipi_image_t *);
  147. extern pipi_image_t *pipi_tile(pipi_image_t *, int, int);
  148. extern int pipi_flood_fill(pipi_image_t *,
  149. int, int, float, float, float, float);
  150. extern int pipi_draw_line(pipi_image_t *, int, int, int, int, uint32_t, int);
  151. extern int pipi_draw_polyline(pipi_image_t *, int const[], int const[],
  152. int , uint32_t, int);
  153. extern int pipi_draw_bezier4(pipi_image_t *,int, int, int, int, int, int, int, int, uint32_t, int, int);
  154. extern pipi_image_t *pipi_reduce(pipi_image_t *, int, double const *);
  155. extern pipi_image_t *pipi_dither_ediff(pipi_image_t *, pipi_image_t *,
  156. pipi_scan_t);
  157. extern pipi_image_t *pipi_dither_ordered(pipi_image_t *, pipi_image_t *);
  158. extern pipi_image_t *pipi_dither_ordered_ext(pipi_image_t *, pipi_image_t *,
  159. double, double);
  160. extern pipi_image_t *pipi_dither_halftone(pipi_image_t *, double, double);
  161. extern pipi_image_t *pipi_dither_random(pipi_image_t *);
  162. extern pipi_image_t *pipi_dither_ostromoukhov(pipi_image_t *, pipi_scan_t);
  163. extern pipi_image_t *pipi_dither_dbs(pipi_image_t *);
  164. extern void pipi_dither_24to16(pipi_image_t *);
  165. extern pipi_histogram_t* pipi_new_histogram(void);
  166. extern int pipi_get_image_histogram(pipi_image_t *, pipi_histogram_t *, int);
  167. extern int pipi_free_histogram(pipi_histogram_t*);
  168. extern int pipi_render_histogram(pipi_image_t *, pipi_histogram_t*, int);
  169. #ifdef __cplusplus
  170. }
  171. #endif
  172. #endif /* __PIPI_H__ */