Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

219 righe
7.1 KiB

  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. /* pipi_command_t: the command type */
  90. typedef struct
  91. {
  92. char const *name;
  93. int argc;
  94. }
  95. pipi_command_t;
  96. extern pipi_pixel_t *pipi_get_color_from_string(const char* s);
  97. char const * pipi_get_version(void);
  98. extern pipi_context_t *pipi_create_context(void);
  99. extern void pipi_destroy_context(pipi_context_t *);
  100. extern pipi_command_t const *pipi_get_command_list(void);
  101. extern int pipi_command(pipi_context_t *, char const *, ...);
  102. extern pipi_image_t *pipi_load(char const *);
  103. extern pipi_image_t *pipi_load_stock(char const *);
  104. extern pipi_image_t *pipi_new(int, int);
  105. extern pipi_image_t *pipi_copy(pipi_image_t *);
  106. extern void pipi_free(pipi_image_t *);
  107. extern int pipi_save(pipi_image_t *, const char *);
  108. extern void pipi_set_gamma(double);
  109. extern pipi_pixels_t *pipi_getpixels(pipi_image_t *, pipi_format_t);
  110. extern int pipi_get_image_width(pipi_image_t *img);
  111. extern int pipi_get_image_height(pipi_image_t *img);
  112. extern int pipi_get_image_pitch(pipi_image_t *img);
  113. extern int pipi_get_image_last_modified(pipi_image_t *img);
  114. extern const char* pipi_get_format_name(int format);
  115. extern double pipi_measure_msd(pipi_image_t *, pipi_image_t *);
  116. extern double pipi_measure_rmsd(pipi_image_t *, pipi_image_t *);
  117. extern pipi_image_t *pipi_resize(pipi_image_t *, int, int);
  118. extern pipi_image_t *pipi_render_random(int, int);
  119. extern pipi_image_t *pipi_render_bayer(int, int);
  120. extern pipi_image_t *pipi_render_halftone(int, int);
  121. extern pipi_image_t *pipi_rgb(pipi_image_t *, pipi_image_t *, pipi_image_t *);
  122. extern pipi_image_t *pipi_red(pipi_image_t *);
  123. extern pipi_image_t *pipi_green(pipi_image_t *);
  124. extern pipi_image_t *pipi_blue(pipi_image_t *);
  125. extern pipi_image_t *pipi_mean(pipi_image_t *, pipi_image_t *);
  126. extern pipi_image_t *pipi_min(pipi_image_t *, pipi_image_t *);
  127. extern pipi_image_t *pipi_max(pipi_image_t *, pipi_image_t *);
  128. extern pipi_image_t *pipi_add(pipi_image_t *, pipi_image_t *);
  129. extern pipi_image_t *pipi_sub(pipi_image_t *, pipi_image_t *);
  130. extern pipi_image_t *pipi_difference(pipi_image_t *, pipi_image_t *);
  131. extern pipi_image_t *pipi_multiply(pipi_image_t *, pipi_image_t *);
  132. extern pipi_image_t *pipi_divide(pipi_image_t *, pipi_image_t *);
  133. extern pipi_image_t *pipi_screen(pipi_image_t *, pipi_image_t *);
  134. extern pipi_image_t *pipi_overlay(pipi_image_t *, pipi_image_t *);
  135. extern pipi_image_t *pipi_convolution(pipi_image_t *, int, int, double[]);
  136. extern pipi_image_t *pipi_gaussian_blur(pipi_image_t *, float);
  137. extern pipi_image_t *pipi_gaussian_blur_ext(pipi_image_t *,
  138. float, float, float, float, float);
  139. extern pipi_image_t *pipi_box_blur(pipi_image_t *, int);
  140. extern pipi_image_t *pipi_box_blur_ext(pipi_image_t *, int, int);
  141. extern pipi_image_t *pipi_brightness(pipi_image_t *, double);
  142. extern pipi_image_t *pipi_contrast(pipi_image_t *, double);
  143. extern pipi_image_t *pipi_autocontrast(pipi_image_t *);
  144. extern pipi_image_t *pipi_invert(pipi_image_t *);
  145. extern pipi_image_t *pipi_threshold(pipi_image_t *, double);
  146. extern pipi_image_t *pipi_hflip(pipi_image_t *);
  147. extern pipi_image_t *pipi_vflip(pipi_image_t *);
  148. extern pipi_image_t *pipi_rotate90(pipi_image_t *);
  149. extern pipi_image_t *pipi_rotate180(pipi_image_t *);
  150. extern pipi_image_t *pipi_rotate270(pipi_image_t *);
  151. extern pipi_image_t *pipi_median(pipi_image_t *, int);
  152. extern pipi_image_t *pipi_median_ext(pipi_image_t *, int, int);
  153. extern pipi_image_t *pipi_dilate(pipi_image_t *);
  154. extern pipi_image_t *pipi_erode(pipi_image_t *);
  155. extern pipi_image_t *pipi_order(pipi_image_t *);
  156. extern pipi_image_t *pipi_tile(pipi_image_t *, int, int);
  157. extern int pipi_flood_fill(pipi_image_t *,
  158. int, int, float, float, float, float);
  159. extern int pipi_draw_line(pipi_image_t *, int, int, int, int, uint32_t, int);
  160. extern int pipi_draw_polyline(pipi_image_t *, int const[], int const[],
  161. int , uint32_t, int);
  162. extern int pipi_draw_bezier4(pipi_image_t *,int, int, int, int, int, int, int, int, uint32_t, int, int);
  163. extern pipi_image_t *pipi_reduce(pipi_image_t *, int, double const *);
  164. extern pipi_image_t *pipi_dither_ediff(pipi_image_t *, pipi_image_t *,
  165. pipi_scan_t);
  166. extern pipi_image_t *pipi_dither_ordered(pipi_image_t *, pipi_image_t *);
  167. extern pipi_image_t *pipi_dither_ordered_ext(pipi_image_t *, pipi_image_t *,
  168. double, double);
  169. extern pipi_image_t *pipi_dither_halftone(pipi_image_t *, double, double);
  170. extern pipi_image_t *pipi_dither_random(pipi_image_t *);
  171. extern pipi_image_t *pipi_dither_ostromoukhov(pipi_image_t *, pipi_scan_t);
  172. extern pipi_image_t *pipi_dither_dbs(pipi_image_t *);
  173. extern void pipi_dither_24to16(pipi_image_t *);
  174. extern pipi_histogram_t* pipi_new_histogram(void);
  175. extern int pipi_get_image_histogram(pipi_image_t *, pipi_histogram_t *, int);
  176. extern int pipi_free_histogram(pipi_histogram_t*);
  177. extern int pipi_render_histogram(pipi_image_t *, pipi_histogram_t*, int);
  178. #ifdef __cplusplus
  179. }
  180. #endif
  181. #endif /* __PIPI_H__ */