add RrColorGC
add a LineArt texture type for drawing a line, this is used for drawing the menu separators
This commit is contained in:
parent
6e86a42c4b
commit
cd75b454eb
2 changed files with 39 additions and 5 deletions
|
@ -97,18 +97,35 @@ void RrPaint(RrAppearance *l, Window win, gint w, gint h)
|
||||||
RrColormap(l->inst));
|
RrColormap(l->inst));
|
||||||
}
|
}
|
||||||
RrFontDraw(l->xftdraw, &l->texture[i].data.text, &tarea);
|
RrFontDraw(l->xftdraw, &l->texture[i].data.text, &tarea);
|
||||||
break;
|
break;
|
||||||
|
case RR_TEXTURE_LINE_ART:
|
||||||
|
if (!transferred) {
|
||||||
|
transferred = 1;
|
||||||
|
if (l->surface.grad != RR_SURFACE_SOLID)
|
||||||
|
pixel_data_to_pixmap(l, 0, 0, w, h);
|
||||||
|
}
|
||||||
|
g_message("%d %d -> %d %d",
|
||||||
|
l->texture[i].data.lineart.x1,
|
||||||
|
l->texture[i].data.lineart.y1,
|
||||||
|
l->texture[i].data.lineart.x2,
|
||||||
|
l->texture[i].data.lineart.y2);
|
||||||
|
XDrawLine(RrDisplay(l->inst), l->pixmap,
|
||||||
|
RrColorGC(l->texture[i].data.lineart.color),
|
||||||
|
l->texture[i].data.lineart.x1,
|
||||||
|
l->texture[i].data.lineart.y1,
|
||||||
|
l->texture[i].data.lineart.x2,
|
||||||
|
l->texture[i].data.lineart.y2);
|
||||||
|
break;
|
||||||
case RR_TEXTURE_MASK:
|
case RR_TEXTURE_MASK:
|
||||||
if (!transferred) {
|
if (!transferred) {
|
||||||
transferred = 1;
|
transferred = 1;
|
||||||
if (l->surface.grad != RR_SURFACE_SOLID)
|
if (l->surface.grad != RR_SURFACE_SOLID)
|
||||||
pixel_data_to_pixmap(l, 0, 0, w, h);
|
pixel_data_to_pixmap(l, 0, 0, w, h);
|
||||||
}
|
}
|
||||||
if (l->texture[i].data.mask.color->gc == None)
|
|
||||||
RrColorAllocateGC(l->texture[i].data.mask.color);
|
|
||||||
RrPixmapMaskDraw(l->pixmap, &l->texture[i].data.mask, &tarea);
|
RrPixmapMaskDraw(l->pixmap, &l->texture[i].data.mask, &tarea);
|
||||||
break;
|
break;
|
||||||
case RR_TEXTURE_RGBA:
|
case RR_TEXTURE_RGBA:
|
||||||
|
g_assert(!transferred);
|
||||||
RrImageDraw(l->surface.pixel_data,
|
RrImageDraw(l->surface.pixel_data,
|
||||||
&l->texture[i].data.rgba, &tarea);
|
&l->texture[i].data.rgba, &tarea);
|
||||||
break;
|
break;
|
||||||
|
@ -121,7 +138,6 @@ void RrPaint(RrAppearance *l, Window win, gint w, gint h)
|
||||||
pixel_data_to_pixmap(l, 0, 0, w, h);
|
pixel_data_to_pixmap(l, 0, 0, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
XSetWindowBackgroundPixmap(RrDisplay(l->inst), win, l->pixmap);
|
XSetWindowBackgroundPixmap(RrDisplay(l->inst), win, l->pixmap);
|
||||||
XClearWindow(RrDisplay(l->inst), win);
|
XClearWindow(RrDisplay(l->inst), win);
|
||||||
if (oldp) XFreePixmap(RrDisplay(l->inst), oldp);
|
if (oldp) XFreePixmap(RrDisplay(l->inst), oldp);
|
||||||
|
@ -288,6 +304,12 @@ void RrMinsize(RrAppearance *l, gint *w, gint *h)
|
||||||
*w += MAX(*w, l->texture[i].data.rgba.width);
|
*w += MAX(*w, l->texture[i].data.rgba.width);
|
||||||
*h += MAX(*h, l->texture[i].data.rgba.height);
|
*h += MAX(*h, l->texture[i].data.rgba.height);
|
||||||
break;
|
break;
|
||||||
|
case RR_TEXTURE_LINE_ART:
|
||||||
|
*w += MAX(*w, MAX(l->texture[i].data.lineart.x1,
|
||||||
|
l->texture[i].data.lineart.x2));
|
||||||
|
*h += MAX(*h, MAX(l->texture[i].data.lineart.y1,
|
||||||
|
l->texture[i].data.lineart.y2));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ typedef struct _RrTexture RrTexture;
|
||||||
typedef struct _RrTextureMask RrTextureMask;
|
typedef struct _RrTextureMask RrTextureMask;
|
||||||
typedef struct _RrTextureRGBA RrTextureRGBA;
|
typedef struct _RrTextureRGBA RrTextureRGBA;
|
||||||
typedef struct _RrTextureText RrTextureText;
|
typedef struct _RrTextureText RrTextureText;
|
||||||
|
typedef struct _RrTextureLineArt RrTextureLineArt;
|
||||||
typedef struct _RrPixmapMask RrPixmapMask;
|
typedef struct _RrPixmapMask RrPixmapMask;
|
||||||
typedef struct _RrInstance RrInstance;
|
typedef struct _RrInstance RrInstance;
|
||||||
typedef struct _RrColor RrColor;
|
typedef struct _RrColor RrColor;
|
||||||
|
@ -47,6 +48,7 @@ typedef enum {
|
||||||
RR_TEXTURE_NONE,
|
RR_TEXTURE_NONE,
|
||||||
RR_TEXTURE_MASK,
|
RR_TEXTURE_MASK,
|
||||||
RR_TEXTURE_TEXT,
|
RR_TEXTURE_TEXT,
|
||||||
|
RR_TEXTURE_LINE_ART,
|
||||||
RR_TEXTURE_RGBA
|
RR_TEXTURE_RGBA
|
||||||
} RrTextureType;
|
} RrTextureType;
|
||||||
|
|
||||||
|
@ -103,10 +105,19 @@ struct _RrTextureRGBA {
|
||||||
RrPixel32 *cache;
|
RrPixel32 *cache;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct _RrTextureLineArt {
|
||||||
|
RrColor *color;
|
||||||
|
gint x1;
|
||||||
|
gint y1;
|
||||||
|
gint x2;
|
||||||
|
gint y2;
|
||||||
|
};
|
||||||
|
|
||||||
union _RrTextureData {
|
union _RrTextureData {
|
||||||
RrTextureRGBA rgba;
|
RrTextureRGBA rgba;
|
||||||
RrTextureText text;
|
RrTextureText text;
|
||||||
RrTextureMask mask;
|
RrTextureMask mask;
|
||||||
|
RrTextureLineArt lineart;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _RrTexture {
|
struct _RrTexture {
|
||||||
|
@ -163,6 +174,7 @@ gint RrColorRed (const RrColor *c);
|
||||||
gint RrColorGreen (const RrColor *c);
|
gint RrColorGreen (const RrColor *c);
|
||||||
gint RrColorBlue (const RrColor *c);
|
gint RrColorBlue (const RrColor *c);
|
||||||
gulong RrColorPixel (const RrColor *c);
|
gulong RrColorPixel (const RrColor *c);
|
||||||
|
GC RrColorGC (RrColor *c);
|
||||||
|
|
||||||
RrAppearance *RrAppearanceNew (const RrInstance *inst, gint numtex);
|
RrAppearance *RrAppearanceNew (const RrInstance *inst, gint numtex);
|
||||||
RrAppearance *RrAppearanceCopy (RrAppearance *a);
|
RrAppearance *RrAppearanceCopy (RrAppearance *a);
|
||||||
|
|
Loading…
Reference in a new issue