src/wdgt-rotate-label.h
src/util.c
src/util.h
+src/color.c
+src/color.h
src/canvas-hacktext.c
src/canvas-hacktext.h
src/bonobo-mdi-child.c
wdgt-rotate-label.h \
util.c \
util.h \
+ color.c \
+ color.h \
canvas-hacktext.c \
canvas-hacktext.h \
bonobo-mdi-child.c \
--- /dev/null
+/*
+ * (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ * color.c: various small utilities for dealing with canvas colors
+ *
+ * Copyright (C) 2002 Jim Evins <evins@snaught.com>.
+ *
+ * This program 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
+ * (at your option) any later version.
+ *
+ * This program 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
+ */
+#include <config.h>
+
+#include "color.h"
+
+/*****************************************************************************/
+/* Apply given opacity to given color. */
+/*****************************************************************************/
+guint
+gl_color_set_opacity (guint color,
+ gdouble opacity)
+{
+ guint new_color;
+
+ new_color = (color & 0xFFFFFF00) | ((guint)(255.0*opacity) & 0xFF);
+}
+
--- /dev/null
+/*
+ * (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ * color.h: various small utilities for dealing with canvas colors
+ *
+ * Copyright (C) 2002 Jim Evins <evins@snaught.com>.
+ *
+ * This program 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
+ * (at your option) any later version.
+ *
+ * This program 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
+ */
+
+#ifndef __COLOR_H__
+#define __COLOR_H__
+
+#include <libgnomecanvas/gnome-canvas.h>
+
+#define GL_COLOR(r,g,b) GNOME_CANVAS_COLOR(r,g,b)
+#define GL_COLOR_A(r,g,b,a) GNOME_CANVAS_COLOR_A(r,g,b,a)
+
+#define GL_COLOR_I_RED(x) (((x)>>24) & 0xff)
+#define GL_COLOR_I_GREEN(x) (((x)>>16) & 0xff)
+#define GL_COLOR_I_BLUE(x) (((x)>>8) & 0xff)
+#define GL_COLOR_I_ALPHA(x) ( (x) & 0xff)
+
+#define GL_COLOR_F_RED(x) ( (((x)>>24) & 0xff) / 255.0 )
+#define GL_COLOR_F_GREEN(x) ( (((x)>>16) & 0xff) / 255.0 )
+#define GL_COLOR_F_BLUE(x) ( (((x)>>8) & 0xff) / 255.0 )
+#define GL_COLOR_F_ALPHA(x) ( ( (x) & 0xff) / 255.0 )
+
+extern guint gl_color_set_opacity (guint color, gdouble opacity);
+
+
+#endif /* __COLOR_H__ */
#include "debug.h"
-#define RED(x) ( (((x)>>24) & 0xff) / 255.0 )
-#define GREEN(x) ( (((x)>>16) & 0xff) / 255.0 )
-#define BLUE(x) ( (((x)>>8) & 0xff) / 255.0 )
-#define ALPHA(x) ( ( (x) & 0xff) / 255.0 )
-
/*===========================================*/
/* Private types. */
/*===========================================*/
#include "label-barcode.h"
#include "bc.h"
#include "template.h"
+#include "color.h"
#include "debug.h"
#define GL_PRINT_DEFAULT_PAPER "US Letter"
-#define RED(x) ( (((x)>>24) & 0xff) / 255.0 )
-#define GREEN(x) ( (((x)>>16) & 0xff) / 255.0 )
-#define BLUE(x) ( (((x)>>8) & 0xff) / 255.0 )
-#define ALPHA(x) ( ( (x) & 0xff) / 255.0 )
-
/*===========================================*/
/* Private types. */
/*===========================================*/
gnome_print_setfont (pi->pc, font);
gnome_print_setrgbcolor (pi->pc,
- RED (color),
- GREEN (color),
- BLUE (color));
- gnome_print_setopacity (pi->pc, ALPHA (color));
+ GL_COLOR_F_RED (color),
+ GL_COLOR_F_GREEN (color),
+ GL_COLOR_F_BLUE (color));
+ gnome_print_setopacity (pi->pc, GL_COLOR_F_ALPHA (color));
text = gl_text_node_lines_expand (lines, record);
line = g_strsplit (text, "\n", -1);
/* Paint fill color */
create_rectangle_path (pi->pc, x, y, w, h);
gnome_print_setrgbcolor (pi->pc,
- RED (fill_color),
- GREEN (fill_color),
- BLUE (fill_color));
- gnome_print_setopacity (pi->pc, ALPHA (fill_color));
+ GL_COLOR_F_RED (fill_color),
+ GL_COLOR_F_GREEN (fill_color),
+ GL_COLOR_F_BLUE (fill_color));
+ gnome_print_setopacity (pi->pc, GL_COLOR_F_ALPHA (fill_color));
gnome_print_fill (pi->pc);
/* Draw outline */
create_rectangle_path (pi->pc, x, y, w, h);
gnome_print_setrgbcolor (pi->pc,
- RED (line_color),
- GREEN (line_color),
- BLUE (line_color));
- gnome_print_setopacity (pi->pc, ALPHA (line_color));
+ GL_COLOR_F_RED (line_color),
+ GL_COLOR_F_GREEN (line_color),
+ GL_COLOR_F_BLUE (line_color));
+ gnome_print_setopacity (pi->pc, GL_COLOR_F_ALPHA (line_color));
gnome_print_setlinewidth (pi->pc, line_width);
gnome_print_stroke (pi->pc);
gnome_print_moveto (pi->pc, x, y);
gnome_print_lineto (pi->pc, x + w, y + h);
gnome_print_setrgbcolor (pi->pc,
- RED (line_color),
- GREEN (line_color),
- BLUE (line_color));
- gnome_print_setopacity (pi->pc, ALPHA (line_color));
+ GL_COLOR_F_RED (line_color),
+ GL_COLOR_F_GREEN (line_color),
+ GL_COLOR_F_BLUE (line_color));
+ gnome_print_setopacity (pi->pc, GL_COLOR_F_ALPHA (line_color));
gnome_print_setlinewidth (pi->pc, line_width);
gnome_print_stroke (pi->pc);
/* Paint fill color */
create_ellipse_path (pi->pc, x0, y0, rx, ry);
gnome_print_setrgbcolor (pi->pc,
- RED (fill_color),
- GREEN (fill_color),
- BLUE (fill_color));
- gnome_print_setopacity (pi->pc, ALPHA (fill_color));
+ GL_COLOR_F_RED (fill_color),
+ GL_COLOR_F_GREEN (fill_color),
+ GL_COLOR_F_BLUE (fill_color));
+ gnome_print_setopacity (pi->pc, GL_COLOR_F_ALPHA (fill_color));
gnome_print_fill (pi->pc);
/* Draw outline */
create_ellipse_path (pi->pc, x0, y0, rx, ry);
gnome_print_setrgbcolor (pi->pc,
- RED (line_color),
- GREEN (line_color),
- BLUE (line_color));
- gnome_print_setopacity (pi->pc, ALPHA (line_color));
+ GL_COLOR_F_RED (line_color),
+ GL_COLOR_F_GREEN (line_color),
+ GL_COLOR_F_BLUE (line_color));
+ gnome_print_setopacity (pi->pc, GL_COLOR_F_ALPHA (line_color));
gnome_print_setlinewidth (pi->pc, line_width);
gnome_print_stroke (pi->pc);
gnome_print_setfont (pi->pc, font);
gnome_print_setrgbcolor (pi->pc,
- RED (color),
- GREEN (color),
- BLUE (color));
+ GL_COLOR_F_RED (color),
+ GL_COLOR_F_GREEN (color),
+ GL_COLOR_F_BLUE (color));
gnome_print_setopacity (pi->pc,
- ALPHA (color));
+ GL_COLOR_F_ALPHA (color));
y_offset = 12.0 - gnome_font_get_descender (font);
gnome_print_moveto (pi->pc, x, y + y_offset);
gnome_print_lineto (pi->pc, x + line->x,
y + line->y + line->length);
gnome_print_setrgbcolor (pi->pc,
- RED (color),
- GREEN (color),
- BLUE (color));
+ GL_COLOR_F_RED (color),
+ GL_COLOR_F_GREEN (color),
+ GL_COLOR_F_BLUE (color));
gnome_print_setopacity (pi->pc,
- ALPHA (color));
+ GL_COLOR_F_ALPHA (color));
gnome_print_setlinewidth (pi->pc, line->width);
gnome_print_stroke (pi->pc);
}
gnome_print_setfont (pi->pc, font);
gnome_print_setrgbcolor (pi->pc,
- RED (color),
- GREEN (color),
- BLUE (color));
+ GL_COLOR_F_RED (color),
+ GL_COLOR_F_GREEN (color),
+ GL_COLOR_F_BLUE (color));
gnome_print_setopacity (pi->pc,
- ALPHA (color));
+ GL_COLOR_F_ALPHA (color));
y_offset =
bchar->y + bchar->fsize -
#include "view-text.h"
#include "view-barcode.h"
#include "xml-label.h"
+#include "color.h"
#include "debug.h"
-#define SEL_LINE_COLOR GNOME_CANVAS_COLOR_A (0, 0, 255, 128)
-#define SEL_FILL_COLOR GNOME_CANVAS_COLOR_A (192, 192, 255, 128)
+#define SEL_LINE_COLOR GL_COLOR_A (0, 0, 255, 128)
+#define SEL_FILL_COLOR GL_COLOR_A (192, 192, 255, 128)
/*===========================================*/
/* Private globals */
#include "wdgt-bc-props.h"
#include "marshal.h"
+#include "color.h"
#include "debug.h"
-#define RED(x) ( ((x)>>24) & 0xff )
-#define GREEN(x) ( ((x)>>16) & 0xff )
-#define BLUE(x) ( ((x)>>8) & 0xff )
-#define ALPHA(x) ( (x) & 0xff )
-
/*===========================================*/
/* Private types */
/*===========================================*/
/* ------- Get updated line color ------ */
gnome_color_picker_get_i8 (GNOME_COLOR_PICKER (prop->color_picker),
&r, &g, &b, &a);
- *color = GNOME_CANVAS_COLOR_A (r, g, b, a);
+ *color = GL_COLOR_A (r, g, b, a);
}
gtk_spin_button_set_value (GTK_SPIN_BUTTON (prop->scale_spin), scale);
gnome_color_picker_set_i8 (GNOME_COLOR_PICKER (prop->color_picker),
- RED (color), GREEN (color), BLUE (color),
- ALPHA (color));
-
+ GL_COLOR_I_RED (color),
+ GL_COLOR_I_GREEN (color),
+ GL_COLOR_I_BLUE (color),
+ GL_COLOR_I_ALPHA (color));
}
#include "wdgt-fill.h"
#include "marshal.h"
+#include "color.h"
#include "debug.h"
-#define RED(x) ( ((x)>>24) & 0xff )
-#define GREEN(x) ( ((x)>>16) & 0xff )
-#define BLUE(x) ( ((x)>>8) & 0xff )
-#define ALPHA(x) ( (x) & 0xff )
-
/*===========================================*/
/* Private types */
/*===========================================*/
gnome_color_picker_get_i8 (GNOME_COLOR_PICKER (fill->color_picker),
&r, &g, &b, &a);
- *color = GNOME_CANVAS_COLOR_A (r, g, b, a);
+ *color = GL_COLOR_A (r, g, b, a);
}
/*====================================================================*/
guint color)
{
gnome_color_picker_set_i8 (GNOME_COLOR_PICKER (fill->color_picker),
- RED (color), GREEN (color), BLUE (color),
- ALPHA (color));
+ GL_COLOR_I_RED (color),
+ GL_COLOR_I_GREEN (color),
+ GL_COLOR_I_BLUE (color),
+ GL_COLOR_I_ALPHA (color));
}
#include "wdgt-line.h"
#include "marshal.h"
+#include "color.h"
#include "debug.h"
-#define RED(x) ( ((x)>>24) & 0xff )
-#define GREEN(x) ( ((x)>>16) & 0xff )
-#define BLUE(x) ( ((x)>>8) & 0xff )
-#define ALPHA(x) ( (x) & 0xff )
-
/*===========================================*/
/* Private types */
/*===========================================*/
gnome_color_picker_get_i8 (GNOME_COLOR_PICKER (line->color_picker),
&r, &g, &b, &a);
- *color = GNOME_CANVAS_COLOR_A (r, g, b, a);
+ *color = GL_COLOR_A (r, g, b, a);
}
/*====================================================================*/
gtk_spin_button_set_value (GTK_SPIN_BUTTON (line->width_spin), width);
gnome_color_picker_set_i8 (GNOME_COLOR_PICKER (line->color_picker),
- RED (color), GREEN (color), BLUE (color),
- ALPHA (color));
+ GL_COLOR_I_RED (color),
+ GL_COLOR_I_GREEN (color),
+ GL_COLOR_I_BLUE (color),
+ GL_COLOR_I_ALPHA (color));
}
#include "wdgt-mini-preview.h"
#include "marshal.h"
+#include "color.h"
#include "debug.h"
#define WDGT_MINI_PREVIEW_MAX_PIXELS 175
#define SHADOW_X_OFFSET 3
#define SHADOW_Y_OFFSET 3
-#define SHADOW_COLOR GNOME_CANVAS_COLOR_A (33, 33, 33, 192)
+#define SHADOW_COLOR GL_COLOR_A (33, 33, 33, 192)
/*===========================================*/
/* Private types */
#include "wdgt-text-props.h"
#include "marshal.h"
+#include "color.h"
#include "debug.h"
-#define RED(x) ( ((x)>>24) & 0xff )
-#define GREEN(x) ( ((x)>>16) & 0xff )
-#define BLUE(x) ( ((x)>>8) & 0xff )
-#define ALPHA(x) ( (x) & 0xff )
-
/*===========================================*/
/* Private types */
/*===========================================*/
/* ------ Get updated color ------ */
gnome_color_picker_get_i8 (GNOME_COLOR_PICKER (text->color_picker),
&r, &g, &b, &a);
- *color = GNOME_CANVAS_COLOR_A (r, g, b, a);
+ *color = GL_COLOR_A (r, g, b, a);
/* ------- Get updated justification ------ */
if (gtk_toggle_button_get_active
font_italic_flag);
gnome_color_picker_set_i8 (GNOME_COLOR_PICKER (text->color_picker),
- RED (color), GREEN (color), BLUE (color),
- ALPHA (color));
+ GL_COLOR_I_RED (color),
+ GL_COLOR_I_GREEN (color),
+ GL_COLOR_I_BLUE (color),
+ GL_COLOR_I_ALPHA (color));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (text->left_button),
(just == GTK_JUSTIFY_LEFT));