diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2024-09-10 23:46:41 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2024-09-10 23:46:41 +0000 |
commit | 32b514bbad010bc4eada866bf2935e477af0164e (patch) | |
tree | 3bf09445d3b59475ef2375b9eefaca7e305ef169 /converter/ppm/ppmtoacad.c | |
parent | 3edff148551c189eac2c83d47c4de16edf0d87bf (diff) | |
download | netpbm-mirror-32b514bbad010bc4eada866bf2935e477af0164e.tar.gz netpbm-mirror-32b514bbad010bc4eada866bf2935e477af0164e.tar.xz netpbm-mirror-32b514bbad010bc4eada866bf2935e477af0164e.zip |
cleanup
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4938 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/ppm/ppmtoacad.c')
-rw-r--r-- | converter/ppm/ppmtoacad.c | 56 |
1 files changed, 35 insertions, 21 deletions
diff --git a/converter/ppm/ppmtoacad.c b/converter/ppm/ppmtoacad.c index 4f4dc5dd..1bc91640 100644 --- a/converter/ppm/ppmtoacad.c +++ b/converter/ppm/ppmtoacad.c @@ -40,16 +40,29 @@ static int gamut = 256; /* Output color gamut */ #include "autocad.h" /* AutoCAD standard color assignments */ /* prototypes */ -static void outrun ARGS((int color, int ysize, int y, int xstart, int xend)); -static void slideout ARGS((int xdots, int ydots, int ncolors, - unsigned char *red, unsigned char *green, unsigned char *blue)); +static void outrun (int const color, + int const ysize, + int const y, + int const xstart, + int const xend); + +static void slideout (int const xdots, + int const ydots, + int const ncolors, + unsigned char *red, + unsigned char *green, + unsigned char *blue); /* OUTRUN -- Output a run of pixels. */ -static void outrun(color, ysize, y, xstart, xend) - int color, ysize, y, xstart, xend; -{ +static void +outrun (int const color, + int const ysize, + int const y, + int const xstart, + int const xend) { + if (color == 0) { return; /* Let screen background handle this */ } @@ -151,10 +164,14 @@ static void outrun(color, ysize, y, xstart, xend) /* SLIDEOUT -- Write an AutoCAD slide. */ -static void slideout(xdots, ydots, ncolors, red, green, blue) - int xdots, ydots, ncolors; - unsigned char *red, *green, *blue; -{ +static void +slideout (int const xdots, + int const ydots, + int const ncolors, + unsigned char *red, + unsigned char *green, + unsigned char *blue) { + static char sldhead[18] = "AutoCAD Slide\r\n\32"; static char dxbhead[20] = "AutoCAD DXB 1.0\r\n\32"; unsigned char *acadmap; @@ -187,7 +204,7 @@ static void slideout(xdots, ydots, ncolors, red, green, blue) (void) pm_writelittleshort(stdout, ysize); /* Max Y co-ordinate value */ /* Aspect ratio indicator */ (void) pm_writelittlelong( - stdout, (long) ((((double) xsize) / ysize) * aspect * 1E7)); + stdout, (long int) ((((double) xsize) / ysize) * aspect * 1E7)); (void) pm_writelittleshort(stdout, 2); /* Polygon fill type */ (void) pm_writelittleshort(stdout, 0x1234); /* Byte order indicator */ } @@ -198,13 +215,13 @@ static void slideout(xdots, ydots, ncolors, red, green, blue) for (i = 0; i < ncolors; i++) { int best, j; - long dist = 3 * 256 * 256; + long int dist = 3 * 256 * 256; for (j = 0; j < gamut; j++) { - long dr = red[i] - acadcol[j][0], - dg = green[i] - acadcol[j][1], - db = blue[i] - acadcol[j][2]; - long tdist = dr * dr + dg * dg + db * db; + long int const dr = red[i] - acadcol[j][0], + dg = green[i] - acadcol[j][1], + db = blue[i] - acadcol[j][2]; + long int const tdist = dr * dr + dg * dg + db * db; if (tdist < dist) { dist = tdist; @@ -265,10 +282,8 @@ static void slideout(xdots, ydots, ncolors, red, green, blue) /* Main program. */ -int main(argc, argv) - int argc; - char* argv[]; -{ +int main(int argc, char* argv[]) { + FILE *ifp; int argn, rows, cols, ncolors, i; int aspectspec = FALSE; @@ -279,7 +294,6 @@ int main(argc, argv) "[-poly] [-dxb] [-white] [-background <col>]\n\ [-aspect <f>] [-8] [ppmfile]"; - ppm_init(&argc, argv); argn = 1; |