[Commit]
cairo-gtk-engine/src cge-draw.c, 1.9, 1.10 cge-style.c, 1.4,
1.5 cge-style.h, 1.3, 1.4
Julien Boulnois
commit at keithp.com
Tue Aug 5 06:54:47 PDT 2003
Committed by: jboulnois
Update of /local/src/CVS/cairo-gtk-engine/src
In directory home.keithp.com:/tmp/cvs-serv8976/src
Modified Files:
cge-draw.c cge-style.c cge-style.h
Log Message:
adding alpha RC option
Index: cge-draw.c
===================================================================
RCS file: /local/src/CVS/cairo-gtk-engine/src/cge-draw.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- cge-draw.c 5 Aug 2003 02:33:54 -0000 1.9
+++ cge-draw.c 5 Aug 2003 12:54:45 -0000 1.10
@@ -1,4 +1,4 @@
-/* Cge engine for GTK+ 2.x */
+/* Cairo Gtk Engine for GTK+ 2.x */
#include "cge.h"
@@ -17,13 +17,14 @@
gboolean line_width);
static cairo_surface_t *cge_create_gradient(cairo_t *xrs,
- gint ncols,
- GdkColor *colors,
- cge_direction d,
- gint x_off,
- gint y_off,
- gint width,
- gint height);
+ gint ncols,
+ GdkColor *colors,
+ gdouble alpha,
+ cge_direction d,
+ gint x_off,
+ gint y_off,
+ gint width,
+ gint height);
/*
static void cge_draw_slider(cairo_t *xrs,
@@ -430,13 +431,14 @@
static cairo_surface_t *cge_create_gradient(cairo_t *xrs,
- gint ncols,
- GdkColor *colors,
- cge_direction d,
- gint x_off,
- gint y_off,
- gint width,
- gint height)
+ gint ncols,
+ GdkColor *colors,
+ gdouble alpha,
+ cge_direction d,
+ gint x_off,
+ gint y_off,
+ gint width,
+ gint height)
{
cairo_surface_t *sur;
cairo_matrix_t *matrix;
@@ -457,6 +459,7 @@
color_gdk_to_rgb(colors[i],&r,&g,&b);
cairo_set_rgb_color(xrs, r, g, b);
+ cairo_set_alpha(xrs,alpha);
switch (d)
{
case CGE_DIRECTION_VERTICAL:
@@ -481,7 +484,6 @@
return sur;
}
-
/*
static void cge_draw_slider(cairo_t *xrs,
GdkColor color,
@@ -666,11 +668,11 @@
cairo_save(xrs);
- x += line_width;
+ /* x += line_width;
y += line_width;
w -= line_width*2;
h -= line_width*2;
-
+ */
cairo_save(xrs);
cairo_new_path(xrs);
cairo_set_line_width(xrs, line_width/2);
@@ -693,7 +695,7 @@
cairo_save(xrs);
cairo_new_path(xrs);
- cairo_set_line_width(xrs, line_width+line_width/2);
+ cairo_set_line_width(xrs, line_width);
cairo_translate(xrs,(double)x,(double)y);
cairo_move_to(xrs, line_width/2,(double)h+line_width/2);
cairo_rel_line_to(xrs, 0, -(double)h);
@@ -763,6 +765,7 @@
h -= line_width;
}
+
cairo_translate(xrs,(double)x,(double)y);
cairo_move_to(xrs, 0,(double)round_size);
cairo_rel_curve_to (xrs,
@@ -791,13 +794,11 @@
color_gdk_to_rgb(c,&r,&g,&b);
- cairo_set_alpha(xrs,alpha);
-
cairo_set_rgb_color(xrs, r, g, b);
if(pattern!=NULL)
cairo_set_pattern(xrs,pattern);
-
+ cairo_set_alpha(xrs,alpha);
cairo_close_path(xrs);
@@ -1073,6 +1074,7 @@
gradient=cge_create_gradient(xrs,
cstyle->fill_style.gradient_colors_count[state_type],
colors,
+ cstyle->fill_style.alpha,
cstyle->fill_style.gradient_direction,
x_off,y_off,width,height);
@@ -1135,11 +1137,12 @@
else
{
color=style->bg[state_type];
+
cge_draw_box(xrs,
color,
gradient,
- 1,
+ cstyle->fill_style.alpha,
x,
y,
width,
@@ -1221,7 +1224,7 @@
cge_draw_beveled_box(xrs,
light_color,
dark_color,
- 1,
+ cstyle->line_style.alpha,
x,
y,
width,
@@ -1232,7 +1235,7 @@
cge_draw_box(xrs,
color,
NULL,
- 1,
+ cstyle->line_style.alpha,
x,
y,
width,
@@ -1468,8 +1471,8 @@
cge_draw_box_gap(xrs,
style->bg[state_type],
- gradient,
- 1,
+ NULL,
+ cstyle->fill_style.alpha,
x,y,width,height,
cstyle->fill_style.round_width,
gap_x,gap_width,
@@ -1478,7 +1481,7 @@
cge_draw_box_gap(xrs,
color,
NULL,
- 1,
+ cstyle->line_style.alpha,
x,y,width,height,
cstyle->line_style.round_width,
gap_x,gap_width,
@@ -1540,7 +1543,7 @@
cge_draw_box(xrs,
style->dark[state_type],
NULL,
- 1,
+ cstyle->line_style.alpha,
x+2,y+2,width-4,height-4,
cstyle->line_style.round_width,
FALSE,
@@ -1564,11 +1567,12 @@
cairo_t *xrs;
gint x_off=0,y_off=0;
- xrs=cairo_create();
+ xrs=cairo_create();
+
cge_gdk(xrs,window);
-
-
+ cairo_save(xrs);
gdk_get_off(window,&x_off,&y_off);
+ //cairo_translate(xrs,-(double)x_off,-(double)y_off);
//printf("detail(draw_box) : %s\n",detail);
@@ -1594,17 +1598,17 @@
height);
cge_draw_unfilled_box_from_rc(xrs,
- style,
- state_type,
- detail,
- x,
- y,
- width,
- height);
+ style,
+ state_type,
+ detail,
+ x,
+ y,
+ width,
+ height);
}
- cairo_destroy(xrs);
-
+ //cairo_destroy(xrs);
+ cairo_restore(xrs);
}
static void draw_box_gap (GtkStyle *style,
@@ -1655,7 +1659,7 @@
cge_draw_box_gap(xrs,
style->bg[state_type],
NULL,
- 1,
+ cstyle->fill_style.alpha,
x,y,width,height,
cstyle->fill_style.round_width,
gap_x,gap_width,
@@ -1664,7 +1668,7 @@
cge_draw_box_gap(xrs,
color,
NULL,
- 1,
+ cstyle->line_style.alpha,
x,y,width,height,
cstyle->line_style.round_width,
gap_x,gap_width,
@@ -1820,7 +1824,7 @@
style->fg[state_type],
NULL,
1,
- x+2,y+2,
+ x+1,y+1,
width/2-2,
TRUE,0);
}
@@ -1905,14 +1909,14 @@
cge_draw_notebook_tab(xrs,
style->bg[state_type],
gradient,
- 1,
+ cstyle->fill_style.alpha,
x,y,width,height,
cstyle->fill_style.round_width,
TRUE,0);
cge_draw_notebook_tab(xrs,
color,
NULL,
- 1,
+ cstyle->line_style.alpha,
x,y,width,height,
cstyle->line_style.round_width,
FALSE,
@@ -1945,24 +1949,24 @@
gdk_get_off(window,&x_off,&y_off);
cge_draw_filled_box_from_rc(xrs,
- style,
- state_type,
- detail,
- x_off,
- y_off,
- x,
- y,
- width,
- height);
+ style,
+ state_type,
+ detail,
+ x_off,
+ y_off,
+ x,
+ y,
+ width,
+ height);
cge_draw_unfilled_box_from_rc(xrs,
- style,
- state_type,
- detail,
- x,
- y,
- width,
- height);
+ style,
+ state_type,
+ detail,
+ x,
+ y,
+ width,
+ height);
/*
@@ -2159,12 +2163,14 @@
}
+
static void
cge_style_class_init (CgeStyleClass * klass)
{
GtkStyleClass *style_class = GTK_STYLE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
+
style_class->draw_hline = draw_hline;
style_class->draw_vline = draw_vline;
Index: cge-style.c
===================================================================
RCS file: /local/src/CVS/cairo-gtk-engine/src/cge-style.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- cge-style.c 4 Aug 2003 13:08:19 -0000 1.4
+++ cge-style.c 5 Aug 2003 12:54:45 -0000 1.5
@@ -29,6 +29,7 @@
TOKEN_GRADIENT_DIRECTION,
TOKEN_COLOR,
+ TOKEN_ALPHA,
};
@@ -52,6 +53,7 @@
{ "line_width", TOKEN_LINE_WIDTH },
{ "gradient_direction", TOKEN_GRADIENT_DIRECTION },
{ "color", TOKEN_COLOR },
+ { "alpha", TOKEN_ALPHA },
};
static guint n_theme_symbols = sizeof(theme_symbols) / sizeof(theme_symbols[0]);
@@ -267,6 +269,9 @@
case TOKEN_ROUND_WIDTH:
token = theme_parse_double (scanner, TOKEN_ROUND_WIDTH, 4.0, &retval->round_width, 0.0, 10.0);
break;
+ case TOKEN_ALPHA:
+ token = theme_parse_double (scanner, TOKEN_ALPHA, 1.0, &retval->alpha, 0.0, 1.0);
+ break;
default:
g_scanner_get_next_token (scanner);
@@ -338,7 +343,9 @@
case TOKEN_ROUND_WIDTH:
token = theme_parse_double (scanner, TOKEN_ROUND_WIDTH, 4.0, &retval->round_width, 0.0, 10.0);
break;
-
+ case TOKEN_ALPHA:
+ token = theme_parse_double (scanner, TOKEN_ALPHA, 1.0, &retval->alpha, 0.0, 1.0);
+ break;
default:
g_scanner_get_next_token (scanner);
token = G_TOKEN_RIGHT_CURLY;
@@ -425,6 +432,7 @@
gint i;
fill_style->fill_mode=CGE_FILL_SOLID;
fill_style->round_width=4;
+ fill_style->alpha=1;
fill_style->gradient_direction=CGE_DIRECTION_VERTICAL;
for(i=0;i<5;i++)
@@ -444,6 +452,7 @@
line_style->line_mode=CGE_LINE_SOLID;
line_style->line_width=1;
line_style->round_width=4;
+ line_style->alpha=1;
}
static void cge_rc_style_init (CgeRCStyle * style) {
@@ -457,7 +466,6 @@
}
style->arrow_style=CGE_ARROW_NORMAL;
-
}
static void cge_rc_style_class_init (CgeRCStyleClass * klass) {
Index: cge-style.h
===================================================================
RCS file: /local/src/CVS/cairo-gtk-engine/src/cge-style.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cge-style.h 3 Aug 2003 13:59:46 -0000 1.3
+++ cge-style.h 5 Aug 2003 12:54:45 -0000 1.4
@@ -5,7 +5,6 @@
typedef struct _cge_fill_style cge_fill_style;
typedef struct _cge_line_style cge_line_style;
-
typedef struct _CgeStyle CgeStyle;
typedef struct _CgeStyleClass CgeStyleClass;
typedef struct _CgeRCStyle CgeRCStyle;
@@ -105,6 +104,7 @@
gboolean gradient_colors_default[5];
GdkColor gradient_colors[5][MAX_GRADIENT_COLORS];
gdouble round_width;
+ gdouble alpha;
};
struct _cge_line_style
@@ -116,6 +116,7 @@
gboolean color_default[5];
GdkColor color[5];
+ gdouble alpha;
};
struct _cge_style
@@ -127,9 +128,9 @@
};
-
struct _CgeStyle {
GtkStyle parent_instance;
+
};
@@ -139,6 +140,8 @@
struct _CgeRCStyle {
GtkRcStyle parent_instance;
+
+
cge_arrow_style arrow_style;
More information about the Commit
mailing list