API: remove gdk_colormap_query_color

This commit is contained in:
Benjamin Otte 2010-07-31 12:47:38 +02:00
parent 09fbed7bc9
commit d0d2a6f12c
8 changed files with 0 additions and 182 deletions

View File

@ -288,7 +288,6 @@ gdk_colormap_get_system
gdk_colormap_alloc_colors
gdk_colormap_alloc_color
gdk_colormap_free_colors
gdk_colormap_query_color
gdk_colormap_get_visual
gdk_colormap_get_screen
gdk_color_copy

View File

@ -116,16 +116,6 @@ The colormap structure contains the following public fields.
@n_colors:
<!-- ##### FUNCTION gdk_colormap_query_color ##### -->
<para>
</para>
@colormap:
@pixel:
@result:
<!-- ##### FUNCTION gdk_colormap_get_visual ##### -->
<para>
</para>

View File

@ -304,54 +304,6 @@ gdk_colormap_alloc_colors (GdkColormap *colormap,
return 0;
}
void
gdk_colormap_query_color (GdkColormap *colormap,
gulong pixel,
GdkColor *result)
{
GdkVisual *visual;
g_return_if_fail (GDK_IS_COLORMAP (colormap));
visual = gdk_colormap_get_visual (colormap);
switch (visual->type)
{
case GDK_VISUAL_TRUE_COLOR:
result->red = 65535. *
(gdouble)((pixel & visual->red_mask) >> visual->red_shift) /
((1 << visual->red_prec) - 1);
result->green = 65535. *
(gdouble)((pixel & visual->green_mask) >> visual->green_shift) /
((1 << visual->green_prec) - 1);
result->blue = 65535. *
(gdouble)((pixel & visual->blue_mask) >> visual->blue_shift) /
((1 << visual->blue_prec) - 1);
break;
case GDK_VISUAL_STATIC_COLOR:
case GDK_VISUAL_PSEUDO_COLOR:
if (pixel >= 0 && pixel < colormap->size)
{
result->red = colormap->colors[pixel].red;
result->green = colormap->colors[pixel].green;
result->blue = colormap->colors[pixel].blue;
}
else
g_warning ("gdk_colormap_query_color: pixel outside colormap");
break;
case GDK_VISUAL_DIRECT_COLOR:
case GDK_VISUAL_GRAYSCALE:
case GDK_VISUAL_STATIC_GRAY:
/* unsupported */
g_assert_not_reached ();
break;
}
}
IDirectFBPalette *
gdk_directfb_colormap_get_palette (GdkColormap *colormap)
{

View File

@ -318,7 +318,6 @@ gdk_colormap_new
gdk_colormap_get_type G_GNUC_CONST
gdk_colormap_alloc_colors
gdk_colormap_free_colors
gdk_colormap_query_color
gdk_colormap_get_screen
#endif
#endif

View File

@ -110,9 +110,6 @@ gboolean gdk_colormap_alloc_color (GdkColormap *colormap,
void gdk_colormap_free_colors (GdkColormap *colormap,
const GdkColor *colors,
gint n_colors);
void gdk_colormap_query_color (GdkColormap *colormap,
gulong pixel,
GdkColor *result);
GdkVisual *gdk_colormap_get_visual (GdkColormap *colormap);

View File

@ -140,21 +140,6 @@ gdk_colormap_alloc_colors (GdkColormap *colormap,
return 0;
}
void
gdk_colormap_query_color (GdkColormap *colormap,
gulong pixel,
GdkColor *result)
{
result->red = pixel >> 16 & 0xff;
result->red += result->red << 8;
result->green = pixel >> 8 & 0xff;
result->green += result->green << 8;
result->blue = pixel & 0xff;
result->blue += result->blue << 8;
}
GdkScreen*
gdk_colormap_get_screen (GdkColormap *cmap)
{

View File

@ -1120,44 +1120,6 @@ gdk_colormap_alloc_colors (GdkColormap *colormap,
return nremaining;
}
void
gdk_colormap_query_color (GdkColormap *colormap,
gulong pixel,
GdkColor *result)
{
GdkVisual *visual;
g_return_if_fail (GDK_IS_COLORMAP (colormap));
visual = gdk_colormap_get_visual (colormap);
switch (visual->type)
{
case GDK_VISUAL_DIRECT_COLOR:
case GDK_VISUAL_TRUE_COLOR:
result->red = 65535. * (double)((pixel & visual->red_mask) >> visual->red_shift) / ((1 << visual->red_prec) - 1);
result->green = 65535. * (double)((pixel & visual->green_mask) >> visual->green_shift) / ((1 << visual->green_prec) - 1);
result->blue = 65535. * (double)((pixel & visual->blue_mask) >> visual->blue_shift) / ((1 << visual->blue_prec) - 1);
break;
case GDK_VISUAL_STATIC_GRAY:
case GDK_VISUAL_GRAYSCALE:
result->red = result->green = result->blue = 65535. * (double)pixel/((1<<visual->depth) - 1);
break;
case GDK_VISUAL_STATIC_COLOR:
case GDK_VISUAL_PSEUDO_COLOR:
result->red = colormap->colors[pixel].red;
result->green = colormap->colors[pixel].green;
result->blue = colormap->colors[pixel].blue;
break;
default:
g_assert_not_reached ();
break;
}
}
static gint
gdk_colormap_match_color (GdkColormap *cmap,
GdkColor *color,

View File

@ -1009,72 +1009,6 @@ gdk_colormap_alloc_colors (GdkColormap *colormap,
return nremaining;
}
/**
* gdk_colormap_query_color:
* @colormap: a #GdkColormap
* @pixel: pixel value in hardware display format
* @result: #GdkColor with red, green, blue fields initialized
*
* Locates the RGB color in @colormap corresponding to the given
* hardware pixel @pixel. @pixel must be a valid pixel in the
* colormap; it's a programmer error to call this function with a
* pixel which is not in the colormap. Hardware pixels are normally
* obtained from gdk_colormap_alloc_colors().
*
* This function is rarely useful; it's used for example to
* implement the eyedropper feature in #GtkColorSelection.
*
**/
void
gdk_colormap_query_color (GdkColormap *colormap,
gulong pixel,
GdkColor *result)
{
XColor xcolor;
GdkVisual *visual;
GdkColormapPrivateX11 *private;
g_return_if_fail (GDK_IS_COLORMAP (colormap));
private = GDK_COLORMAP_PRIVATE_DATA (colormap);
visual = gdk_colormap_get_visual (colormap);
switch (visual->type) {
case GDK_VISUAL_DIRECT_COLOR:
case GDK_VISUAL_TRUE_COLOR:
result->red = 65535. * (double)((pixel & visual->red_mask) >> visual->red_shift) / ((1 << visual->red_prec) - 1);
result->green = 65535. * (double)((pixel & visual->green_mask) >> visual->green_shift) / ((1 << visual->green_prec) - 1);
result->blue = 65535. * (double)((pixel & visual->blue_mask) >> visual->blue_shift) / ((1 << visual->blue_prec) - 1);
break;
case GDK_VISUAL_STATIC_GRAY:
case GDK_VISUAL_GRAYSCALE:
result->red = result->green = result->blue = 65535. * (double)pixel/((1<<visual->depth) - 1);
break;
case GDK_VISUAL_STATIC_COLOR:
xcolor.pixel = pixel;
if (!private->screen->closed)
{
XQueryColor (GDK_SCREEN_XDISPLAY (private->screen), private->xcolormap, &xcolor);
result->red = xcolor.red;
result->green = xcolor.green;
result->blue = xcolor.blue;
}
else
result->red = result->green = result->blue = 0;
break;
case GDK_VISUAL_PSEUDO_COLOR:
g_return_if_fail (pixel < colormap->size);
result->red = colormap->colors[pixel].red;
result->green = colormap->colors[pixel].green;
result->blue = colormap->colors[pixel].blue;
break;
default:
g_assert_not_reached ();
break;
}
}
/**
* gdk_x11_colormap_foreign_new:
* @visual: a #GdkVisual