mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 04:48:06 +01:00
added igradient texture
fixed some bugs
This commit is contained in:
@@ -143,7 +143,7 @@ wTextureDestroy(WScreen *scr, WTexture *texture)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* some stupid servers don't like white or black being freed...
|
||||
*/
|
||||
@@ -244,6 +244,45 @@ wTextureMakeGradient(WScreen *scr, int style, RColor *from, RColor *to)
|
||||
|
||||
|
||||
|
||||
|
||||
WTexIGradient*
|
||||
wTextureMakeIGradient(WScreen *scr, int thickness1, RColor colors1[2],
|
||||
int thickness2, RColor colors2[2])
|
||||
{
|
||||
WTexIGradient *texture;
|
||||
XGCValues gcv;
|
||||
int i;
|
||||
|
||||
|
||||
texture = wmalloc(sizeof(WTexture));
|
||||
memset(texture, 0, sizeof(WTexture));
|
||||
texture->type = WTEX_IGRADIENT;
|
||||
for (i = 0; i < 2; i++) {
|
||||
texture->colors1[i] = colors1[i];
|
||||
texture->colors2[i] = colors2[i];
|
||||
}
|
||||
texture->thickness1 = thickness1;
|
||||
texture->thickness2 = thickness2;
|
||||
if (thickness1 >= thickness2) {
|
||||
texture->normal.red = (colors1[0].red + colors1[1].red)<<7;
|
||||
texture->normal.green = (colors1[0].green + colors1[1].green)<<7;
|
||||
texture->normal.blue = (colors1[0].blue + colors1[1].blue)<<7;
|
||||
} else {
|
||||
texture->normal.red = (colors2[0].red + colors2[1].red)<<7;
|
||||
texture->normal.green = (colors2[0].green + colors2[1].green)<<7;
|
||||
texture->normal.blue = (colors2[0].blue + colors2[1].blue)<<7;
|
||||
}
|
||||
XAllocColor(dpy, scr->w_colormap, &texture->normal);
|
||||
gcv.background = gcv.foreground = texture->normal.pixel;
|
||||
gcv.graphics_exposures = False;
|
||||
texture->normal_gc = XCreateGC(dpy, scr->w_win, GCForeground|GCBackground
|
||||
|GCGraphicsExposures, &gcv);
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
|
||||
|
||||
WTexMGradient*
|
||||
wTextureMakeMGradient(WScreen *scr, int style, RColor **colors)
|
||||
{
|
||||
@@ -318,8 +357,6 @@ wTextureMakePixmap(WScreen *scr, int style, char *pixmap_file, XColor *color)
|
||||
return texture;
|
||||
}
|
||||
|
||||
|
||||
|
||||
WTexTGradient*
|
||||
wTextureMakeTGradient(WScreen *scr, int style, RColor *from, RColor *to,
|
||||
char *pixmap_file, int opacity)
|
||||
@@ -458,6 +495,14 @@ wTextureRenderImage(WTexture *texture, int width, int height,
|
||||
}
|
||||
break;
|
||||
|
||||
case WTEX_IGRADIENT:
|
||||
image = RRenderInterwovenGradient(width, height,
|
||||
texture->igradient.colors1,
|
||||
texture->igradient.thickness1,
|
||||
texture->igradient.colors2,
|
||||
texture->igradient.thickness2);
|
||||
break;
|
||||
|
||||
case WTEX_HGRADIENT:
|
||||
subtype = RGRD_HORIZONTAL;
|
||||
goto render_gradient;
|
||||
|
||||
Reference in New Issue
Block a user