116
101
* Drawing functions
120
_background_lucido_path_create( cairo_t *cr,
132
gdouble x1 = x+dx+dcurve;
133
gdouble x2 = x+w-dx-dcurve;
139
// cairo_new_path(cr);
140
cairo_rectangle(cr,x,y,x+w,y2);
105
_background_lucido_path_create(cairo_t *cr,
116
gdouble dx = ( w - stripe * w );
117
gdouble x1 = x + dx * symmetry + dcurve;
118
gdouble x2 = x + w - dx * ( 1.0 - symmetry ) - dcurve;
143
121
cairo_new_path(cr);
146
cairo_move_to(cr,x+dx,y);
148
cairo_curve_to(cr,x1,y,x1,y2-5,x1+dcurve,y2-5);
150
cairo_line_to(cr,x2-dcurve,y2-5);
152
cairo_curve_to(cr,x2,y2-5,x2,y,x2+dcurve,y);
154
cairo_move_to(cr,x,y);
155
cairo_line_to(cr,x+dx,y);
157
cairo_curve_to(cr,x1,y,x1,y2-5,x1+dcurve,y2-5);
159
cairo_line_to(cr,x2-dcurve,y2-5);
161
cairo_curve_to(cr,x2,y2-5,x2,y,x2+dcurve,y);
163
cairo_line_to(cr,x+w,y);
164
cairo_line_to(cr,x+w,y2);
165
cairo_line_to(cr,x,y2);
167
cairo_close_path(cr);
125
cairo_move_to(cr, x1 - dcurve, y);
127
cairo_curve_to(cr, x1, y, x1, y2 - 5, x1 + dcurve, y2 - 5);
129
cairo_line_to(cr, x2 - dcurve, y2 - 5);
131
cairo_curve_to(cr, x2, y2 - 5, x2, y, x2 + dcurve, y);
135
cairo_move_to(cr, x, y);
136
cairo_line_to(cr, x1 - dcurve, y);
138
cairo_curve_to(cr, x1, y, x1, y2 - 5, x1 + dcurve, y2 - 5);
140
cairo_line_to(cr, x2 - dcurve, y2 - 5);
142
cairo_curve_to(cr, x2, y2 - 5, x2, y, x2 + dcurve, y);
144
cairo_line_to(cr, x + w, y);
145
cairo_line_to(cr, x + w, y2);
146
cairo_line_to(cr, x, y2);
149
cairo_close_path(cr);
170
draw_top_bottom_background (AwnBackground *bg,
152
draw_top_bottom_background(AwnBackground *bg,
175
157
cairo_pattern_t *pat;
176
158
cairo_pattern_t *pat_hi;
178
160
/* Make sure the bar gets drawn on the 0.5 pixels (for sharp edges) */
179
cairo_translate (cr, 0.5, 0.5);
161
cairo_translate(cr, 0.5, 0.5);
181
163
/* Basic set-up */
182
cairo_set_line_width (cr, 1.0);
183
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
164
cairo_set_line_width(cr, 1.0);
165
cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
185
if (gtk_widget_is_composited (GTK_WIDGET (bg->panel)) == FALSE)
167
if(gtk_widget_is_composited(GTK_WIDGET(bg->panel)) == FALSE)
187
169
goto paint_lines;
190
gfloat fill = bg->curves_symmetry;
172
gfloat fill = bg->stripe_width;
191
173
gfloat curve_width = bg->curviness;
174
gfloat symmetry = bg->curves_symmetry;
193
176
/* Prepare the internal background */
194
pat = cairo_pattern_create_linear (0, 0, 0, height);
195
awn_cairo_pattern_add_color_stop_color (pat, 0.0, bg->border_color);
196
awn_cairo_pattern_add_color_stop_color (pat, 1.0, bg->hilight_color);
177
pat = cairo_pattern_create_linear(0, 0, 0, height);
178
awn_cairo_pattern_add_color_stop_color(pat, 0.0, bg->border_color);
179
awn_cairo_pattern_add_color_stop_color(pat, 1.0, bg->hilight_color);
198
181
/* Draw the internal background */
200
_background_lucido_path_create(cr,-1,0,width+2,height,fill,curve_width,1);
202
cairo_set_source (cr, pat);
205
cairo_pattern_destroy (pat);
183
_background_lucido_path_create(cr, -1, 0, width + 2, height,
184
fill, curve_width, symmetry, 1);
186
cairo_set_source(cr, pat);
189
cairo_pattern_destroy(pat);
207
191
/* Draw internal pattern if needed */
208
if( fill<0.5 && bg->enable_pattern && bg->pattern )
192
if(fill < 0.5 && bg->enable_pattern && bg->pattern)
210
194
/* Prepare pattern */
211
pat = cairo_pattern_create_for_surface (bg->pattern);
212
cairo_pattern_set_extend (pat, CAIRO_EXTEND_REPEAT);
195
pat = cairo_pattern_create_for_surface(bg->pattern);
196
cairo_pattern_set_extend(pat, CAIRO_EXTEND_REPEAT);
215
_background_lucido_path_create(cr,-1,0,width+2,height,fill,curve_width,1);
217
cairo_set_source (cr, pat);
220
cairo_pattern_destroy (pat);
199
_background_lucido_path_create(cr, -1, 0, width + 2, height,
200
fill, curve_width, symmetry , 1);
202
cairo_set_source(cr, pat);
205
cairo_pattern_destroy(pat);
223
208
/* Draw the hi-light (internal) */
224
pat_hi = cairo_pattern_create_linear (0, 0, 0, (height/3.0));
225
awn_cairo_pattern_add_color_stop_color (pat_hi, 0.0, bg->g_histep_1);
226
awn_cairo_pattern_add_color_stop_color (pat_hi, 1.0, bg->g_histep_2);
227
cairo_rectangle (cr,0,0,width,height/3.0);
228
cairo_set_source (cr, pat_hi);
230
cairo_pattern_destroy (pat_hi);
233
/* Prepare external background */
234
pat = cairo_pattern_create_linear (0, 0, 0, height);
235
awn_cairo_pattern_add_color_stop_color (pat, 0.0, bg->g_step_1);
236
awn_cairo_pattern_add_color_stop_color (pat, 1.0, bg->g_step_2);
209
pat_hi = cairo_pattern_create_linear(0, 0, 0, (height / 3.0));
210
awn_cairo_pattern_add_color_stop_color(pat_hi, 0.0, bg->g_histep_1);
211
awn_cairo_pattern_add_color_stop_color(pat_hi, 1.0, bg->g_histep_2);
212
cairo_rectangle(cr, 0, 0, width, height / 3.0);
213
cairo_set_source(cr, pat_hi);
215
cairo_pattern_destroy(pat_hi);
218
/* Prepare external background */
219
pat = cairo_pattern_create_linear(0, 0, 0, height);
220
awn_cairo_pattern_add_color_stop_color(pat, 0.0, bg->g_step_1);
221
awn_cairo_pattern_add_color_stop_color(pat, 1.0, bg->g_step_2);
237
222
/* Draw the external background */
239
_background_lucido_path_create(cr,-1,0,width+2,height,fill,curve_width,0);
241
cairo_set_source (cr, pat);
244
cairo_pattern_destroy (pat);
224
_background_lucido_path_create(cr, -1, 0, width + 2, height,
225
fill, curve_width, symmetry, 0);
227
cairo_set_source(cr, pat);
230
cairo_pattern_destroy(pat);
246
232
/* Draw external pattern if needed */
247
if( fill>0.5 && bg->enable_pattern && bg->pattern )
233
if(fill > 0.5 && bg->enable_pattern && bg->pattern)
249
235
/* Prepare pattern */
250
pat = cairo_pattern_create_for_surface (bg->pattern);
251
cairo_pattern_set_extend (pat, CAIRO_EXTEND_REPEAT);
236
pat = cairo_pattern_create_for_surface(bg->pattern);
237
cairo_pattern_set_extend(pat, CAIRO_EXTEND_REPEAT);
254
_background_lucido_path_create(cr,-1,0,width+2,height,fill,curve_width,0);
256
cairo_set_source (cr, pat);
259
cairo_pattern_destroy (pat);
240
_background_lucido_path_create(cr, -1, 0, width + 2, height,
241
fill, curve_width, symmetry, 0);
243
cairo_set_source(cr, pat);
246
cairo_pattern_destroy(pat);
263
250
// if not composited
266
253
/* Internal border */
267
awn_cairo_set_source_color (cr, bg->hilight_color);
268
//draw_rect (bg, cr, position, 1, 1, width-3, height+3, align, expand);
269
cairo_rectangle (cr,1,1,width-3,height+3);
254
awn_cairo_set_source_color(cr, bg->hilight_color);
255
cairo_rectangle(cr, 1, 1, width - 3, height + 3);
272
258
/* External border */
273
awn_cairo_set_source_color (cr, bg->border_color);
274
//draw_rect (bg, cr, position, 0, 0, width-1, height+3, align, expand);
275
cairo_rectangle (cr,1,1,width-1,height+3);
276
cairo_stroke (cr);/**/
259
awn_cairo_set_source_color(cr, bg->border_color);
260
cairo_rectangle(cr, 1, 1, width - 1, height + 3);
261
cairo_stroke(cr); /**/
281
void awn_background_lucido_padding_request (AwnBackground *bg,
282
GtkPositionType position,
284
guint *padding_bottom,
286
guint *padding_right)
266
void awn_background_lucido_padding_request(AwnBackground *bg,
267
GtkPositionType position,
269
guint *padding_bottom,
271
guint *padding_right)
288
AWN_BACKGROUND_CLASS (awn_background_lucido_parent_class)->padding_request (
289
bg, position, padding_top, padding_bottom, padding_left, padding_right);
273
AWN_BACKGROUND_CLASS(awn_background_lucido_parent_class)->padding_request(
274
bg, position, padding_top, padding_bottom, padding_left, padding_right);
295
awn_background_lucido_draw ( AwnBackground *bg,
297
GtkPositionType position,
280
awn_background_lucido_draw(AwnBackground *bg,
282
GtkPositionType position,
301
286
gint x = area->x, y = area->y;
302
287
gint width = area->width, height = area->height;
307
292
case GTK_POS_RIGHT:
308
cairo_translate (cr, x, y+height);
309
cairo_rotate (cr, M_PI * 1.5);
293
cairo_translate(cr, x, y + height);
294
cairo_rotate(cr, M_PI * 1.5);
311
width = height; height = temp;
313
299
case GTK_POS_LEFT:
314
cairo_translate (cr, x+width, y);
315
cairo_rotate (cr, M_PI * 0.5);
300
cairo_translate(cr, x + width, y);
301
cairo_rotate(cr, M_PI * 0.5);
317
width = height; height = temp;
319
306
case GTK_POS_TOP:
320
cairo_translate (cr, x+width, y+height);
321
cairo_rotate (cr, M_PI);
307
cairo_translate(cr, x + width, y + height);
308
cairo_rotate(cr, M_PI);
324
cairo_translate (cr, x, y);
311
cairo_translate(cr, x, y);
328
draw_top_bottom_background (bg, cr, width, height);
315
draw_top_bottom_background(bg, cr, width, height);
334
awn_background_lucido_get_shape_mask (AwnBackground *bg,
336
GtkPositionType position,
321
awn_background_lucido_get_shape_mask(AwnBackground *bg,
323
GtkPositionType position,
339
AWN_BACKGROUND_CLASS (awn_background_lucido_parent_class)->get_shape_mask (
340
bg, cr, position, area);
326
AWN_BACKGROUND_CLASS(awn_background_lucido_parent_class)->get_shape_mask(
327
bg, cr, position, area);
343
330
/* vim: set et ts=2 sts=2 sw=2 : */