gdkcc.h

Go to the documentation of this file.
00001 #ifndef __GDK_CC_H__
00002 #define __GDK_CC_H__
00003 
00004 #include <gdk/gdktypes.h>
00005 
00006 #ifdef __cplusplus
00007 extern "C" {
00008 #endif                          /* __cplusplus */
00009 
00010    typedef struct _GdkColorContextDither GdkColorContextDither;
00011    typedef struct _GdkColorContext GdkColorContext;
00012 
00013 
00014 /* Color Context modes.
00015  *
00016  * GDK_CC_MODE_UNDEFINED - unknown
00017  * GDK_CC_MODE_BW        - default B/W
00018  * GDK_CC_MODE_STD_CMAP  - has a standard colormap
00019  * GDK_CC_MODE_TRUE      - is a TrueColor/DirectColor visual
00020  * GDK_CC_MODE_MY_GRAY   - my grayramp
00021  * GDK_CC_MODE_PALETTE   - has a pre-allocated palette
00022  */
00023 
00024    typedef enum {
00025       GDK_CC_MODE_UNDEFINED,
00026       GDK_CC_MODE_BW,
00027       GDK_CC_MODE_STD_CMAP,
00028       GDK_CC_MODE_TRUE,
00029       GDK_CC_MODE_MY_GRAY,
00030       GDK_CC_MODE_PALETTE
00031    } GdkColorContextMode;
00032 
00033    struct _GdkColorContextDither {
00034       gint fast_rgb[32][32][32];        /* quick look-up table for faster rendering */
00035       gint fast_err[32][32][32];        /* internal RGB error information */
00036       gint fast_erg[32][32][32];
00037       gint fast_erb[32][32][32];
00038    };
00039 
00040    struct _GdkColorContext {
00041       GdkVisual *visual;
00042       GdkColormap *colormap;
00043 
00044       gint num_colors;          /* available no. of colors in colormap */
00045       gint max_colors;          /* maximum no. of colors */
00046       gint num_allocated;       /* no. of allocated colors */
00047 
00048       GdkColorContextMode mode;
00049       gint need_to_free_colormap;
00050       GdkAtom std_cmap_atom;
00051 
00052       gulong *clut;             /* color look-up table */
00053       GdkColor *cmap;           /* colormap */
00054 
00055       GHashTable *color_hash;   /* hash table of allocated colors */
00056       GdkColor *palette;        /* preallocated palette */
00057       gint num_palette;         /* size of palette */
00058 
00059       GdkColorContextDither *fast_dither;       /* fast dither matrix */
00060 
00061       struct {
00062          gint red;
00063          gint green;
00064          gint blue;
00065       } shifts;
00066 
00067       struct {
00068          gulong red;
00069          gulong green;
00070          gulong blue;
00071       } masks;
00072 
00073       struct {
00074          gint red;
00075          gint green;
00076          gint blue;
00077       } bits;
00078 
00079       gulong max_entry;
00080 
00081       gulong black_pixel;
00082       gulong white_pixel;
00083    };
00084 
00085    GdkColorContext *gdk_color_context_new(GdkVisual * visual,
00086                                           GdkColormap * colormap);
00087 
00088    GdkColorContext *gdk_color_context_new_mono(GdkVisual * visual,
00089                                                GdkColormap * colormap);
00090 
00091    void gdk_color_context_free(GdkColorContext * cc);
00092 
00093    gulong gdk_color_context_get_pixel(GdkColorContext * cc,
00094                                       gushort red,
00095                                       gushort green,
00096                                       gushort blue, gint * failed);
00097    void gdk_color_context_get_pixels(GdkColorContext * cc,
00098                                      gushort * reds,
00099                                      gushort * greens,
00100                                      gushort * blues,
00101                                      gint ncolors,
00102                                      gulong * colors, gint * nallocated);
00103    void gdk_color_context_get_pixels_incremental(GdkColorContext * cc,
00104                                                  gushort * reds,
00105                                                  gushort * greens,
00106                                                  gushort * blues,
00107                                                  gint ncolors,
00108                                                  gint * used,
00109                                                  gulong * colors,
00110                                                  gint * nallocated);
00111 
00112    gint gdk_color_context_query_color(GdkColorContext * cc,
00113                                       GdkColor * color);
00114    gint gdk_color_context_query_colors(GdkColorContext * cc,
00115                                        GdkColor * colors, gint num_colors);
00116 
00117    gint gdk_color_context_add_palette(GdkColorContext * cc,
00118                                       GdkColor * palette,
00119                                       gint num_palette);
00120 
00121    void gdk_color_context_init_dither(GdkColorContext * cc);
00122    void gdk_color_context_free_dither(GdkColorContext * cc);
00123 
00124    gulong gdk_color_context_get_pixel_from_palette(GdkColorContext * cc,
00125                                                    gushort * red,
00126                                                    gushort * green,
00127                                                    gushort * blue,
00128                                                    gint * failed);
00129    guchar gdk_color_context_get_index_from_palette(GdkColorContext * cc,
00130                                                    gint * red,
00131                                                    gint * green,
00132                                                    gint * blue,
00133                                                    gint * failed);
00134 
00135 
00136 #ifdef __cplusplus
00137 }
00138 #endif                          /* __cplusplus */
00139 #endif                          /* __GDK_CC_H__ */

Generated on Tue Jul 5 14:14:36 2011 for ROOT_528-00b_version by  doxygen 1.5.1