You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

117 lines
3.5 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. #ifdef __cplusplus
  21. extern "C"
  22. {
  23. #endif
  24. /* pipi_scan_t: this enum is a list of all possible scanning methods when
  25. * parsing an image’s pixels. Not all functions support all scanning paths. */
  26. typedef enum
  27. {
  28. PIPI_SCAN_RASTER = 0,
  29. PIPI_SCAN_SERPENTINE = 1
  30. }
  31. pipi_scan_t;
  32. /* pipi_format_t: this enum is a list of all possible pixel formats for
  33. * our internal images. RGBA32 is the most usual format when an image has
  34. * just been loaded, but RGBA_F is a lot better for complex operations. */
  35. typedef enum
  36. {
  37. PIPI_PIXELS_UNINITIALISED = -1,
  38. PIPI_PIXELS_RGBA32 = 0,
  39. PIPI_PIXELS_BGR24 = 1,
  40. PIPI_PIXELS_RGBA_F = 2,
  41. PIPI_PIXELS_Y_F = 3,
  42. PIPI_PIXELS_MAX = 4
  43. }
  44. pipi_format_t;
  45. /* pipi_pixels_t: this structure stores a pixel view of an image. */
  46. typedef struct
  47. {
  48. void *pixels;
  49. int w, h, pitch, bpp;
  50. size_t bytes;
  51. }
  52. pipi_pixels_t;
  53. /* pipi_image_t: the main image type */
  54. typedef struct pipi_image pipi_image_t;
  55. /* pipi_context_t: the processing stack */
  56. typedef struct pipi_context pipi_context_t;
  57. extern pipi_context_t *pipi_create_context(void);
  58. extern void pipi_destroy_context(pipi_context_t *);
  59. extern int pipi_command(pipi_context_t *, char const *, ...);
  60. extern pipi_image_t *pipi_load(char const *);
  61. extern pipi_image_t *pipi_load_stock(char const *);
  62. extern pipi_image_t *pipi_new(int, int);
  63. extern pipi_image_t *pipi_copy(pipi_image_t *);
  64. extern void pipi_free(pipi_image_t *);
  65. extern void pipi_save(pipi_image_t *, const char *);
  66. extern pipi_pixels_t *pipi_getpixels(pipi_image_t *, pipi_format_t);
  67. extern double pipi_measure_msd(pipi_image_t *, pipi_image_t *);
  68. extern double pipi_measure_rmsd(pipi_image_t *, pipi_image_t *);
  69. extern pipi_image_t *pipi_resize(pipi_image_t *, int, int);
  70. extern pipi_image_t *pipi_mean(pipi_image_t *, pipi_image_t *);
  71. extern pipi_image_t *pipi_min(pipi_image_t *, pipi_image_t *);
  72. extern pipi_image_t *pipi_max(pipi_image_t *, pipi_image_t *);
  73. extern pipi_image_t *pipi_convolution(pipi_image_t *, int, int, double[]);
  74. extern pipi_image_t *pipi_gaussian_blur(pipi_image_t *, float);
  75. extern pipi_image_t *pipi_gaussian_blur_ext(pipi_image_t *,
  76. float, float, float, float);
  77. extern pipi_image_t *pipi_box_blur(pipi_image_t *, int);
  78. extern pipi_image_t *pipi_box_blur_ext(pipi_image_t *, int, int);
  79. extern pipi_image_t *pipi_autocontrast(pipi_image_t *);
  80. extern int pipi_flood_fill(pipi_image_t *,
  81. int, int, float, float, float, float);
  82. extern pipi_image_t *pipi_dither_floydsteinberg(pipi_image_t *, pipi_scan_t);
  83. extern pipi_image_t *pipi_dither_jajuni(pipi_image_t *, pipi_scan_t);
  84. extern pipi_image_t *pipi_dither_ordered(pipi_image_t *, pipi_image_t *);
  85. extern pipi_image_t *pipi_dither_random(pipi_image_t *);
  86. extern pipi_image_t *pipi_dither_ostromoukhov(pipi_image_t *, pipi_scan_t);
  87. extern pipi_image_t *pipi_dither_dbs(pipi_image_t *);
  88. extern void pipi_dither_24to16(pipi_image_t *);
  89. #ifdef __cplusplus
  90. }
  91. #endif
  92. #endif /* __PIPI_H__ */