diff options
Diffstat (limited to 'src/create.c')
-rw-r--r-- | src/create.c | 417 |
1 files changed, 202 insertions, 215 deletions
diff --git a/src/create.c b/src/create.c index e3179f7..acae321 100644 --- a/src/create.c +++ b/src/create.c @@ -163,8 +163,9 @@ FUNC(xpmstrcasecmp, int, (char *s1, char *s2)); * which does the trick */ int -xpmstrcasecmp(s1, s2) - register char *s1, *s2; +xpmstrcasecmp( + register char *s1, + register char *s2) { register int c1, c2; @@ -185,8 +186,7 @@ xpmstrcasecmp(s1, s2) * return the default color key related to the given visual */ static int -xpmVisualType(visual) - Visual *visual; +xpmVisualType(Visual *visual) { #ifndef FOR_MSW # ifndef AMIGA @@ -235,12 +235,12 @@ closeness_cmp(Const void *a, Const void *b) * call XAllocColor and return 0 if failure, positive otherwise */ static int -AllocColor(display, colormap, colorname, xcolor, closure) - Display *display; - Colormap colormap; - char *colorname; - XColor *xcolor; - void *closure; /* not used */ +AllocColor( + Display *display, + Colormap colormap, + char *colorname, + XColor *xcolor, + void *closure) /* not used */ { int status; if (colorname) @@ -258,21 +258,20 @@ AllocColor(display, colormap, colorname, xcolor, closure) */ static int -SetCloseColor(display, colormap, visual, col, image_pixel, mask_pixel, - alloc_pixels, nalloc_pixels, attributes, cols, ncols, - allocColor, closure) - Display *display; - Colormap colormap; - Visual *visual; - XColor *col; - Pixel *image_pixel, *mask_pixel; - Pixel *alloc_pixels; - unsigned int *nalloc_pixels; - XpmAttributes *attributes; - XColor *cols; - int ncols; - XpmAllocColorFunc allocColor; - void *closure; +SetCloseColor( + Display *display, + Colormap colormap, + Visual *visual, + XColor *col, + Pixel *image_pixel, + Pixel *mask_pixel, + Pixel *alloc_pixels, + unsigned int *nalloc_pixels, + XpmAttributes *attributes, + XColor *cols, + int ncols, + XpmAllocColorFunc allocColor, + void *closure) { /* @@ -443,26 +442,24 @@ SetCloseColor(display, colormap, visual, col, image_pixel, mask_pixel, */ static int -SetColor(display, colormap, visual, colorname, color_index, - image_pixel, mask_pixel, mask_pixel_index, - alloc_pixels, nalloc_pixels, used_pixels, nused_pixels, - attributes, cols, ncols, allocColor, closure) - Display *display; - Colormap colormap; - Visual *visual; - char *colorname; - unsigned int color_index; - Pixel *image_pixel, *mask_pixel; - unsigned int *mask_pixel_index; - Pixel *alloc_pixels; - unsigned int *nalloc_pixels; - Pixel *used_pixels; - unsigned int *nused_pixels; - XpmAttributes *attributes; - XColor *cols; - int ncols; - XpmAllocColorFunc allocColor; - void *closure; +SetColor( + Display *display, + Colormap colormap, + Visual *visual, + char *colorname, + unsigned int color_index, + Pixel *image_pixel, + Pixel *mask_pixel, + unsigned int *mask_pixel_index, + Pixel *alloc_pixels, + unsigned int *nalloc_pixels, + Pixel *used_pixels, + unsigned int *nused_pixels, + XpmAttributes *attributes, + XColor *cols, + int ncols, + XpmAllocColorFunc allocColor, + void *closure) { XColor xcolor; int status; @@ -507,20 +504,18 @@ SetColor(display, colormap, visual, colorname, color_index, static int -CreateColors(display, attributes, colors, ncolors, image_pixels, mask_pixels, - mask_pixel_index, alloc_pixels, nalloc_pixels, - used_pixels, nused_pixels) - Display *display; - XpmAttributes *attributes; - XpmColor *colors; - unsigned int ncolors; - Pixel *image_pixels; - Pixel *mask_pixels; - unsigned int *mask_pixel_index; - Pixel *alloc_pixels; - unsigned int *nalloc_pixels; - Pixel *used_pixels; - unsigned int *nused_pixels; +CreateColors( + Display *display, + XpmAttributes *attributes, + XpmColor *colors, + unsigned int ncolors, + Pixel *image_pixels, + Pixel *mask_pixels, + unsigned int *mask_pixel_index, + Pixel *alloc_pixels, + unsigned int *nalloc_pixels, + Pixel *used_pixels, + unsigned int *nused_pixels) { /* variables stored in the XpmAttributes structure */ Visual *visual; @@ -739,12 +734,12 @@ CreateColors(display, attributes, colors, ncolors, image_pixels, mask_pixels, /* default FreeColors function, simply call XFreeColors */ static int -FreeColors(display, colormap, pixels, n, closure) - Display *display; - Colormap colormap; - Pixel *pixels; - int n; - void *closure; /* not used */ +FreeColors( + Display *display, + Colormap colormap, + Pixel *pixels, + int n, + void *closure) /* not used */ { return XFreeColors(display, colormap, pixels, n, 0); } @@ -761,13 +756,12 @@ do \ } while(0) int -XpmCreateImageFromXpmImage(display, image, - image_return, shapeimage_return, attributes) - Display *display; - XpmImage *image; - XImage **image_return; - XImage **shapeimage_return; - XpmAttributes *attributes; +XpmCreateImageFromXpmImage( + Display *display, + XpmImage *image, + XImage **image_return, + XImage **shapeimage_return, + XpmAttributes *attributes) { /* variables stored in the XpmAttributes structure */ Visual *visual; @@ -973,14 +967,14 @@ error: * Create an XImage with its data */ static int -CreateXImage(display, visual, depth, format, width, height, image_return) - Display *display; - Visual *visual; - unsigned int depth; - int format; - unsigned int width; - unsigned int height; - XImage **image_return; +CreateXImage( + Display *display, + Visual *visual, + unsigned int depth, + int format, + unsigned int width, + unsigned int height, + XImage **image_return) { int bitmap_pad; @@ -1072,9 +1066,9 @@ static unsigned char Const _reverse_byte[0x100] = { }; static int -_XReverse_Bytes(bpt, nb) - register unsigned char *bpt; - register unsigned int nb; +_XReverse_Bytes( + register unsigned char *bpt, + register unsigned int nb) { do { *bpt = _reverse_byte[*bpt]; @@ -1085,9 +1079,9 @@ _XReverse_Bytes(bpt, nb) void -xpm_xynormalizeimagebits(bp, img) - register unsigned char *bp; - register XImage *img; +xpm_xynormalizeimagebits( + register unsigned char *bp, + register XImage *img) { register unsigned char c; @@ -1115,9 +1109,9 @@ xpm_xynormalizeimagebits(bp, img) } void -xpm_znormalizeimagebits(bp, img) - register unsigned char *bp; - register XImage *img; +xpm_znormalizeimagebits( + register unsigned char *bp, + register XImage *img) { register unsigned char c; @@ -1160,13 +1154,13 @@ static unsigned char Const _himask[0x09] = { 0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00}; static void -_putbits(src, dstoffset, numbits, dst) - register char *src; /* address of source bit string */ - int dstoffset; /* bit offset into destination; +_putbits( + register char *src, /* address of source bit string */ + int dstoffset, /* bit offset into destination; * range is 0-31 */ - register int numbits; /* number of bits to copy to + register int numbits, /* number of bits to copy to * destination */ - register char *dst; /* address of destination bit string */ + register char *dst) /* address of destination bit string */ { register unsigned char chlo, chhi; int hibits; @@ -1208,12 +1202,12 @@ _putbits(src, dstoffset, numbits, dst) */ static void -PutImagePixels(image, width, height, pixelindex, pixels) - XImage *image; - unsigned int width; - unsigned int height; - unsigned int *pixelindex; - Pixel *pixels; +PutImagePixels( + XImage *image, + unsigned int width, + unsigned int height, + unsigned int *pixelindex, + Pixel *pixels) { register char *src; register char *dst; @@ -1295,12 +1289,12 @@ static unsigned long byteorderpixel = MSBFirst << 24; */ static void -PutImagePixels32(image, width, height, pixelindex, pixels) - XImage *image; - unsigned int width; - unsigned int height; - unsigned int *pixelindex; - Pixel *pixels; +PutImagePixels32( + XImage *image, + unsigned int width, + unsigned int height, + unsigned int *pixelindex, + Pixel *pixels) { unsigned char *data; unsigned int *iptr; @@ -1405,12 +1399,12 @@ PutImagePixels32(image, width, height, pixelindex, pixels) */ static void -PutImagePixels16(image, width, height, pixelindex, pixels) - XImage *image; - unsigned int width; - unsigned int height; - unsigned int *pixelindex; - Pixel *pixels; +PutImagePixels16( + XImage *image, + unsigned int width, + unsigned int height, + unsigned int *pixelindex, + Pixel *pixels) { unsigned char *data; unsigned int *iptr; @@ -1486,12 +1480,12 @@ PutImagePixels16(image, width, height, pixelindex, pixels) */ static void -PutImagePixels8(image, width, height, pixelindex, pixels) - XImage *image; - unsigned int width; - unsigned int height; - unsigned int *pixelindex; - Pixel *pixels; +PutImagePixels8( + XImage *image, + unsigned int width, + unsigned int height, + unsigned int *pixelindex, + Pixel *pixels) { char *data; unsigned int *iptr; @@ -1533,12 +1527,12 @@ PutImagePixels8(image, width, height, pixelindex, pixels) */ static void -PutImagePixels1(image, width, height, pixelindex, pixels) - XImage *image; - unsigned int width; - unsigned int height; - unsigned int *pixelindex; - Pixel *pixels; +PutImagePixels1( + XImage *image, + unsigned int width, + unsigned int height, + unsigned int *pixelindex, + Pixel *pixels) { if (image->byte_order != image->bitmap_bit_order) PutImagePixels(image, width, height, pixelindex, pixels); @@ -1647,14 +1641,13 @@ PutImagePixels1(image, width, height, pixelindex, pixels) } int -XpmCreatePixmapFromXpmImage(display, d, image, - pixmap_return, shapemask_return, attributes) - Display *display; - Drawable d; - XpmImage *image; - Pixmap *pixmap_return; - Pixmap *shapemask_return; - XpmAttributes *attributes; +XpmCreatePixmapFromXpmImage( + Display *display, + Drawable d, + XpmImage *image, + Pixmap *pixmap_return, + Pixmap *shapemask_return, + XpmAttributes *attributes) { XImage *ximage, *shapeimage; int ErrorStatus; @@ -1732,13 +1725,13 @@ APutImagePixels ( # endif/* AMIGA */ #else /* FOR_MSW part follows */ static void -MSWPutImagePixels(dc, image, width, height, pixelindex, pixels) - Display *dc; - XImage *image; - unsigned int width; - unsigned int height; - unsigned int *pixelindex; - Pixel *pixels; +MSWPutImagePixels( + Display *dc, + XImage *image, + unsigned int width, + unsigned int height, + unsigned int *pixelindex, + Pixel *pixels) { unsigned int *data = pixelindex; unsigned int x, y; @@ -1760,11 +1753,11 @@ MSWPutImagePixels(dc, image, width, height, pixelindex, pixels) #if !defined(FOR_MSW) && !defined(AMIGA) static int -PutPixel1(ximage, x, y, pixel) - register XImage *ximage; - int x; - int y; - unsigned long pixel; +PutPixel1( + register XImage *ximage, + int x, + int y, + unsigned long pixel) { register char *src; register char *dst; @@ -1795,11 +1788,11 @@ PutPixel1(ximage, x, y, pixel) } static int -PutPixel(ximage, x, y, pixel) - register XImage *ximage; - int x; - int y; - unsigned long pixel; +PutPixel( + register XImage *ximage, + int x, + int y, + unsigned long pixel) { register char *src; register char *dst; @@ -1834,11 +1827,11 @@ PutPixel(ximage, x, y, pixel) #if !defined(WORD64) && !defined(LONG64) static int -PutPixel32(ximage, x, y, pixel) - register XImage *ximage; - int x; - int y; - unsigned long pixel; +PutPixel32( + register XImage *ximage, + int x, + int y, + unsigned long pixel) { unsigned char *addr; @@ -1852,11 +1845,11 @@ PutPixel32(ximage, x, y, pixel) #endif static int -PutPixel32MSB(ximage, x, y, pixel) - register XImage *ximage; - int x; - int y; - unsigned long pixel; +PutPixel32MSB( + register XImage *ximage, + int x, + int y, + unsigned long pixel) { unsigned char *addr; @@ -1872,11 +1865,11 @@ PutPixel32MSB(ximage, x, y, pixel) } static int -PutPixel32LSB(ximage, x, y, pixel) - register XImage *ximage; - int x; - int y; - unsigned long pixel; +PutPixel32LSB( + register XImage *ximage, + int x, + int y, + unsigned long pixel) { unsigned char *addr; @@ -1892,11 +1885,11 @@ PutPixel32LSB(ximage, x, y, pixel) } static int -PutPixel16MSB(ximage, x, y, pixel) - register XImage *ximage; - int x; - int y; - unsigned long pixel; +PutPixel16MSB( + register XImage *ximage, + int x, + int y, + unsigned long pixel) { unsigned char *addr; @@ -1910,11 +1903,11 @@ PutPixel16MSB(ximage, x, y, pixel) } static int -PutPixel16LSB(ximage, x, y, pixel) - register XImage *ximage; - int x; - int y; - unsigned long pixel; +PutPixel16LSB( + register XImage *ximage, + int x, + int y, + unsigned long pixel) { unsigned char *addr; @@ -1928,11 +1921,11 @@ PutPixel16LSB(ximage, x, y, pixel) } static int -PutPixel8(ximage, x, y, pixel) - register XImage *ximage; - int x; - int y; - unsigned long pixel; +PutPixel8( + register XImage *ximage, + int x, + int y, + unsigned long pixel) { if(x < 0 || y < 0) return 0; @@ -1942,11 +1935,11 @@ PutPixel8(ximage, x, y, pixel) } static int -PutPixel1MSB(ximage, x, y, pixel) - register XImage *ximage; - int x; - int y; - unsigned long pixel; +PutPixel1MSB( + register XImage *ximage, + int x, + int y, + unsigned long pixel) { if(x < 0 || y < 0) return 0; @@ -1959,11 +1952,11 @@ PutPixel1MSB(ximage, x, y, pixel) } static int -PutPixel1LSB(ximage, x, y, pixel) - register XImage *ximage; - int x; - int y; - unsigned long pixel; +PutPixel1LSB( + register XImage *ximage, + int x, + int y, + unsigned long pixel) { if(x < 0 || y < 0) return 0; @@ -1981,15 +1974,14 @@ PutPixel1LSB(ximage, x, y, pixel) * This function parses an Xpm file or data and directly create an XImage */ int -xpmParseDataAndCreate(display, data, image_return, shapeimage_return, - image, info, attributes) - Display *display; - xpmData *data; - XImage **image_return; - XImage **shapeimage_return; - XpmImage *image; - XpmInfo *info; - XpmAttributes *attributes; +xpmParseDataAndCreate( + Display *display, + xpmData *data, + XImage **image_return, + XImage **shapeimage_return, + XpmImage *image, + XpmInfo *info, + XpmAttributes *attributes) { /* variables stored in the XpmAttributes structure */ Visual *visual; @@ -2320,24 +2312,19 @@ error: static int ParseAndPutPixels( #ifdef FOR_MSW - dc, -#endif - data, width, height, ncolors, cpp, colorTable, hashtable, - image, image_pixels, shapeimage, shape_pixels) -#ifdef FOR_MSW - Display *dc; + Display *dc, #endif - xpmData *data; - unsigned int width; - unsigned int height; - unsigned int ncolors; - unsigned int cpp; - XpmColor *colorTable; - xpmHashTable *hashtable; - XImage *image; - Pixel *image_pixels; - XImage *shapeimage; - Pixel *shape_pixels; + xpmData *data, + unsigned int width, + unsigned int height, + unsigned int ncolors, + unsigned int cpp, + XpmColor *colorTable, + xpmHashTable *hashtable, + XImage *image, + Pixel *image_pixels, + XImage *shapeimage, + Pixel *shape_pixels) { unsigned int a, x, y; |