[gtk+/rendering-cleanup: 74/95] API: remove gdk_colormap_query_color



commit 3a5bd2696a43f9f74caf1efe7cacedfc45849571
Author: Benjamin Otte <otte redhat com>
Date:   Sat Jul 31 12:47:38 2010 +0200

    API: remove gdk_colormap_query_color

 docs/reference/gdk/gdk3-sections.txt |    1 -
 docs/reference/gdk/tmpl/colors.sgml  |   10 -----
 gdk/directfb/gdkcolor-directfb.c     |   48 ------------------------
 gdk/gdk.symbols                      |    1 -
 gdk/gdkcolor.h                       |    3 --
 gdk/quartz/gdkcolor-quartz.c         |   15 --------
 gdk/win32/gdkcolor-win32.c           |   38 -------------------
 gdk/x11/gdkcolor-x11.c               |   66 ----------------------------------
 8 files changed, 0 insertions(+), 182 deletions(-)
---
diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt
index 009e5dc..a8d32e0 100644
--- a/docs/reference/gdk/gdk3-sections.txt
+++ b/docs/reference/gdk/gdk3-sections.txt
@@ -287,7 +287,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
diff --git a/docs/reference/gdk/tmpl/colors.sgml b/docs/reference/gdk/tmpl/colors.sgml
index d313f5a..28ce9b8 100644
--- a/docs/reference/gdk/tmpl/colors.sgml
+++ b/docs/reference/gdk/tmpl/colors.sgml
@@ -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>
diff --git a/gdk/directfb/gdkcolor-directfb.c b/gdk/directfb/gdkcolor-directfb.c
index 67d0f7c..77322f0 100644
--- a/gdk/directfb/gdkcolor-directfb.c
+++ b/gdk/directfb/gdkcolor-directfb.c
@@ -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)
 {
diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols
index 0412c75..06463f3 100644
--- a/gdk/gdk.symbols
+++ b/gdk/gdk.symbols
@@ -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
diff --git a/gdk/gdkcolor.h b/gdk/gdkcolor.h
index 1312991..dfb21cd 100644
--- a/gdk/gdkcolor.h
+++ b/gdk/gdkcolor.h
@@ -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);
 
diff --git a/gdk/quartz/gdkcolor-quartz.c b/gdk/quartz/gdkcolor-quartz.c
index 315dd28..9a7884d 100644
--- a/gdk/quartz/gdkcolor-quartz.c
+++ b/gdk/quartz/gdkcolor-quartz.c
@@ -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)
 {
diff --git a/gdk/win32/gdkcolor-win32.c b/gdk/win32/gdkcolor-win32.c
index 5e49907..08a16b8 100644
--- a/gdk/win32/gdkcolor-win32.c
+++ b/gdk/win32/gdkcolor-win32.c
@@ -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,
diff --git a/gdk/x11/gdkcolor-x11.c b/gdk/x11/gdkcolor-x11.c
index 2d41214..bbfae0d 100644
--- a/gdk/x11/gdkcolor-x11.c
+++ b/gdk/x11/gdkcolor-x11.c
@@ -1010,72 +1010,6 @@ gdk_colormap_alloc_colors (GdkColormap *colormap,
 }
 
 /**
- * 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
  * @xcolormap: The XID of a colormap with visual @visual



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]