1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 04:20:27 +01:00

fixed image clearing

This commit is contained in:
kojima
2000-03-07 01:12:12 +00:00
parent 0f9aa277c1
commit b974bd7e78
4 changed files with 52 additions and 9 deletions

View File

@@ -91,6 +91,33 @@ RBevelImage(RImage *image, int bevel_type)
void
RClearImage(RImage *image, RColor *color)
{
if (image->format == RRGBAFormat) {
unsigned char *d = image->data;
int i;
for (i = 0; i < image->width; i++) {
*d++ = color->red;
*d++ = color->green;
*d++ = color->blue;
*d++ = color->alpha;
}
for (i = 1; i < image->height; i++, d += image->width*4) {
memcpy(d, image->data, image->width*4);
}
} else {
unsigned char *d = image->data;
int i;
for (i = 0; i < image->width; i++) {
*d++ = color->red;
*d++ = color->green;
*d++ = color->blue;
}
for (i = 1; i < image->height; i++, d += image->width*3) {
memcpy(d, image->data, image->width*3);
}
}
#if 0
if (color->alpha==255) {
if (image->format == RRGBAFormat) {
unsigned char *d = image->data;
@@ -144,6 +171,7 @@ RClearImage(RImage *image, RColor *color)
}
}
}
#endif
}
const char*