No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 
 

180 líneas
6.0 KiB

  1. /*
  2. * libpipi Proper image processing implementation library
  3. * Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org>
  4. * All Rights Reserved
  5. *
  6. * $Id$
  7. *
  8. * This library is free software. It comes without any warranty, to
  9. * the extent permitted by applicable law. You can redistribute it
  10. * and/or modify it under the terms of the Do What The Fuck You Want
  11. * To Public License, Version 2, as published by Sam Hocevar. See
  12. * http://sam.zoy.org/wtfpl/COPYING for more details.
  13. */
  14. /*
  15. * pipi.h: the full libpipi public API
  16. */
  17. #ifndef __PIPI_H__
  18. #define __PIPI_H__
  19. #include <stdio.h>
  20. #include <string.h>
  21. #ifdef __cplusplus
  22. extern "C"
  23. {
  24. #endif
  25. /* pipi_scan_t: this enum is a list of all possible scanning methods when
  26. * parsing an image’s pixels. Not all functions support all scanning paths. */
  27. typedef enum
  28. {
  29. PIPI_SCAN_RASTER = 0,
  30. PIPI_SCAN_SERPENTINE = 1
  31. }
  32. pipi_scan_t;
  33. /* pipi_format_t: this enum is a list of all possible pixel formats for
  34. * our internal images. RGBA32 is the most usual format when an image has
  35. * just been loaded, but RGBA_F is a lot better for complex operations. */
  36. typedef enum
  37. {
  38. PIPI_PIXELS_UNINITIALISED = -1,
  39. PIPI_PIXELS_RGBA_C = 0,
  40. PIPI_PIXELS_BGR_C = 1,
  41. PIPI_PIXELS_RGBA_F = 2,
  42. PIPI_PIXELS_Y_F = 3,
  43. PIPI_PIXELS_MASK_C = 4,
  44. PIPI_PIXELS_MAX = 5
  45. }
  46. pipi_format_t;
  47. struct pixel_u32
  48. {
  49. uint8_t r, g, b, a;
  50. };
  51. struct pixel_float
  52. {
  53. float r, g, b, a;
  54. };
  55. typedef struct
  56. {
  57. union
  58. {
  59. struct pixel_u32 pixel_u32;
  60. struct pixel_float pixel_float;
  61. };
  62. }
  63. pipi_pixel_t;
  64. /* pipi_pixels_t: this structure stores a pixel view of an image. */
  65. typedef struct
  66. {
  67. void *pixels;
  68. int w, h, pitch, bpp;
  69. size_t bytes;
  70. }
  71. pipi_pixels_t;
  72. /* pipi_image_t: the main image type */
  73. typedef struct pipi_image pipi_image_t;
  74. /* pipi_context_t: the processing stack */
  75. typedef struct pipi_context pipi_context_t;
  76. extern pipi_context_t *pipi_create_context(void);
  77. extern void pipi_destroy_context(pipi_context_t *);
  78. extern int pipi_command(pipi_context_t *, char const *, ...);
  79. extern pipi_image_t *pipi_load(char const *);
  80. extern pipi_image_t *pipi_load_stock(char const *);
  81. extern pipi_image_t *pipi_new(int, int);
  82. extern pipi_image_t *pipi_copy(pipi_image_t *);
  83. extern void pipi_free(pipi_image_t *);
  84. extern void pipi_save(pipi_image_t *, const char *);
  85. extern pipi_pixels_t *pipi_getpixels(pipi_image_t *, pipi_format_t);
  86. extern int pipi_get_image_width(pipi_image_t *img);
  87. extern int pipi_get_image_height(pipi_image_t *img);
  88. extern int pipi_get_image_pitch(pipi_image_t *img);
  89. extern double pipi_measure_msd(pipi_image_t *, pipi_image_t *);
  90. extern double pipi_measure_rmsd(pipi_image_t *, pipi_image_t *);
  91. extern pipi_image_t *pipi_resize(pipi_image_t *, int, int);
  92. extern pipi_image_t *pipi_render_random(int, int);
  93. extern pipi_image_t *pipi_render_bayer(int, int);
  94. extern pipi_image_t *pipi_render_halftone(int, int);
  95. extern pipi_image_t *pipi_rgb(pipi_image_t *, pipi_image_t *, pipi_image_t *);
  96. extern pipi_image_t *pipi_red(pipi_image_t *);
  97. extern pipi_image_t *pipi_green(pipi_image_t *);
  98. extern pipi_image_t *pipi_blue(pipi_image_t *);
  99. extern pipi_image_t *pipi_mean(pipi_image_t *, pipi_image_t *);
  100. extern pipi_image_t *pipi_min(pipi_image_t *, pipi_image_t *);
  101. extern pipi_image_t *pipi_max(pipi_image_t *, pipi_image_t *);
  102. extern pipi_image_t *pipi_add(pipi_image_t *, pipi_image_t *);
  103. extern pipi_image_t *pipi_sub(pipi_image_t *, pipi_image_t *);
  104. extern pipi_image_t *pipi_difference(pipi_image_t *, pipi_image_t *);
  105. extern pipi_image_t *pipi_multiply(pipi_image_t *, pipi_image_t *);
  106. extern pipi_image_t *pipi_divide(pipi_image_t *, pipi_image_t *);
  107. extern pipi_image_t *pipi_screen(pipi_image_t *, pipi_image_t *);
  108. extern pipi_image_t *pipi_overlay(pipi_image_t *, pipi_image_t *);
  109. extern pipi_image_t *pipi_convolution(pipi_image_t *, int, int, double[]);
  110. extern pipi_image_t *pipi_gaussian_blur(pipi_image_t *, float);
  111. extern pipi_image_t *pipi_gaussian_blur_ext(pipi_image_t *,
  112. float, float, float, float, float);
  113. extern pipi_image_t *pipi_box_blur(pipi_image_t *, int);
  114. extern pipi_image_t *pipi_box_blur_ext(pipi_image_t *, int, int);
  115. extern pipi_image_t *pipi_brightness(pipi_image_t *, double);
  116. extern pipi_image_t *pipi_contrast(pipi_image_t *, double);
  117. extern pipi_image_t *pipi_autocontrast(pipi_image_t *);
  118. extern pipi_image_t *pipi_invert(pipi_image_t *);
  119. extern pipi_image_t *pipi_threshold(pipi_image_t *, double);
  120. extern pipi_image_t *pipi_hflip(pipi_image_t *);
  121. extern pipi_image_t *pipi_vflip(pipi_image_t *);
  122. extern pipi_image_t *pipi_rotate90(pipi_image_t *);
  123. extern pipi_image_t *pipi_rotate180(pipi_image_t *);
  124. extern pipi_image_t *pipi_rotate270(pipi_image_t *);
  125. extern pipi_image_t *pipi_median(pipi_image_t *, int);
  126. extern pipi_image_t *pipi_median_ext(pipi_image_t *, int, int);
  127. extern pipi_image_t *pipi_dilate(pipi_image_t *);
  128. extern pipi_image_t *pipi_erode(pipi_image_t *);
  129. extern pipi_image_t *pipi_order(pipi_image_t *);
  130. extern pipi_image_t *pipi_tile(pipi_image_t *, int, int);
  131. extern int pipi_flood_fill(pipi_image_t *,
  132. int, int, float, float, float, float);
  133. extern int pipi_draw_line(pipi_image_t *, int, int, int, int, uint32_t, int);
  134. extern int pipi_draw_polyline(pipi_image_t *, int const[], int const[],
  135. int , uint32_t, int);
  136. extern int pipi_draw_bezier4(pipi_image_t *,int, int, int, int, int, int, int, int, uint32_t, int, int);
  137. extern pipi_image_t *pipi_reduce(pipi_image_t *, int, double const *);
  138. extern pipi_image_t *pipi_dither_ediff(pipi_image_t *, pipi_image_t *,
  139. pipi_scan_t);
  140. extern pipi_image_t *pipi_dither_ordered(pipi_image_t *, pipi_image_t *);
  141. extern pipi_image_t *pipi_dither_halftone(pipi_image_t *, double, double);
  142. extern pipi_image_t *pipi_dither_random(pipi_image_t *);
  143. extern pipi_image_t *pipi_dither_ostromoukhov(pipi_image_t *, pipi_scan_t);
  144. extern pipi_image_t *pipi_dither_dbs(pipi_image_t *);
  145. extern void pipi_dither_24to16(pipi_image_t *);
  146. #ifdef __cplusplus
  147. }
  148. #endif
  149. #endif /* __PIPI_H__ */