Initial import of the CDE 2.1.30 sources from the Open Group.
[oweals/cde.git] / cde / lib / DtHelp / GifUtilsI.h
1 /* $XConsortium: GifUtilsI.h /main/3 1996/05/09 03:42:55 drk $ */
2 #ifndef _DtGifUtilsI_h
3 #define _DtGifUtilsI_h
4
5 /* Include files */
6 #include <X11/Xlib.h>
7 #include "GraphicsP.h"
8
9 /* Enumerated values */
10 enum op_t { DO_COLOR, DO_GREY };
11
12 /* Type definitions */
13 typedef unsigned char byte;
14 typedef unsigned long pixel;
15
16 /* Data structures */
17
18 typedef struct 
19   {
20     unsigned long pixel;
21     unsigned short red, green, blue;
22     unsigned short grey;
23   } GifColors;
24
25 typedef struct 
26 {
27   XImage        *f_ximage;
28   Display       *f_dpy;
29   int            f_screen;
30   Colormap       f_cmap;
31   Drawable       f_drawable;
32   GC             f_gc;
33   Visual        *f_visual;
34   unsigned int   f_ncells;
35   unsigned int   f_nplanes;
36   unsigned long  f_black;
37   unsigned long  f_white;
38   unsigned long  f_fg;
39   unsigned long  f_bg;
40   int            f_dft_depth;
41   int            f_visual_class;
42   int            f_color_map_constructed;
43   int            f_do_visual;
44   int            bits_per_pixel ;  
45   int            colors_per_pixel;
46   int            total_colors ; 
47   int            f_total_greys;
48   int            f_init_total_greys;  
49   Boolean        f_allow_reduced_colors;
50   Boolean        f_color_reduction_used;     
51   GifColors      GifCMap[64];
52   unsigned long  GifGMap[32];
53 } GifObj;
54
55 /* Function prototypes */
56
57 /* Initializes a gif object structure */
58 enum _DtGrLoadStatus InitGifObject( 
59     GifObj                *g, 
60     Display               *dpy, 
61     Drawable               drawable, 
62     Screen                *screen,
63     int                    depth, 
64     Colormap               colormap, 
65     Visual                *visual, 
66     GC                     gc,
67     enum _DtGrColorModel   colorModel, 
68     Boolean                allowReducedColors
69 );
70
71 /* Deletes resources associated with a gif object structure */
72 void DeleteGifObjectResources(
73     GifObj *g 
74 );
75
76 /* Converts a gif buffer to an X pixmap */
77 Pixmap gif_to_pixmap(
78     GifObj        *g, 
79     byte          *inbuf, 
80     unsigned int   buflen, 
81     Dimension     *w, 
82     Dimension     *h, 
83     Pixel          fg, 
84     Pixel          bg,
85     float          ratio
86 );
87
88 /* Creates a raw PPM-style image from a GIF buffer */
89 pixel **create_raw_image(
90     byte          *inbuf, 
91     unsigned int   buflen, 
92     int           *width, 
93     int           *height, 
94     int            imageNumber
95 );
96
97 /* Creates an X pixmap from a raw PPM-style image */
98 Pixmap create_pixmap(
99     GifObj    *g, 
100     pixel   **image, 
101     int        width, 
102     int        height, 
103     Pixel      fg, 
104     Pixel      bg,
105     float      ratio
106 );
107
108 /* Frees raw image data */
109 void free_raw_image(
110     pixel  **image
111 );
112
113 /* Allocates X pixels needed for the color cube */
114 int allocate_colors(
115     GifObj  *g
116 );
117
118 /* Allocates X pixels needed for greyscale rendering */
119 int allocate_greys(
120     GifObj  *g
121 );
122
123 #endif /* _DtGifUtilsI_h */
124 /* DON'T ADD ANYTHING AFTER THIS #endif */