GifUtilsI.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: GifUtilsI.h /main/3 1996/05/09 03:42:55 drk $ */
  24. #ifndef _DtGifUtilsI_h
  25. #define _DtGifUtilsI_h
  26. /* Include files */
  27. #include <X11/Xlib.h>
  28. #include "GraphicsP.h"
  29. /* Enumerated values */
  30. enum op_t { DO_COLOR, DO_GREY };
  31. /* Type definitions */
  32. typedef unsigned char byte;
  33. typedef unsigned long pixel;
  34. /* Data structures */
  35. typedef struct
  36. {
  37. unsigned long pixel;
  38. unsigned short red, green, blue;
  39. unsigned short grey;
  40. } GifColors;
  41. typedef struct
  42. {
  43. XImage *f_ximage;
  44. Display *f_dpy;
  45. int f_screen;
  46. Colormap f_cmap;
  47. Drawable f_drawable;
  48. GC f_gc;
  49. Visual *f_visual;
  50. unsigned int f_ncells;
  51. unsigned int f_nplanes;
  52. unsigned long f_black;
  53. unsigned long f_white;
  54. unsigned long f_fg;
  55. unsigned long f_bg;
  56. int f_dft_depth;
  57. int f_visual_class;
  58. int f_color_map_constructed;
  59. int f_do_visual;
  60. int bits_per_pixel ;
  61. int colors_per_pixel;
  62. int total_colors ;
  63. int f_total_greys;
  64. int f_init_total_greys;
  65. Boolean f_allow_reduced_colors;
  66. Boolean f_color_reduction_used;
  67. GifColors GifCMap[64];
  68. unsigned long GifGMap[32];
  69. } GifObj;
  70. /* Function prototypes */
  71. /* Initializes a gif object structure */
  72. enum _DtGrLoadStatus InitGifObject(
  73. GifObj *g,
  74. Display *dpy,
  75. Drawable drawable,
  76. Screen *screen,
  77. int depth,
  78. Colormap colormap,
  79. Visual *visual,
  80. GC gc,
  81. enum _DtGrColorModel colorModel,
  82. Boolean allowReducedColors
  83. );
  84. /* Deletes resources associated with a gif object structure */
  85. void DeleteGifObjectResources(
  86. GifObj *g
  87. );
  88. /* Converts a gif buffer to an X pixmap */
  89. Pixmap gif_to_pixmap(
  90. GifObj *g,
  91. byte *inbuf,
  92. unsigned int buflen,
  93. Dimension *w,
  94. Dimension *h,
  95. Pixel fg,
  96. Pixel bg,
  97. float ratio
  98. );
  99. /* Creates a raw PPM-style image from a GIF buffer */
  100. pixel **create_raw_image(
  101. byte *inbuf,
  102. unsigned int buflen,
  103. int *width,
  104. int *height,
  105. int imageNumber
  106. );
  107. /* Creates an X pixmap from a raw PPM-style image */
  108. Pixmap create_pixmap(
  109. GifObj *g,
  110. pixel **image,
  111. int width,
  112. int height,
  113. Pixel fg,
  114. Pixel bg,
  115. float ratio
  116. );
  117. /* Frees raw image data */
  118. void free_raw_image(
  119. pixel **image
  120. );
  121. /* Allocates X pixels needed for the color cube */
  122. int allocate_colors(
  123. GifObj *g
  124. );
  125. /* Allocates X pixels needed for greyscale rendering */
  126. int allocate_greys(
  127. GifObj *g
  128. );
  129. #endif /* _DtGifUtilsI_h */
  130. /* DON'T ADD ANYTHING AFTER THIS #endif */