]> git.sur5r.net Git - glabels/blobdiff - src/color.c
Imported Upstream version 3.0.0
[glabels] / src / color.c
index e4bf3bdf192f84a54695807208123fc7ee386c3d..2a87c9e16aa2b3e2651cfd67f401244ded455445 100644 (file)
@@ -1,32 +1,30 @@
-/* -*- 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.                                       */
 /*****************************************************************************/
@@ -41,6 +39,7 @@ gl_color_set_opacity (guint   color,
         return new_color;
 }
 
+
 /*****************************************************************************/
 /* Resolve actual shadow color by adjusting opacity.                         */
 /*****************************************************************************/
@@ -57,44 +56,41 @@ gl_color_shadow (guint   base_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.                           */
 /****************************************************************************/
@@ -112,6 +108,7 @@ gl_color_node_new_default (void)
         return color_node;
 }
 
+
 /****************************************************************************/
 /* Copy a single color node.                                                 */
 /****************************************************************************/
@@ -138,6 +135,7 @@ gl_color_node_dup (glColorNode *src)
         return dst;
 }
 
+
 /****************************************************************************/
 /* Compare 2 color nodes for equality.                                       */
 /****************************************************************************/
@@ -187,6 +185,7 @@ gl_color_node_equal (glColorNode     *color_node1,
         return (strcmp (color_node1->key, color_node2->key) == 0);
 }
 
+
 /****************************************************************************/
 /* Expand single node into representative color.                            */
 /****************************************************************************/
@@ -234,6 +233,7 @@ gl_color_node_expand (glColorNode    *color_node,
         }
 }
 
+
 /****************************************************************************/
 /* Free a single color node.                                                */
 /****************************************************************************/
@@ -247,3 +247,14 @@ gl_color_node_free (glColorNode **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
+ */