forked from AuroraMiddleware/gtk
New GdkColorContext object, ported from the XColorContext in XmHTML.
It compiles and links, but is *completely* untested. Feel free to pound on it. The idea is to do all color management (allocation, etc.) via a GdkColorContext so that apps will be friendly to 8-bit displays. GdkColorContext is supposed to work on all visual/depth combinations. This support, however, is lacking from the rest of Gdk/Gtk. I will try to work on that. - Federico
This commit is contained in:
parent
ad5083714e
commit
585dc6d781
@ -6,6 +6,7 @@ lib_LTLIBRARIES = libgdk.la
|
||||
|
||||
libgdk_la_SOURCES = \
|
||||
gdk.c \
|
||||
gdkcc.c \
|
||||
gdkcolor.c \
|
||||
gdkcursor.c \
|
||||
gdkdraw.c \
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Makefile.in generated automatically by automake 1.2d from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.2c from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
@ -49,12 +49,12 @@ INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
NORMAL_INSTALL = true
|
||||
PRE_INSTALL = true
|
||||
POST_INSTALL = true
|
||||
NORMAL_UNINSTALL = true
|
||||
PRE_UNINSTALL = true
|
||||
POST_UNINSTALL = true
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
CC = @CC@
|
||||
@ -78,6 +78,7 @@ lib_LTLIBRARIES = libgdk.la
|
||||
|
||||
libgdk_la_SOURCES = \
|
||||
gdk.c \
|
||||
gdkcc.c \
|
||||
gdkcolor.c \
|
||||
gdkcursor.c \
|
||||
gdkdraw.c \
|
||||
@ -145,7 +146,7 @@ X_LIBS = @X_LIBS@
|
||||
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||
X_PRE_LIBS = @X_PRE_LIBS@
|
||||
libgdk_la_LIBADD =
|
||||
libgdk_la_OBJECTS = gdk.lo gdkcolor.lo gdkcursor.lo gdkdraw.lo \
|
||||
libgdk_la_OBJECTS = gdk.lo gdkcc.lo gdkcolor.lo gdkcursor.lo gdkdraw.lo \
|
||||
gdkfont.lo gdkgc.lo gdkglobals.lo gdkimage.lo gdkinput.lo gdkpixmap.lo \
|
||||
gdkproperty.lo gdkrectangle.lo gdkselection.lo gdkvisual.lo \
|
||||
gdkwindow.lo gdkxid.lo gxid_lib.lo
|
||||
@ -165,20 +166,21 @@ DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = gtar
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
DEP_FILES = .deps/gdk.P .deps/gdkcolor.P .deps/gdkcursor.P \
|
||||
.deps/gdkdraw.P .deps/gdkfont.P .deps/gdkgc.P .deps/gdkglobals.P \
|
||||
.deps/gdkimage.P .deps/gdkinput.P .deps/gdkpixmap.P .deps/gdkproperty.P \
|
||||
.deps/gdkrectangle.P .deps/gdkselection.P .deps/gdkvisual.P \
|
||||
.deps/gdkwindow.P .deps/gdkxid.P .deps/gxid.P .deps/gxid_lib.P
|
||||
DEP_FILES = .deps/gdk.P .deps/gdkcc.P .deps/gdkcolor.P \
|
||||
.deps/gdkcursor.P .deps/gdkdraw.P .deps/gdkfont.P .deps/gdkgc.P \
|
||||
.deps/gdkglobals.P .deps/gdkimage.P .deps/gdkinput.P .deps/gdkpixmap.P \
|
||||
.deps/gdkproperty.P .deps/gdkrectangle.P .deps/gdkselection.P \
|
||||
.deps/gdkvisual.P .deps/gdkwindow.P .deps/gdkxid.P .deps/gxid.P \
|
||||
.deps/gxid_lib.P
|
||||
SOURCES = $(libgdk_la_SOURCES) $(gxid_SOURCES)
|
||||
OBJECTS = $(libgdk_la_OBJECTS) $(gxid_OBJECTS)
|
||||
|
||||
default: all
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .lo .o .s
|
||||
.SUFFIXES: .c .lo .o
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu gdk/Makefile
|
||||
|
||||
@ -201,8 +203,8 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||
$(mkinstalldirs) $(libdir)
|
||||
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo "$(LIBTOOL) --mode=install $(INSTALL_DATA) $$p $(libdir)/$$p"; \
|
||||
$(LIBTOOL) --mode=install $(INSTALL_DATA) $$p $(libdir)/$$p; \
|
||||
echo "$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(libdir)/$$p"; \
|
||||
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(libdir)/$$p; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
@ -215,12 +217,6 @@ uninstall-libLTLIBRARIES:
|
||||
.c.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.s.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.S.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.o core
|
||||
|
||||
@ -234,17 +230,11 @@ maintainer-clean-compile:
|
||||
.c.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
.s.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
.S.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
-rm -rf .libs
|
||||
|
||||
distclean-libtool:
|
||||
|
||||
@ -298,15 +288,14 @@ uninstall-gdkincludeHEADERS:
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
|
||||
ID: $(HEADERS) $(SOURCES)
|
||||
here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS)
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
test -z "$(ETAGS_ARGS)$(SOURCES)$(HEADERS)$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $(SOURCES) $(HEADERS) $(LISP) -o $$here/TAGS)
|
||||
test -z "$(ETAGS_ARGS)$(SOURCES)$(HEADERS)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $(SOURCES) $(HEADERS) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
|
57
gdk/gdk.h
57
gdk/gdk.h
@ -648,6 +648,63 @@ GdkEventMask gdk_ic_get_events (GdkIC ic);
|
||||
/* Miscellaneous */
|
||||
void gdk_event_send_clientmessage_toall(GdkEvent *event);
|
||||
|
||||
/* Color Context */
|
||||
|
||||
GdkColorContext *gdk_color_context_new (GdkVisual *visual,
|
||||
GdkColormap *colormap);
|
||||
|
||||
GdkColorContext *gdk_color_context_new_mono (GdkVisual *visual,
|
||||
GdkColormap *colormap);
|
||||
|
||||
void gdk_color_context_free (GdkColorContext *cc);
|
||||
|
||||
gulong gdk_color_context_get_pixel (GdkColorContext *cc,
|
||||
gushort red,
|
||||
gushort green,
|
||||
gushort blue,
|
||||
gint *failed);
|
||||
void gdk_color_context_get_pixels (GdkColorContext *cc,
|
||||
gushort *reds,
|
||||
gushort *greens,
|
||||
gushort *blues,
|
||||
gint ncolors,
|
||||
gulong *colors,
|
||||
gint *nallocated);
|
||||
void gdk_color_context_get_pixels_incremental (GdkColorContext *cc,
|
||||
gushort *reds,
|
||||
gushort *greens,
|
||||
gushort *blues,
|
||||
gint ncolors,
|
||||
gint *used,
|
||||
gulong *colors,
|
||||
gint *nallocated);
|
||||
|
||||
gint gdk_color_context_get_num_colors (GdkColorContext *cc);
|
||||
gint gdk_color_context_query_color (GdkColorContext *cc,
|
||||
GdkColor *color);
|
||||
gint gdk_color_context_query_colors (GdkColorContext *cc,
|
||||
GdkColor *colors,
|
||||
gint num_colors);
|
||||
|
||||
gint gdk_color_context_add_palette (GdkColorContext *cc,
|
||||
GdkColor *palette,
|
||||
gint num_palette);
|
||||
|
||||
void gdk_color_context_init_dither (GdkColorContext *cc);
|
||||
void gdk_color_context_free_dither (GdkColorContext *cc);
|
||||
|
||||
gulong gdk_color_context_get_pixel_from_palette (GdkColorContext *cc,
|
||||
gushort *red,
|
||||
gushort *green,
|
||||
gushort *blue,
|
||||
gint *failed);
|
||||
guchar gdk_color_context_get_index_from_palette (GdkColorContext *cc,
|
||||
gint *red,
|
||||
gint *green,
|
||||
gint *blue,
|
||||
gint *failed);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
1679
gdk/gdkcc.c
Normal file
1679
gdk/gdkcc.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -35,14 +35,15 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
typedef struct _GdkWindowPrivate GdkWindowPrivate;
|
||||
typedef struct _GdkWindowPrivate GdkPixmapPrivate;
|
||||
typedef struct _GdkImagePrivate GdkImagePrivate;
|
||||
typedef struct _GdkGCPrivate GdkGCPrivate;
|
||||
typedef struct _GdkColormapPrivate GdkColormapPrivate;
|
||||
typedef struct _GdkVisualPrivate GdkVisualPrivate;
|
||||
typedef struct _GdkFontPrivate GdkFontPrivate;
|
||||
typedef struct _GdkCursorPrivate GdkCursorPrivate;
|
||||
typedef struct _GdkWindowPrivate GdkWindowPrivate;
|
||||
typedef struct _GdkWindowPrivate GdkPixmapPrivate;
|
||||
typedef struct _GdkImagePrivate GdkImagePrivate;
|
||||
typedef struct _GdkGCPrivate GdkGCPrivate;
|
||||
typedef struct _GdkColormapPrivate GdkColormapPrivate;
|
||||
typedef struct _GdkVisualPrivate GdkVisualPrivate;
|
||||
typedef struct _GdkFontPrivate GdkFontPrivate;
|
||||
typedef struct _GdkCursorPrivate GdkCursorPrivate;
|
||||
typedef struct _GdkColorContextPrivate GdkColorContextPrivate;
|
||||
|
||||
|
||||
struct _GdkWindowPrivate
|
||||
@ -151,7 +152,7 @@ typedef struct _GdkDndGlobals GdkDndGlobals;
|
||||
|
||||
#ifdef USE_XIM
|
||||
|
||||
struct _GdkICPrivate
|
||||
struct _GdkICPrivate
|
||||
{
|
||||
XIC xic;
|
||||
GdkIMStyle style;
|
||||
@ -161,6 +162,59 @@ typedef struct _GdkICPrivate GdkICPrivate;
|
||||
#endif /* USE_XIM */
|
||||
|
||||
|
||||
struct _GdkColorContextPrivate
|
||||
{
|
||||
GdkColorContext color_context;
|
||||
Display *xdisplay;
|
||||
GdkVisual *visual;
|
||||
GdkColormap *colormap;
|
||||
|
||||
gint num_colors; /* available no. of colors in colormap */
|
||||
gint max_colors; /* maximum no. of colors */
|
||||
gint num_allocated; /* no. of allocated colors */
|
||||
|
||||
GdkColorContextMode mode;
|
||||
gint need_to_free_colormap;
|
||||
GdkAtom std_cmap_atom;
|
||||
|
||||
XStandardColormap std_cmap;
|
||||
gulong *clut; /* color look-up table */
|
||||
GdkColor *cmap; /* colormap */
|
||||
|
||||
GHashTable *color_hash; /* hash table of allocated colors */
|
||||
GdkColor *palette; /* preallocated palette */
|
||||
gint num_palette; /* size of palette */
|
||||
|
||||
GdkColorContextDither *fast_dither; /* fast dither matrix */
|
||||
|
||||
struct
|
||||
{
|
||||
gint red;
|
||||
gint green;
|
||||
gint blue;
|
||||
} shifts;
|
||||
|
||||
struct
|
||||
{
|
||||
gulong red;
|
||||
gulong green;
|
||||
gulong blue;
|
||||
} masks;
|
||||
|
||||
|
||||
struct {
|
||||
gint red;
|
||||
gint green;
|
||||
gint blue;
|
||||
} bits;
|
||||
|
||||
gulong max_entry;
|
||||
|
||||
gulong black_pixel;
|
||||
gulong white_pixel;
|
||||
};
|
||||
|
||||
|
||||
void gdk_window_init (void);
|
||||
void gdk_visual_init (void);
|
||||
|
||||
|
@ -40,23 +40,25 @@ extern "C" {
|
||||
/* Type definitions for the basic structures.
|
||||
*/
|
||||
|
||||
typedef gulong GdkAtom;
|
||||
typedef struct _GdkColor GdkColor;
|
||||
typedef struct _GdkColormap GdkColormap;
|
||||
typedef struct _GdkVisual GdkVisual;
|
||||
typedef struct _GdkWindowAttr GdkWindowAttr;
|
||||
typedef struct _GdkWindow GdkWindow;
|
||||
typedef struct _GdkWindow GdkPixmap;
|
||||
typedef struct _GdkWindow GdkBitmap;
|
||||
typedef struct _GdkWindow GdkDrawable;
|
||||
typedef struct _GdkImage GdkImage;
|
||||
typedef struct _GdkGCValues GdkGCValues;
|
||||
typedef struct _GdkGC GdkGC;
|
||||
typedef struct _GdkPoint GdkPoint;
|
||||
typedef struct _GdkRectangle GdkRectangle;
|
||||
typedef struct _GdkSegment GdkSegment;
|
||||
typedef struct _GdkFont GdkFont;
|
||||
typedef struct _GdkCursor GdkCursor;
|
||||
typedef gulong GdkAtom;
|
||||
typedef struct _GdkColor GdkColor;
|
||||
typedef struct _GdkColormap GdkColormap;
|
||||
typedef struct _GdkVisual GdkVisual;
|
||||
typedef struct _GdkWindowAttr GdkWindowAttr;
|
||||
typedef struct _GdkWindow GdkWindow;
|
||||
typedef struct _GdkWindow GdkPixmap;
|
||||
typedef struct _GdkWindow GdkBitmap;
|
||||
typedef struct _GdkWindow GdkDrawable;
|
||||
typedef struct _GdkImage GdkImage;
|
||||
typedef struct _GdkGCValues GdkGCValues;
|
||||
typedef struct _GdkGC GdkGC;
|
||||
typedef struct _GdkPoint GdkPoint;
|
||||
typedef struct _GdkRectangle GdkRectangle;
|
||||
typedef struct _GdkSegment GdkSegment;
|
||||
typedef struct _GdkFont GdkFont;
|
||||
typedef struct _GdkCursor GdkCursor;
|
||||
typedef struct _GdkColorContextDither GdkColorContextDither;
|
||||
typedef struct _GdkColorContext GdkColorContext;
|
||||
|
||||
typedef struct _GdkEventAny GdkEventAny;
|
||||
typedef struct _GdkEventExpose GdkEventExpose;
|
||||
@ -566,6 +568,28 @@ typedef void (*GdkInputFunction) (gpointer data,
|
||||
gint source,
|
||||
GdkInputCondition condition);
|
||||
|
||||
|
||||
/* Color Context modes.
|
||||
*
|
||||
* GDK_CC_MODE_UNDEFINED - unknown
|
||||
* GDK_CC_MODE_BW - default B/W
|
||||
* GDK_CC_MODE_STD_CMAP - has a standard colormap
|
||||
* GDK_CC_MODE_TRUE - is a TrueColor/DirectColor visual
|
||||
* GDK_CC_MODE_MY_GRAY - my grayramp
|
||||
* GDK_CC_MODE_PALETTE - has a pre-allocated palette
|
||||
*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GDK_CC_MODE_UNDEFINED,
|
||||
GDK_CC_MODE_BW,
|
||||
GDK_CC_MODE_STD_CMAP,
|
||||
GDK_CC_MODE_TRUE,
|
||||
GDK_CC_MODE_MY_GRAY,
|
||||
GDK_CC_MODE_PALETTE
|
||||
} GdkColorContextMode;
|
||||
|
||||
|
||||
/* The color type.
|
||||
* A color consists of red, green and blue values in the
|
||||
* range 0-65535 and a pixel value. The pixel value is highly
|
||||
@ -718,6 +742,19 @@ struct _GdkCursor
|
||||
GdkCursorType type;
|
||||
};
|
||||
|
||||
struct _GdkColorContextDither
|
||||
{
|
||||
gint fast_rgb[32][32][32]; /* quick look-up table for faster rendering */
|
||||
gint fast_err[32][32][32]; /* internal RGB error information */
|
||||
gint fast_erg[32][32][32];
|
||||
gint fast_erb[32][32][32];
|
||||
};
|
||||
|
||||
struct _GdkColorContext
|
||||
{
|
||||
gint dummy;
|
||||
};
|
||||
|
||||
/* Types for XInput support */
|
||||
|
||||
struct _GdkDeviceInfo
|
||||
|
1679
gdk/x11/gdkcc-x11.c
Normal file
1679
gdk/x11/gdkcc-x11.c
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user