1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-02 22:25:48 +01:00

updated translations and image files for WINGs, bug fixes in WINGs

font handling, bug fixes in wmaker and wraster
This commit is contained in:
kojima
1999-05-31 20:34:00 +00:00
parent 81d1ec430f
commit 7f36af4fdf
34 changed files with 3783 additions and 2987 deletions

View File

@@ -232,6 +232,66 @@ ROperatePixels(RImage *image, int operation, RPoint *points, int npoints,
}
static Bool
clipLineInRectangle(int xmin, int ymin, int xmax, int ymax,
int *x1, int *y1, int *x2, int *y2)
{
#define TOP (1<<0)
#define BOT (1<<1)
#define LEF (1<<2)
#define RIG (1<<3)
#define CHECK_OUT(X,Y) (((Y) > ymax ? TOP : ((Y) < ymin ? BOT : 0))\
| ((X) > xmax ? RIG : ((X) < xmin ? LEF : 0)))
int ocode1, ocode2, ocode;
int accept = 0;
int x, y;
ocode1 = CHECK_OUT(*x1, *y1);
ocode2 = CHECK_OUT(*x2, *y2);
for(;;) {
if (!ocode1 && !ocode2) { /* completely inside */
accept = 1;
break;
} else if (ocode1 & ocode2) {
break;
}
if (ocode1)
ocode = ocode1;
else
ocode = ocode2;
if (ocode & TOP) {
x = *x1 + (*x2 - *x1) * (ymax - *y1) / (*y2 - *y1);
y = ymax;
} else if (ocode & BOT) {
x = *x1 + (*x2 - *x1) * (ymin - *y1) / (*y2 - *y1);
y = ymin;
} else if (ocode & RIG) {
y = *y1 + (*y2 - *y1) * (xmax - *x1) / (*x2 - *x1);
x = xmax;
} else if (ocode & LEF) {
y = *y1 + (*y2 - *y1) * (xmax - *x1) / (*x2 - *x1);
x = xmin;
}
if (ocode == ocode1) {
*x1 = x;
*y1 = y;
ocode1 = CHECK_OUT(x, y);
} else {
*x2 = x;
*y2 = y;
ocode2 = CHECK_OUT(x, y);
}
}
return accept;
}
/*
* This routine is a generic drawing routine, based on Bresenham's line
* drawing algorithm.
@@ -243,10 +303,10 @@ genericLine(RImage *image, int x0, int y0, int x1, int y1, RColor *color,
int i, err, du, dv, du2, dv2, uofs, vofs, last;
assert(image!=NULL);
assert(x0 >= 0 && x0 <= image->width);
assert(x1 >= 0 && x1 <= image->width);
assert(y0 >= 0 && y0 <= image->height);
assert(y1 >= 0 && y1 <= image->height);
if (!clipLineInRectangle(0, 0, image->width-1, image->height-1,
&x0, &y0, &x1, &y1))
return True;
if (x0 < x1) {
du = x1 - x0;

View File

@@ -401,8 +401,8 @@ drawClip()
ROperateLine(img, RAddOperation, 22, 63-1, 22, 63, &cdelta);
/*ROperateLine(img, RAddOperation, 22, 63-1, 22, 63, &cdelta);*/ /* the bevel arround them */
ROperateLine(img, RSubtractOperation, 0, 63-22, 1, 63-22, &cdelta1);
#endif
#endif
RConvertImage(ctx, img, &pix);
XCopyArea(dpy, pix, back, ctx->copy_gc, 0, 0, 64, 64, 0, 0);
RDestroyImage(img);

View File

@@ -39,11 +39,10 @@ RGetImageFromXPMData(RContext *context, char **data)
Colormap cmap = context->cmap;
RImage *image;
XpmImage xpm;
unsigned char *color_table[3];
unsigned char *color_table[4];
unsigned char *r, *g, *b, *a;
int *p;
int i;
int transp=-1;
i = XpmCreateXpmImageFromData(data, &xpm, (XpmInfo *)NULL);
if (i!=XpmSuccess) {
@@ -81,7 +80,7 @@ RGetImageFromXPMData(RContext *context, char **data)
}
/* make color table */
for (i=0; i<3; i++) {
for (i=0; i<4; i++) {
color_table[i] = malloc(xpm.ncolors*sizeof(char));
if (!color_table[i]) {
for (i=i-1;i>=0; i--) {
@@ -102,17 +101,19 @@ RGetImageFromXPMData(RContext *context, char **data)
color_table[0][i]=0;
color_table[1][i]=0;
color_table[2][i]=0;
transp = i;
color_table[3][i]=0;
continue;
}
if (XParseColor(dpy, cmap, xpm.colorTable[i].c_color, &xcolor)) {
color_table[0][i] = xcolor.red>>8;
color_table[1][i] = xcolor.green>>8;
color_table[2][i] = xcolor.blue>>8;
color_table[3][i] = 0xff;
} else {
color_table[0][i]=0xbe;
color_table[1][i]=0xbe;
color_table[2][i]=0xbe;
color_table[0][i] = 0xbe;
color_table[1][i] = 0xbe;
color_table[2][i] = 0xbe;
color_table[3][i] = 0xff;
}
}
memset(image->data[3], 255, xpm.width*xpm.height);
@@ -123,15 +124,13 @@ RGetImageFromXPMData(RContext *context, char **data)
b = image->data[2];
a = image->data[3];
for (i=0; i<xpm.width*xpm.height; i++) {
if (*p==transp)
*a=0;
a++;
*(r++)=color_table[0][*p];
*(g++)=color_table[1][*p];
*(b++)=color_table[2][*p];
*(a++)=color_table[3][*p];
p++;
}
for(i=0; i<3; i++) {
for(i=0; i<4; i++) {
free(color_table[i]);
}
XpmFreeXpmImage(&xpm);
@@ -147,11 +146,10 @@ RLoadXPM(RContext *context, char *file, int index)
Colormap cmap = context->cmap;
RImage *image;
XpmImage xpm;
unsigned char *color_table[3];
unsigned char *color_table[4];
unsigned char *r, *g, *b, *a;
int *p;
int i;
int transp=-1;
i = XpmReadFileToXpmImage(file, &xpm, (XpmInfo *)NULL);
if (i!=XpmSuccess) {
@@ -189,7 +187,7 @@ RLoadXPM(RContext *context, char *file, int index)
}
/* make color table */
for (i=0; i<3; i++) {
for (i=0; i<4; i++) {
color_table[i] = malloc(xpm.ncolors*sizeof(char));
if (!color_table[i]) {
for (i=i-1;i>=0; i--) {
@@ -210,20 +208,21 @@ RLoadXPM(RContext *context, char *file, int index)
color_table[0][i]=0;
color_table[1][i]=0;
color_table[2][i]=0;
transp = i;
color_table[3][i]=0;
continue;
}
if (XParseColor(dpy, cmap, xpm.colorTable[i].c_color, &xcolor)) {
color_table[0][i] = xcolor.red>>8;
color_table[1][i] = xcolor.green>>8;
color_table[2][i] = xcolor.blue>>8;
color_table[3][i] = 0xff;
} else {
color_table[0][i]=0xbe;
color_table[1][i]=0xbe;
color_table[2][i]=0xbe;
color_table[0][i] = 0xbe;
color_table[1][i] = 0xbe;
color_table[2][i] = 0xbe;
color_table[3][i] = 0xff;
}
}
memset(image->data[3], 255, xpm.width*xpm.height);
/* convert pixmap to RImage */
p = (int*)xpm.data;
r = image->data[0];
@@ -231,15 +230,13 @@ RLoadXPM(RContext *context, char *file, int index)
b = image->data[2];
a = image->data[3];
for (i=0; i<xpm.width*xpm.height; i++) {
if (*p==transp)
*a=0;
a++;
*(r++)=color_table[0][*p];
*(g++)=color_table[1][*p];
*(b++)=color_table[2][*p];
*(a++)=color_table[3][*p];
p++;
}
for(i=0; i<3; i++) {
for(i=0; i<4; i++) {
free(color_table[i]);
}
XpmFreeXpmImage(&xpm);