additional line width argument to draw_rectangle[_gradient] in draw.c

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
marco candrian 2008-03-21 18:02:40 +01:00 committed by Julien Danjou
parent de5d82b8c2
commit b92a292e43
8 changed files with 27 additions and 25 deletions

View File

@ -441,11 +441,11 @@ redraw(void)
{
geometry.x = prompt_len;
geometry.width = x_of_previous_item - prompt_len;
draw_rectangle(globalconf.ctx, geometry, True, globalconf.styles.normal.bg);
draw_rectangle(globalconf.ctx, geometry, 1.0, True, globalconf.styles.normal.bg);
}
}
else if(geometry.width)
draw_rectangle(globalconf.ctx, geometry, True, globalconf.styles.normal.bg);
draw_rectangle(globalconf.ctx, geometry, 1.0, True, globalconf.styles.normal.bg);
simplewindow_refresh_drawable(globalconf.sw, DefaultScreen(globalconf.display));
XSync(globalconf.display, False);

View File

@ -203,7 +203,7 @@ draw_text(DrawCtx *ctx,
ssize_t len, olen;
char *buf = NULL, *utf8 = NULL;
draw_rectangle(ctx, area, True, style.bg);
draw_rectangle(ctx, area, 1.0, True, style.bg);
if(!(len = olen = a_strlen(text)))
return;
@ -324,14 +324,15 @@ draw_setup_cairo_color_source(DrawCtx *ctx, area_t rect,
/** Draw rectangle
* \param ctx Draw context
* \param geometry geometry
* \param line_width line width
* \param filled fill rectangle?
* \param color color to use
*/
void
draw_rectangle(DrawCtx *ctx, area_t geometry, Bool filled, XColor color)
draw_rectangle(DrawCtx *ctx, area_t geometry, float line_width, Bool filled, XColor color)
{
cairo_set_antialias(ctx->cr, CAIRO_ANTIALIAS_NONE);
cairo_set_line_width(ctx->cr, 1.0);
cairo_set_line_width(ctx->cr, line_width);
cairo_set_source_rgb(ctx->cr,
color.red / 65535.0,
color.green / 65535.0,
@ -353,6 +354,7 @@ draw_rectangle(DrawCtx *ctx, area_t geometry, Bool filled, XColor color)
/** Draw rectangle with gradient colors
* \param ctx Draw context
* \param geometry geometry
* \param line_width line width
* \param filled filled rectangle?
* \param pattern__x pattern start x coord
* \param pattern_width pattern width
@ -361,14 +363,14 @@ draw_rectangle(DrawCtx *ctx, area_t geometry, Bool filled, XColor color)
* \param pcolor_end color at pattern_start + pattern_width
*/
void
draw_rectangle_gradient(DrawCtx *ctx, area_t geometry, Bool filled,
draw_rectangle_gradient(DrawCtx *ctx, area_t geometry, float line_width, Bool filled,
area_t pattern_rect, XColor *pcolor,
XColor *pcolor_center, XColor *pcolor_end)
{
cairo_pattern_t *pat;
cairo_set_antialias(ctx->cr, CAIRO_ANTIALIAS_NONE);
cairo_set_line_width(ctx->cr, 1.0);
cairo_set_line_width(ctx->cr, line_width);
pat = draw_setup_cairo_color_source(ctx, pattern_rect, pcolor, pcolor_center, pcolor_end);

View File

@ -124,8 +124,8 @@ font_t *draw_font_new(Display *disp, char *fontname);
void draw_font_delete(font_t **);
void draw_text(DrawCtx *, area_t, Alignment, int, char *, style_t);
void draw_rectangle(DrawCtx *, area_t, Bool, XColor);
void draw_rectangle_gradient(DrawCtx *, area_t, Bool, area_t, XColor *, XColor *, XColor *);
void draw_rectangle(DrawCtx *, area_t, float, Bool, XColor);
void draw_rectangle_gradient(DrawCtx *, area_t, float, Bool, area_t, XColor *, XColor *, XColor *);
void draw_graph_setup(DrawCtx *);
void draw_graph(DrawCtx *, area_t, int *, int *, int, Position, area_t, XColor *, XColor *, XColor *);

View File

@ -113,7 +113,7 @@ statusbar_draw(Statusbar *statusbar)
rectangle.width = statusbar->width;
rectangle.height = statusbar->height;
draw_rectangle(statusbar->ctx, rectangle, True,
draw_rectangle(statusbar->ctx, rectangle, 1.0, True,
globalconf.screens[statusbar->screen].styles.normal.bg);
for(widget = statusbar->widgets; widget; widget = widget->next)

View File

@ -113,13 +113,13 @@ graph_draw(Widget *widget, DrawCtx *ctx, int offset,
rectangle.y = margin_top;
rectangle.width = d->size + 2;
rectangle.height = d->box_height + 2;
draw_rectangle(ctx, rectangle, False, d->bordercolor);
draw_rectangle(ctx, rectangle, 1.0, False, d->bordercolor);
rectangle.x++;
rectangle.y++;
rectangle.width = d->size;
rectangle.height -= 2;
draw_rectangle(ctx, rectangle, True, d->bg);
draw_rectangle(ctx, rectangle, 1.0, True, d->bg);
/* for graph drawing */
rectangle.x = left_offset + 2;

View File

@ -113,7 +113,7 @@ progressbar_draw(Widget *widget, DrawCtx *ctx, int offset,
rectangle.y = pb_y;
rectangle.width = pb_width;
rectangle.height = pb_height;
draw_rectangle(ctx, rectangle, False, d->bordercolor[i]);
draw_rectangle(ctx, rectangle, 1.0, False, d->bordercolor[i]);
/* new value/progress in px + pattern setup */
if(!d->reverse[i])
@ -145,10 +145,10 @@ progressbar_draw(Widget *widget, DrawCtx *ctx, int offset,
/* fg color */
if(!d->reverse[i])
draw_rectangle_gradient(ctx, rectangle, True, pattern_rect,
draw_rectangle_gradient(ctx, rectangle, 1.0, True, pattern_rect,
&(d->fg[i]), d->pfg_center[i], d->pfg_end[i]);
else /*REV: bg */
draw_rectangle(ctx, rectangle, True, d->bg[i]);
draw_rectangle(ctx, rectangle, 1.0, True, d->bg[i]);
}
/* top part */
@ -161,9 +161,9 @@ progressbar_draw(Widget *widget, DrawCtx *ctx, int offset,
/* bg color */
if(!d->reverse[i])
draw_rectangle(ctx, rectangle, True, d->bg[i]);
draw_rectangle(ctx, rectangle, 1.0, True, d->bg[i]);
else /* REV: bg */
draw_rectangle_gradient(ctx, rectangle, True, pattern_rect,
draw_rectangle_gradient(ctx, rectangle, 1.0, True, pattern_rect,
&(d->fg[i]), d->pfg_center[i], d->pfg_end[i]);
}
pb_offset += pb_width + d->gap;
@ -178,7 +178,7 @@ progressbar_draw(Widget *widget, DrawCtx *ctx, int offset,
rectangle.y = pb_y + pb_offset;
rectangle.width = pb_width;
rectangle.height = pb_height;
draw_rectangle(ctx, rectangle, False, d->bordercolor[i]);
draw_rectangle(ctx, rectangle, 1.0, False, d->bordercolor[i]);
/* new value/progress in px + pattern setup */
if(!d->reverse[i])
@ -210,10 +210,10 @@ progressbar_draw(Widget *widget, DrawCtx *ctx, int offset,
/* fg color */
if(!d->reverse[i])
draw_rectangle_gradient(ctx, rectangle, True, pattern_rect,
draw_rectangle_gradient(ctx, rectangle, 1.0, True, pattern_rect,
&(d->fg[i]), d->pfg_center[i], d->pfg_end[i]);
else /* REV: bg */
draw_rectangle(ctx, rectangle, True, d->bg[i]);
draw_rectangle(ctx, rectangle, 1.0, True, d->bg[i]);
}
/* right part */
@ -226,9 +226,9 @@ progressbar_draw(Widget *widget, DrawCtx *ctx, int offset,
/* bg color */
if(!d->reverse[i])
draw_rectangle(ctx, rectangle, True, d->bg[i]);
draw_rectangle(ctx, rectangle, 1.0, True, d->bg[i]);
else /* REV: fg */
draw_rectangle_gradient(ctx, rectangle, True, pattern_rect,
draw_rectangle_gradient(ctx, rectangle, 1.0, True, pattern_rect,
&(d->fg[i]), d->pfg_center[i], d->pfg_end[i]);
}
pb_offset += pb_height + d->gap;

View File

@ -125,7 +125,7 @@ taglist_draw(Widget *widget,
flagsize,
flagsize,
NULL, NULL };
draw_rectangle(ctx, rectangle, sel && is_client_tagged(sel, tag), style.fg);
draw_rectangle(ctx, rectangle, 1.0, sel && is_client_tagged(sel, tag), style.fg);
}
widget->area.width += w;
}

View File

@ -132,7 +132,7 @@ tasklist_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
area.height = widget->statusbar->height;
area.width = box_width;
draw_rectangle(ctx, area, True, style.bg);
draw_rectangle(ctx, area, 1.0, True, style.bg);
if((r = rule_matching_client(c)) && r->icon)
{
@ -181,7 +181,7 @@ tasklist_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
area.y = widget->area.y;
area.width = (style.font->height + 2) / 3;
area.height = (style.font->height + 2) / 3;
draw_rectangle(ctx, area, c->isfloating, style.fg);
draw_rectangle(ctx, area, 1.0, c->isfloating, style.fg);
}
else if(c->isfloating || c->ismax)
draw_circle(ctx, widget->area.x + icon_width + box_width * i,