Anonymous avatar Anonymous committed e420628

- sync to 2.0.9

Comments (0)

Files changed (3)

   if ((wbmp = (Wbmp *) gdMalloc (sizeof (Wbmp))) == NULL)
     return (NULL);
 
-  if ((wbmp->bitmap = (int *) gdMalloc (sizeof (int) * width * height)) == NULL)
+  if ((wbmp->bitmap =
+       (int *) gdMalloc (sizeof (int) * width * height)) == NULL)
     {
       gdFree (wbmp);
       return (NULL);
   printf ("W: %d, H: %d\n", wbmp->width, wbmp->height);
 #endif
 
-  if ((wbmp->bitmap = (int *) gdMalloc (sizeof (int) * wbmp->width * wbmp->height)) == NULL)
+  if ((wbmp->bitmap =
+       (int *) gdMalloc (sizeof (int) * wbmp->width * wbmp->height)) == NULL)
     {
       gdFree (wbmp);
       return (-1);
       octet = 0;
       for (col = 0; col < wbmp->width; col++)
 	{
-	  octet |= ((wbmp->bitmap[row * wbmp->width + col] == 1) ? WBMP_WHITE : WBMP_BLACK) << --bitpos;
+	  octet |=
+	    ((wbmp->bitmap[row * wbmp->width + col] ==
+	      1) ? WBMP_WHITE : WBMP_BLACK) << --bitpos;
 	  if (bitpos == 0)
 	    {
 	      bitpos = 8;
 ** (c) 2000 Johan Van den Brande <johan@vandenbrande.com>
 **
 ** Header file
-*/        
+*/
 #ifndef __WBMP_H
 #define __WBMP_H	1
 
 ** A Wireless bitmap structure
 **
 */
- 
+
 typedef struct Wbmp_
 {
-    int type;           /* type of the wbmp */
-    int width;          /* width of the image */
-    int height;         /* height of the image */
-    int *bitmap;        /* pointer to data: 0 = WHITE , 1 = BLACK */
-} Wbmp;
- 
+  int type;			/* type of the wbmp */
+  int width;			/* width of the image */
+  int height;			/* height of the image */
+  int *bitmap;			/* pointer to data: 0 = WHITE , 1 = BLACK */
+}
+Wbmp;
+
 #define WBMP_WHITE  1
 #define WBMP_BLACK  0
- 
+
 
 /* Proto's
 ** -------
 **
 */
-void		putmbi( int i, void (*putout)(int c, void *out), void *out); 
-int 	getmbi ( int (*getin)(void *in), void *in );
-int     skipheader( int (*getin)(void *in), void *in );
-Wbmp   *createwbmp( int width, int height, int color );
-int     readwbmp( int (*getin)(void *in), void *in, Wbmp **wbmp );
-int		writewbmp( Wbmp *wbmp, void (*putout)( int c, void *out), void *out);
-void    freewbmp( Wbmp *wbmp );
-void    printwbmp( Wbmp *wbmp );  
+void putmbi (int i, void (*putout) (int c, void *out), void *out);
+int getmbi (int (*getin) (void *in), void *in);
+int skipheader (int (*getin) (void *in), void *in);
+Wbmp *createwbmp (int width, int height, int color);
+int readwbmp (int (*getin) (void *in), void *in, Wbmp ** wbmp);
+int writewbmp (Wbmp * wbmp, void (*putout) (int c, void *out), void *out);
+void freewbmp (Wbmp * wbmp);
+void printwbmp (Wbmp * wbmp);
 
 #endif
     }
   if (!in)
     {
-      fprintf (stderr,
-	       "Error: can't open file %s.\n", argv[argc - 1]);
+      fprintf (stderr, "Error: can't open file %s.\n", argv[argc - 1]);
       exit (1);
     }
   /* Now load the image. */
 #ifdef HAVE_LIBPNG
   im = gdImageCreateFromPng (in);
 #else
-  fprintf(stderr, "No PNG library support.\n");
+  fprintf (stderr, "No PNG library support.\n");
 #endif
   fclose (in);
   /* If the load failed, it must not be a PNG file. */
 	{
 	  if (i == (argc - 2))
 	    {
-	      fprintf (stderr,
-		       "Error: -i specified without y or n.\n");
+	      fprintf (stderr, "Error: -i specified without y or n.\n");
 	      no = 1;
 	      goto usage;
 	    }
 	    }
 	  else
 	    {
-	      fprintf (stderr,
-		       "Error: -i specified without y or n.\n");
+	      fprintf (stderr, "Error: -i specified without y or n.\n");
 	      no = 1;
 	      goto usage;
 	    }
 			  j,
 			  gdImageRed (im, j),
 			  gdImageGreen (im, j),
-			  gdImageBlue (im, j),
-			  gdImageAlpha (im, j));
+			  gdImageBlue (im, j), gdImageAlpha (im, j));
 		}
 	    }
 	  else
 	  /* Output dimensions, etc. */
 	  int t;
 	  printf ("Width: %d Height: %d Colors: %d\n",
-		  gdImageSX (im), gdImageSY (im),
-		  gdImageColorsTotal (im));
+		  gdImageSX (im), gdImageSY (im), gdImageColorsTotal (im));
 	  t = gdImageGetTransparent (im);
 	  if (t != (-1))
 	    {
 	      printf ("Interlaced: no\n");
 	    }
 	  no = 0;
-	} else if (!strcmp(argv[i], "-a"))
+	}
+      else if (!strcmp (argv[i], "-a"))
 	{
-                /* Alpha channel info -- thanks to Wez Furlong */
-		int maxx, maxy, x, y, alpha, pix, nalpha = 0;
+	  /* Alpha channel info -- thanks to Wez Furlong */
+	  int maxx, maxy, x, y, alpha, pix, nalpha = 0;
 
-		maxx = gdImageSX(im);
-		maxy = gdImageSY(im);
+	  maxx = gdImageSX (im);
+	  maxy = gdImageSY (im);
 
-		printf("alpha channel information:\n");
-	
-		if (im->trueColor)	{
-			for (y = 0; y < maxy; y++)	{
-				for (x = 0; x < maxx; x++)	{
-					pix = gdImageGetPixel(im, x, y);
-					alpha = gdTrueColorGetAlpha(pix);
+	  printf ("alpha channel information:\n");
 
-					if (alpha > gdAlphaOpaque)	{
-						/* Use access macros to learn colors. */
-						printf ("%d	%d	%d	%d\n",
-								gdTrueColorGetRed(pix),
-								gdTrueColorGetGreen(pix),
-								gdTrueColorGetBlue(pix),
-								alpha);
-						nalpha++;
-					}
+	  if (im->trueColor)
+	    {
+	      for (y = 0; y < maxy; y++)
+		{
+		  for (x = 0; x < maxx; x++)
+		    {
+		      pix = gdImageGetPixel (im, x, y);
+		      alpha = gdTrueColorGetAlpha (pix);
 
-				}
+		      if (alpha > gdAlphaOpaque)
+			{
+			  /* Use access macros to learn colors. */
+			  printf ("%d	%d	%d	%d\n",
+				  gdTrueColorGetRed (pix),
+				  gdTrueColorGetGreen (pix),
+				  gdTrueColorGetBlue (pix), alpha);
+			  nalpha++;
 			}
+
+		    }
 		}
-		else
-			printf("NOT a true color image\n");
-		no = 0;	
-		printf("%d alpha channels\n", nalpha);
-		
+	    }
+	  else
+	    printf ("NOT a true color image\n");
+	  no = 0;
+	  printf ("%d alpha channels\n", nalpha);
+
 	}
       else
 	{
     {
       /* If the command failed, output an explanation. */
       fprintf (stderr,
-	  "Usage: webpng [-i y|n ] [-l] [-t index|none ] [-d] pngname.png\n"
-
+	       "Usage: webpng [-i y|n ] [-l] [-t index|none ] [-d] pngname.png\n"
 	       "  -i [y|n]   Turns on/off interlace\n"
 	       "  -l         Prints the table of color indexes\n"
 	       "  -t [index] Set the transparent color to the specified index (0-255 or \"none\")\n"
 	       "  -d         Reports the dimensions and other characteristics of the image.\n"
-               "  -a         Prints all alpha channels that are not 100%% opaque.\n"
+	       "  -a         Prints all alpha channels that are not 100%% opaque.\n"
 	       "\n"
-	       "If you specify '-' as the input file, stdin/stdout will be used input/output.\n"
-	);
+	       "If you specify '-' as the input file, stdin/stdout will be used input/output.\n");
     }
   if (write)
     {
 
 	  if (!out)
 	    {
-	      fprintf (stderr,
-		       "Unable to write to %s -- exiting\n", outFn);
+	      fprintf (stderr, "Unable to write to %s -- exiting\n", outFn);
 	      exit (1);
 	    }
 	}
 #ifdef HAVE_LIBPNG
       gdImagePng (im, out);
 #else
-      fprintf(stderr, "No PNG library support.\n");
+      fprintf (stderr, "No PNG library support.\n");
 #endif
       if (!useStdinStdout)
 	{
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.