add interlaceColor, and support interlaced gradients
This commit is contained in:
parent
93547b5794
commit
e91814e99f
3 changed files with 28 additions and 2 deletions
|
@ -82,6 +82,23 @@ void RrRender(RrAppearance *a, int w, int h)
|
||||||
a->surface.relief==RR_RELIEF_RAISED);
|
a->surface.relief==RR_RELIEF_RAISED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (a->surface.interlaced) {
|
||||||
|
int i;
|
||||||
|
RrPixel32 *p;
|
||||||
|
|
||||||
|
r = a->surface.interlace_color->r;
|
||||||
|
g = a->surface.interlace_color->g;
|
||||||
|
b = a->surface.interlace_color->b;
|
||||||
|
current = (r << RrDefaultRedOffset)
|
||||||
|
+ (g << RrDefaultGreenOffset)
|
||||||
|
+ (b << RrDefaultBlueOffset);
|
||||||
|
p = data;
|
||||||
|
for (i = 0; i < h; i += 2, p += w)
|
||||||
|
for (x = 0; x < w; ++x, ++p)
|
||||||
|
*p = current;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void highlight(RrPixel32 *x, RrPixel32 *y, gboolean raised)
|
static void highlight(RrPixel32 *x, RrPixel32 *y, gboolean raised)
|
||||||
|
@ -166,7 +183,8 @@ static void gradient_solid(RrAppearance *l, int w, int h)
|
||||||
|
|
||||||
if (sp->interlaced) {
|
if (sp->interlaced) {
|
||||||
for (i = 0; i < h; i += 2)
|
for (i = 0; i < h; i += 2)
|
||||||
XDrawLine(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->secondary),
|
XDrawLine(RrDisplay(l->inst), l->pixmap,
|
||||||
|
RrColorGC(sp->interlace_color),
|
||||||
0, i, w, i);
|
0, i, w, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,7 @@ struct _RrSurface {
|
||||||
RrColor *border_color;
|
RrColor *border_color;
|
||||||
RrColor *bevel_dark;
|
RrColor *bevel_dark;
|
||||||
RrColor *bevel_light;
|
RrColor *bevel_light;
|
||||||
|
RrColor *interlace_color;
|
||||||
gboolean interlaced;
|
gboolean interlaced;
|
||||||
gboolean border;
|
gboolean border;
|
||||||
RrAppearance *parent;
|
RrAppearance *parent;
|
||||||
|
|
|
@ -1170,13 +1170,15 @@ static gboolean read_appearance(XrmDatabase db, const RrInstance *inst,
|
||||||
gboolean allow_trans)
|
gboolean allow_trans)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
char *rclass = create_class_name(rname), *cname, *ctoname, *bcname;
|
char *rclass = create_class_name(rname);
|
||||||
|
char *cname, *ctoname, *bcname, *icname;
|
||||||
char *rettype;
|
char *rettype;
|
||||||
XrmValue retvalue;
|
XrmValue retvalue;
|
||||||
|
|
||||||
cname = g_strconcat(rname, ".color", NULL);
|
cname = g_strconcat(rname, ".color", NULL);
|
||||||
ctoname = g_strconcat(rname, ".colorTo", NULL);
|
ctoname = g_strconcat(rname, ".colorTo", NULL);
|
||||||
bcname = g_strconcat(rname, ".borderColor", NULL);
|
bcname = g_strconcat(rname, ".borderColor", NULL);
|
||||||
|
icname = g_strconcat(rname, ".interlaceColor", NULL);
|
||||||
|
|
||||||
if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
|
if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
|
||||||
retvalue.addr != NULL) {
|
retvalue.addr != NULL) {
|
||||||
|
@ -1195,9 +1197,14 @@ static gboolean read_appearance(XrmDatabase db, const RrInstance *inst,
|
||||||
if (!read_color(db, inst, bcname,
|
if (!read_color(db, inst, bcname,
|
||||||
&value->surface.border_color))
|
&value->surface.border_color))
|
||||||
value->surface.border_color = RrColorNew(inst, 0, 0, 0);
|
value->surface.border_color = RrColorNew(inst, 0, 0, 0);
|
||||||
|
if (value->surface.interlaced)
|
||||||
|
if (!read_color(db, inst, icname,
|
||||||
|
&value->surface.interlace_color))
|
||||||
|
value->surface.interlace_color = RrColorNew(inst, 0, 0, 0);
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_free(icname);
|
||||||
g_free(bcname);
|
g_free(bcname);
|
||||||
g_free(ctoname);
|
g_free(ctoname);
|
||||||
g_free(cname);
|
g_free(cname);
|
||||||
|
|
Loading…
Reference in a new issue