Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

138 rader
3.3 KiB

  1. /*
  2. * libpipi Pathetic image processing interface library
  3. * Copyright (c) 2004-2009 Sam Hocevar <sam@hocevar.net>
  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_internals.h: internal types
  16. */
  17. #ifndef __PIPI_INTERNALS_H__
  18. #define __PIPI_INTERNALS_H__
  19. #include "pipi_stubs.h"
  20. #define SET_FLAG_GRAY 0x00000001
  21. #define SET_FLAG_WRAP 0x00000002
  22. #define SET_FLAG_8BIT 0x00000004
  23. struct pipi_histogram
  24. {
  25. int r_present, g_present, b_present, y_present;
  26. unsigned int a[256];
  27. unsigned int r[256];
  28. unsigned int g[256];
  29. unsigned int b[256];
  30. unsigned int y[256];
  31. };
  32. #ifdef USE_TILES
  33. #define TILE_SIZE 128
  34. struct pipi_tile
  35. {
  36. int x, y;
  37. int zoom;
  38. int refcount;
  39. pipi_format_t fmt;
  40. int plane;
  41. union { uint8_t *u8; float *f; double *d; } data;
  42. union { uint8_t u8[1]; float f[1]; double d[1]; } align;
  43. };
  44. #endif /* USE_TILES */
  45. /* pipi_image_t: the image structure. This is probably going to be the most
  46. * complex structure in the library, but right now it only has fairly normal
  47. * stuff, like width and height and pointers to pixel areas. */
  48. struct pipi_image
  49. {
  50. int w, h, pitch;
  51. #ifdef USE_TILES
  52. pipi_tile_t **tiles;
  53. int ntiles;
  54. #endif /* USE_TILES */
  55. /* A list of internal image flags.
  56. * wrap: should filters wrap around at edges?
  57. * u8: are the image samples still 8-bit per channel? */
  58. int wrap, u8;
  59. /* Translation vectors for wrap around and tiling. */
  60. int wrapx1, wrapy1, wrapx2, wrapy2;
  61. /* List of all possible pixel formats and the last active one. */
  62. pipi_pixels_t p[PIPI_PIXELS_MAX];
  63. pipi_format_t last_modified;
  64. /* Private data used by the codec */
  65. pipi_format_t codec_format;
  66. void *codec_priv;
  67. int (*codec_free)(pipi_image_t *);
  68. };
  69. struct pipi_sequence
  70. {
  71. int w, h, fps;
  72. void *codec_priv;
  73. };
  74. struct pipi_context
  75. {
  76. int nimages;
  77. pipi_image_t *images[1024]; /* FIXME: do dynamic allocation */
  78. };
  79. #ifdef USE_IMLIB2
  80. pipi_image_t *pipi_load_imlib2(const char *name);
  81. int pipi_save_imlib2(pipi_image_t *img, const char *name);
  82. #endif
  83. #ifdef USE_OPENCV
  84. pipi_image_t *pipi_load_opencv(const char *name);
  85. int pipi_save_opencv(pipi_image_t *img, const char *name);
  86. #endif
  87. #ifdef USE_SDL
  88. pipi_image_t *pipi_load_sdl(const char *name);
  89. int pipi_save_sdl(pipi_image_t *img, const char *name);
  90. #endif
  91. #ifdef USE_GDIPLUS
  92. pipi_image_t *pipi_load_gdiplus(const char *name);
  93. int pipi_save_gdiplus(pipi_image_t *img, const char *name);
  94. #endif
  95. #ifdef USE_GDI
  96. pipi_image_t *pipi_load_gdi(const char *name);
  97. int pipi_save_gdi(pipi_image_t *img, const char *name);
  98. #endif
  99. #ifdef USE_COCOA
  100. pipi_image_t *pipi_load_coreimage(const char *name);
  101. int pipi_save_coreimage(pipi_image_t *img, const char *name);
  102. #endif
  103. #ifdef USE_JPEG
  104. pipi_image_t *pipi_load_jpeg(const char *name);
  105. int pipi_save_jpeg(pipi_image_t *img, const char *name);
  106. #endif
  107. pipi_image_t *pipi_load_oric(const char *name);
  108. int pipi_save_oric(pipi_image_t *img, const char *name);
  109. #endif /* __PIPI_INTERNALS_H__ */