-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-
/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * color.c: various small utilities for dealing with canvas colors
+ * color.c
+ * Copyright (C) 2002-2009 Jim Evins <evins@snaught.com>.
*
- * Copyright (C) 2002-2007 Jim Evins <evins@snaught.com>.
+ * This file is part of gLabels.
*
- * This program is free software; you can redistribute it and/or modify
+ * gLabels is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * gLabels is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * along with gLabels. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include <config.h>
#include "color.h"
#include <string.h>
+
/*****************************************************************************/
/* Apply given opacity to given color. */
/*****************************************************************************/
return new_color;
}
-/*****************************************************************************/
-/* Resolve actual shadow color by adjusting opacity. */
-/*****************************************************************************/
-guint
-gl_color_shadow (guint base_color,
- gdouble opacity,
- guint object_color)
-{
- guint color;
-
- color = gl_color_set_opacity (base_color,
- opacity * GL_COLOR_F_ALPHA (object_color));
- return color;
-}
/*****************************************************************************/
/* Convert gLabels color into a GdkColor */
GdkColor *
gl_color_to_gdk_color (guint color)
{
- GdkColor *gdk_color = NULL;
+ GdkColor *gdk_color;
- if ( GL_COLOR_F_ALPHA (color) )
- {
- gdk_color = g_new0 (GdkColor, 1);
+ gdk_color = g_new0 (GdkColor, 1);
- gdk_color->red = GL_COLOR_F_RED (color) * 65535;
- gdk_color->green = GL_COLOR_F_GREEN (color) * 65535;
- gdk_color->blue = GL_COLOR_F_BLUE (color) * 65535;
- }
+ gdk_color->red = GL_COLOR_F_RED (color) * 65535;
+ gdk_color->green = GL_COLOR_F_GREEN (color) * 65535;
+ gdk_color->blue = GL_COLOR_F_BLUE (color) * 65535;
return gdk_color;
}
+
/*****************************************************************************/
/* Convert GdkColor into a gLabels color */
/*****************************************************************************/
guint
gl_color_from_gdk_color (GdkColor *gdk_color)
{
- guint color = GL_COLOR_NONE;
+ guint color;
- if ( gdk_color )
- {
- color = GL_COLOR ((gdk_color->red >>8),
- (gdk_color->green >>8),
- (gdk_color->blue >>8));
- }
+ color = GL_COLOR ((gdk_color->red >>8),
+ (gdk_color->green >>8),
+ (gdk_color->blue >>8));
return color;
}
+
/****************************************************************************/
/* Create a single color node with default color. */
/****************************************************************************/
return color_node;
}
+
/****************************************************************************/
/* Copy a single color node. */
/****************************************************************************/
return dst;
}
+
/****************************************************************************/
/* Compare 2 color nodes for equality. */
/****************************************************************************/
return (strcmp (color_node1->key, color_node2->key) == 0);
}
+
/****************************************************************************/
/* Expand single node into representative color. */
/****************************************************************************/
}
}
+
/****************************************************************************/
/* Free a single color node. */
/****************************************************************************/
g_free (*color_node);
*color_node = NULL;
}
+
+
+
+/*
+ * Local Variables: -- emacs
+ * mode: C -- emacs
+ * c-basic-offset: 8 -- emacs
+ * tab-width: 8 -- emacs
+ * indent-tabs-mode: nil -- emacs
+ * End: -- emacs
+ */