Commits

Ondřej Surý committed 68299a8

WS and formating in gd.h

  • Participants
  • Parent commits 3005a1e

Comments (0)

Files changed (1)

 #define GD_EXTRA_VERSION "alpha"
 #define GD_VERSION_STRING "2.1.0-alpha"
 
-	/* Do the DLL dance: dllexport when building the DLL,
-		dllimport when importing from it, nothing when
-		not on Silly Silly Windows (tm Aardman Productions). */
+/* Do the DLL dance: dllexport when building the DLL,
+   dllimport when importing from it, nothing when
+   not on Silly Silly Windows (tm Aardman Productions). */
 
-	/* 2.0.20: for headers */
+/* 2.0.20: for headers */
 
-	/* 2.0.24: __stdcall also needed for Visual BASIC
-		and other languages. This breaks ABI compatibility
-		with previous DLL revs, but it's necessary. */
+/* 2.0.24: __stdcall also needed for Visual BASIC
+   and other languages. This breaks ABI compatibility
+   with previous DLL revs, but it's necessary. */
 
-	/* 2.0.29: WIN32 programmers can declare the NONDLL macro if they
-		wish to build gd as a static library or by directly including
-		the gd sources in a project. */
+/* 2.0.29: WIN32 programmers can declare the NONDLL macro if they
+   wish to build gd as a static library or by directly including
+   the gd sources in a project. */
 
 #if !defined(WIN32) && !defined(_WIN32_WCE)
 #define NONDLL 1
 #include "gd_io.h"
 
 /* The maximum number of palette entries in palette-based images.
-	In the wonderful new world of gd 2.0, you can of course have
-	many more colors when using truecolor mode. */
+   In the wonderful new world of gd 2.0, you can of course have
+   many more colors when using truecolor mode. */
 
 #define gdMaxColors 256
 
 /* Image type. See functions below; you will not need to change
-	the elements directly. Use the provided macros to
-	access sx, sy, the color table, and colorsTotal for
-	read-only purposes. */
+   the elements directly. Use the provided macros to
+   access sx, sy, the color table, and colorsTotal for
+   read-only purposes. */
 
 /* If 'truecolor' is set true, the image is truecolor;
-	pixels are represented by integers, which
-	must be 32 bits wide or more.
-
-	True colors are repsented as follows:
-
-	ARGB
-
-	Where 'A' (alpha channel) occupies only the
-	LOWER 7 BITS of the MSB. This very small
-	loss of alpha channel resolution allows gd 2.x
-	to keep backwards compatibility by allowing
-	signed integers to be used to represent colors,
-	and negative numbers to represent special cases,
-	just as in gd 1.x. */
+   pixels are represented by integers, which
+   must be 32 bits wide or more.
+
+   True colors are repsented as follows:
+   
+   ARGB
+	
+   Where 'A' (alpha channel) occupies only the
+   LOWER 7 BITS of the MSB. This very small
+   loss of alpha channel resolution allows gd 2.x
+   to keep backwards compatibility by allowing
+   signed integers to be used to represent colors,
+   and negative numbers to represent special cases,
+   just as in gd 1.x. */
 
 #define gdAlphaMax 127
 #define gdAlphaOpaque 0
 #endif
 
 /* This function accepts truecolor pixel values only. The
-	source color is composited with the destination color
-	based on the alpha channel value of the source color.
-	The resulting color is opaque. */
+   source color is composited with the destination color
+   based on the alpha channel value of the source color.
+   The resulting color is opaque. */
 
 BGD_DECLARE(int) gdAlphaBlend (int dest, int src);
 
 typedef gdFont *gdFontPtr;
 
 /* For backwards compatibility only. Use gdImageSetStyle()
-	for MUCH more flexible line drawing. Also see
-	gdImageSetBrush(). */
+   for MUCH more flexible line drawing. Also see
+   gdImageSetBrush(). */
 #define gdDashSize 4
 
-		/* Special colors. */
+/* Special colors. */
 
 #define gdStyled (-2)
 #define gdBrushed (-3)
 #define gdStyledBrushed (-4)
 #define gdTiled (-5)
 
-		/* NOT the same as the transparent color index.
-			This is used in line styles only. */
+/* NOT the same as the transparent color index.
+   This is used in line styles only. */
 #define gdTransparent (-6)
 
 #define gdAntiAliased (-7)
 
-		/* Functions to manipulate images. */
+/* Functions to manipulate images. */
 
-		/* Creates a palette-based image (up to 256 colors). */
-		BGD_DECLARE(gdImagePtr) gdImageCreate (int sx, int sy);
+/* Creates a palette-based image (up to 256 colors). */
+BGD_DECLARE(gdImagePtr) gdImageCreate (int sx, int sy);
 
-		/* An alternate name for the above (2.0). */
+/* An alternate name for the above (2.0). */
 #define gdImageCreatePalette gdImageCreate
 
-		/* Creates a truecolor image (millions of colors). */
-		BGD_DECLARE(gdImagePtr) gdImageCreateTrueColor (int sx, int sy);
+/* Creates a truecolor image (millions of colors). */
+BGD_DECLARE(gdImagePtr) gdImageCreateTrueColor (int sx, int sy);
 
 /* Creates an image from various file types. These functions
-	return a palette or truecolor image based on the
-	nature of the file being loaded. Truecolor PNG
-	stays truecolor; palette PNG stays palette-based;
-	JPEG is always truecolor. */
+   return a palette or truecolor image based on the
+   nature of the file being loaded. Truecolor PNG
+   stays truecolor; palette PNG stays palette-based;
+   JPEG is always truecolor. */
 BGD_DECLARE(gdImagePtr) gdImageCreateFromPng (FILE * fd);
 BGD_DECLARE(gdImagePtr) gdImageCreateFromPngCtx (gdIOCtxPtr in);
 BGD_DECLARE(gdImagePtr) gdImageCreateFromPngPtr (int size, void *data);
 
 /* A custom data source. */
 /* The source function must return -1 on error, otherwise the number
-        of bytes fetched. 0 is EOF, not an error! */
+   of bytes fetched. 0 is EOF, not an error! */
 /* context will be passed to your source function. */
 
 typedef struct {
 BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Ptr (int size, void *data);
 
 BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Part (FILE * in, int srcx, int srcy, int w,
-        int h);
+						  int h);
 BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartCtx (gdIOCtxPtr in, int srcx, int srcy,
-        int w, int h);
+						     int w, int h);
 BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartPtr (int size, void *data, int srcx, int srcy,
-        int w, int h);
+						     int w, int h);
 /* 2.0.10: prototype was missing */
 BGD_DECLARE(gdImagePtr) gdImageCreateFromXbm (FILE * in);
 
 BGD_DECLARE(void) gdImageDestroy (gdImagePtr im);
 
 /* Replaces or blends with the background depending on the
-	most recent call to gdImageAlphaBlending and the
-	alpha channel value of 'color'; default is to overwrite.
-	Tiling and line styling are also implemented
-	here. All other gd drawing functions pass through this call,
-	allowing for many useful effects. */
+   most recent call to gdImageAlphaBlending and the
+   alpha channel value of 'color'; default is to overwrite.
+   Tiling and line styling are also implemented
+   here. All other gd drawing functions pass through this call,
+   allowing for many useful effects. */
 
 BGD_DECLARE(void) gdImageSetPixel (gdImagePtr im, int x, int y, int color);
 /* FreeType 2 text output with hook to extra flags */
 BGD_DECLARE(void) gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color);
 
 /* For backwards compatibility only. Use gdImageSetStyle()
-	for much more flexible line drawing. */
+   for much more flexible line drawing. */
 BGD_DECLARE(void) gdImageDashedLine (gdImagePtr im, int x1, int y1, int x2, int y2,
                                      int color);
 /* Corners specified (not width and height). Upper left first, lower right
- 	second. */
+   second. */
 BGD_DECLARE(void) gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2,
                                     int color);
 /* Solid bar. Upper left corner first, lower right corner second. */
 BGD_DECLARE(void) gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2, int y2,
-        int color);
+					  int color);
 BGD_DECLARE(void) gdImageSetClip(gdImagePtr im, int x1, int y1, int x2, int y2);
 BGD_DECLARE(void) gdImageGetClip(gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P);
 BGD_DECLARE(void) gdImageSetResolution(gdImagePtr im, const unsigned int res_x, const unsigned int res_y);
                                      unsigned short *s, int color);
 
 /* 2.0.16: for thread-safe use of gdImageStringFT and friends,
-  call this before allowing any thread to call gdImageStringFT.
-  Otherwise it is invoked by the first thread to invoke
-  gdImageStringFT, with a very small but real risk of a race condition.
-  Return 0 on success, nonzero on failure to initialize freetype. */
+   call this before allowing any thread to call gdImageStringFT.
+   Otherwise it is invoked by the first thread to invoke
+   gdImageStringFT, with a very small but real risk of a race condition.
+   Return 0 on success, nonzero on failure to initialize freetype. */
 BGD_DECLARE(int) gdFontCacheSetup (void);
 
 /* Optional: clean up after application is done using fonts in
-BGD_DECLARE( )
- gdImageStringFT(). */
+   gdImageStringFT(). */
 BGD_DECLARE(void) gdFontCacheShutdown (void);
 /* 2.0.20: for backwards compatibility. A few applications did start calling
- this function when it first appeared although it was never documented.
- Simply invokes gdFontCacheShutdown. */
+   this function when it first appeared although it was never documented.
+   Simply invokes gdFontCacheShutdown. */
 BGD_DECLARE(void) gdFreeFontCache (void);
 
 /* Calls gdImageStringFT. Provided for backwards compatibility only. */
                                      char *string);
 
 /* 2.0.5: provides an extensible way to pass additional parameters.
-	Thanks to Wez Furlong, sorry for the delay. */
+   Thanks to Wez Furlong, sorry for the delay. */
 
 typedef struct {
-	int flags;			/* Logical OR of gdFTEX_ values */
-	double linespacing;		/* fine tune line spacing for '\n' */
+	int flags;		/* Logical OR of gdFTEX_ values */
+	double linespacing;	/* fine tune line spacing for '\n' */
 	int charmap;		/* TBB: 2.0.12: may be gdFTEX_Unicode,
-		   gdFTEX_Shift_JIS, gdFTEX_Big5,
-		   or gdFTEX_Adobe_Custom;
-		   when not specified, maps are searched
-		   for in the above order. */
-	int hdpi;                   /* if (flags & gdFTEX_RESOLUTION) */
-	int vdpi;			/* if (flags & gdFTEX_RESOLUTION) */
-	char *xshow;	/* if (flags & gdFTEX_XSHOW)
-	   then, on return, xshow is a malloc'ed
-	   string containing xshow position data for
-	   the last string.
-
-	   NB. The caller is responsible for gdFree'ing
-	   the xshow string.
-	 */
-	char *fontpath;	/* if (flags & gdFTEX_RETURNFONTPATHNAME)
-                   then, on return, fontpath is a malloc'ed
-                   string containing the actual font file path name
-                   used, which can be interesting when fontconfig
-                   is in use.
-
-                   The caller is responsible for gdFree'ing the
-                   fontpath string.
-	*/
+				   gdFTEX_Shift_JIS, gdFTEX_Big5,
+				   or gdFTEX_Adobe_Custom;
+				   when not specified, maps are searched
+				   for in the above order. */
+	int hdpi;                /* if (flags & gdFTEX_RESOLUTION) */
+	int vdpi;		 /* if (flags & gdFTEX_RESOLUTION) */
+	char *xshow;             /* if (flags & gdFTEX_XSHOW)
+				    then, on return, xshow is a malloc'ed
+				    string containing xshow position data for
+				    the last string.
+				    
+				    NB. The caller is responsible for gdFree'ing
+				    the xshow string.
+				 */
+	char *fontpath;	         /* if (flags & gdFTEX_RETURNFONTPATHNAME)
+				    then, on return, fontpath is a malloc'ed
+				    string containing the actual font file path name
+				    used, which can be interesting when fontconfig
+				    is in use.
+				    
+				    The caller is responsible for gdFree'ing the
+				    fontpath string.
+				 */
 
 }
 gdFTStringExtra, *gdFTStringExtraPtr;
 #define gdFTEX_RESOLUTION 4
 #define gdFTEX_DISABLE_KERNING 8
 #define gdFTEX_XSHOW 16
-		/* The default unless gdFTUseFontConfig(1); has been called:
-		  fontlist is a full or partial font file pathname or list thereof
-		  (i.e. just like before 2.0.29) */
+/* The default unless gdFTUseFontConfig(1); has been called:
+   fontlist is a full or partial font file pathname or list thereof
+   (i.e. just like before 2.0.29) */
 #define gdFTEX_FONTPATHNAME 32
-		/* Necessary to use fontconfig patterns instead of font pathnames
-		  as the fontlist argument, unless gdFTUseFontConfig(1); has
-		  been called. New in 2.0.29 */
+/* Necessary to use fontconfig patterns instead of font pathnames
+   as the fontlist argument, unless gdFTUseFontConfig(1); has
+   been called. New in 2.0.29 */
 #define gdFTEX_FONTCONFIG 64
-		/* Sometimes interesting when fontconfig is used: the fontpath
-		  element of the structure above will contain a gdMalloc'd string
-		  copy of the actual font file pathname used, if this flag is set
-		   when the call is made */
+/* Sometimes interesting when fontconfig is used: the fontpath
+   element of the structure above will contain a gdMalloc'd string
+   copy of the actual font file pathname used, if this flag is set
+   when the call is made */
 #define gdFTEX_RETURNFONTPATHNAME 128
 
-		/* If flag is nonzero, the fontlist parameter to gdImageStringFT
-		  and gdImageStringFTEx shall be assumed to be a fontconfig font pattern
-		  if fontconfig was compiled into gd. This function returns zero
-		  if fontconfig is not available, nonzero otherwise. */
-		BGD_DECLARE(int) gdFTUseFontConfig(int flag);
+/* If flag is nonzero, the fontlist parameter to gdImageStringFT
+   and gdImageStringFTEx shall be assumed to be a fontconfig font pattern
+   if fontconfig was compiled into gd. This function returns zero
+   if fontconfig is not available, nonzero otherwise. */
+BGD_DECLARE(int) gdFTUseFontConfig(int flag);
 
-		/* These are NOT flags; set one in 'charmap' if you set the
-			gdFTEX_CHARMAP bit in 'flags'. */
+/* These are NOT flags; set one in 'charmap' if you set the
+   gdFTEX_CHARMAP bit in 'flags'. */
 #define gdFTEX_Unicode 0
 #define gdFTEX_Shift_JIS 1
 #define gdFTEX_Big5 2
 BGD_DECLARE(void) gdImageFilledPolygon (gdImagePtr im, gdPointPtr p, int n, int c);
 
 /* These functions still work with truecolor images,
-	for which they never return error. */
+   for which they never return error. */
 BGD_DECLARE(int) gdImageColorAllocate (gdImagePtr im, int r, int g, int b);
 /* gd 2.0: palette entries with non-opaque transparency are permitted. */
 BGD_DECLARE(int) gdImageColorAllocateAlpha (gdImagePtr im, int r, int g, int b, int a);
 /* Assumes opaque is the preferred alpha channel value */
 BGD_DECLARE(int) gdImageColorClosest (gdImagePtr im, int r, int g, int b);
 /* Closest match taking all four parameters into account.
-	A slightly different color with the same transparency
-	beats the exact same color with radically different
-	transparency */
+   A slightly different color with the same transparency
+   beats the exact same color with radically different
+   transparency */
 BGD_DECLARE(int) gdImageColorClosestAlpha (gdImagePtr im, int r, int g, int b, int a);
 /* An alternate method */
 BGD_DECLARE(int) gdImageColorClosestHWB (gdImagePtr im, int r, int g, int b);
 BGD_DECLARE(int) gdImageColorResolveAlpha (gdImagePtr im, int r, int g, int b, int a);
 
 /* A simpler way to obtain an opaque truecolor value for drawing on a
-	truecolor image. Not for use with palette images! */
+   truecolor image. Not for use with palette images! */
 
 #define gdTrueColor(r, g, b) (((r) << 16) + \
-	((g) << 8) + \
-	(b))
+			      ((g) << 8) +  \
+			      (b))
 
-		/* Returns a truecolor value with an alpha channel component.
-			gdAlphaMax (127, **NOT 255**) is transparent, 0 is completely
-			opaque. */
+/* Returns a truecolor value with an alpha channel component.
+   gdAlphaMax (127, **NOT 255**) is transparent, 0 is completely
+   opaque. */
 
 #define gdTrueColorAlpha(r, g, b, a) (((a) << 24) + \
-	((r) << 16) + \
-	((g) << 8) + \
-	(b))
+				      ((r) << 16) + \
+				      ((g) << 8) +  \
+				      (b))
 
 BGD_DECLARE(void) gdImageColorDeallocate (gdImagePtr im, int color);
 
 /* Converts a truecolor image to a palette-based image,
-	using a high-quality two-pass quantization routine
-	which attempts to preserve alpha channel information
-	as well as R/G/B color information when creating
-	a palette. If ditherFlag is set, the image will be
-	dithered to approximate colors better, at the expense
-	of some obvious "speckling." colorsWanted can be
-	anything up to 256. If the original source image
-	includes photographic information or anything that
-	came out of a JPEG, 256 is strongly recommended.
-
-	Better yet, don't use these function -- write real
-	truecolor PNGs and JPEGs. The disk space gain of
-        conversion to palette is not great (for small images
-        it can be negative) and the quality loss is ugly.
-
-	DIFFERENCES: gdImageCreatePaletteFromTrueColor creates and
-	returns a new image. gdImageTrueColorToPalette modifies
-	an existing image, and the truecolor pixels are discarded.
-
-    gdImageTrueColorToPalette() returns TRUE on success, FALSE on failure.
-
-  */
+   using a high-quality two-pass quantization routine
+   which attempts to preserve alpha channel information
+   as well as R/G/B color information when creating
+   a palette. If ditherFlag is set, the image will be
+   dithered to approximate colors better, at the expense
+   of some obvious "speckling." colorsWanted can be
+   anything up to 256. If the original source image
+   includes photographic information or anything that
+   came out of a JPEG, 256 is strongly recommended.
+   
+   Better yet, don't use these function -- write real
+   truecolor PNGs and JPEGs. The disk space gain of
+   conversion to palette is not great (for small images
+   it can be negative) and the quality loss is ugly.
+   
+   DIFFERENCES: gdImageCreatePaletteFromTrueColor creates and
+   returns a new image. gdImageTrueColorToPalette modifies
+   an existing image, and the truecolor pixels are discarded.
+   
+   gdImageTrueColorToPalette() returns TRUE on success, FALSE on failure.
+*/
 
 BGD_DECLARE(gdImagePtr) gdImageCreatePaletteFromTrueColor (gdImagePtr im, int ditherFlag,
-        int colorsWanted);
+							   int colorsWanted);
 
 BGD_DECLARE(int) gdImageTrueColorToPalette (gdImagePtr im, int ditherFlag,
-        int colorsWanted);
+					    int colorsWanted);
 
 BGD_DECLARE(int) gdImagePaletteToTrueColor(gdImagePtr src);
 
-/*
-  Selects quantization method used for subsequent gdImageTrueColorToPalette calls.
-  See gdPaletteQuantizationMethod enum (e.g. GD_QUANT_NEUQUANT, GD_QUANT_LIQ).
-  Speed is from 1 (highest quality) to 10 (fastest).
-  Speed 0 selects method-specific default (recommended).
+/* Selects quantization method used for subsequent gdImageTrueColorToPalette calls.
+   See gdPaletteQuantizationMethod enum (e.g. GD_QUANT_NEUQUANT, GD_QUANT_LIQ).
+   Speed is from 1 (highest quality) to 10 (fastest).
+   Speed 0 selects method-specific default (recommended).
 
-  Returns FALSE if the given method is invalid or not available.
+   Returns FALSE if the given method is invalid or not available.
 */
 BGD_DECLARE(int) gdImageTrueColorToPaletteSetMethod (gdImagePtr im, int method, int speed);
 
 BGD_DECLARE(void) gdImageTrueColorToPaletteSetQuality (gdImagePtr im, int min_quality, int max_quality);
 
 /* Specifies a color index (if a palette image) or an
-	RGB color (if a truecolor image) which should be
-	considered 100% transparent. FOR TRUECOLOR IMAGES,
-	THIS IS IGNORED IF AN ALPHA CHANNEL IS BEING
-	SAVED. Use gdImageSaveAlpha(im, 0); to
-	turn off the saving of a full alpha channel in
-	a truecolor image. Note that gdImageColorTransparent
-	is usually compatible with older browsers that
-	do not understand full alpha channels well. TBB */
+   RGB color (if a truecolor image) which should be
+   considered 100% transparent. FOR TRUECOLOR IMAGES,
+   THIS IS IGNORED IF AN ALPHA CHANNEL IS BEING
+   SAVED. Use gdImageSaveAlpha(im, 0); to
+   turn off the saving of a full alpha channel in
+   a truecolor image. Note that gdImageColorTransparent
+   is usually compatible with older browsers that
+   do not understand full alpha channels well. TBB */
 BGD_DECLARE(void) gdImageColorTransparent (gdImagePtr im, int color);
 
 BGD_DECLARE(void) gdImagePaletteCopy (gdImagePtr dst, gdImagePtr src);
 BGD_DECLARE(void) gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression);
 
 /* 2.0.12: Compression level: 0-9 or -1, where 0 is NO COMPRESSION at all,
-  1 is FASTEST but produces larger files, 9 provides the best
-  compression (smallest files) but takes a long time to compress, and
-  -1 selects the default compiled into the zlib library. */
+   1 is FASTEST but produces larger files, 9 provides the best
+   compression (smallest files) but takes a long time to compress, and
+   -1 selects the default compiled into the zlib library. */
 BGD_DECLARE(void) gdImagePngEx (gdImagePtr im, FILE * out, int level);
 BGD_DECLARE(void) gdImagePngCtxEx (gdImagePtr im, gdIOCtx * out, int level);
 
 BGD_DECLARE(void) gdImageWBMP (gdImagePtr image, int fg, FILE * out);
 BGD_DECLARE(void) gdImageWBMPCtx (gdImagePtr image, int fg, gdIOCtx * out);
 
-/* Guaranteed to correctly free memory returned
-	by the gdImage*Ptr functions */
+/* Guaranteed to correctly free memory returned by the gdImage*Ptr
+   functions */
 BGD_DECLARE(void) gdFree (void *m);
 
 /* Best to free this memory with gdFree(), not free() */
 BGD_DECLARE(void *) gdImageWBMPPtr (gdImagePtr im, int *size, int fg);
 
 /* 100 is highest quality (there is always a little loss with JPEG).
-	0 is lowest. 10 is about the lowest useful setting. */
+   0 is lowest. 10 is about the lowest useful setting. */
 BGD_DECLARE(void) gdImageJpeg (gdImagePtr im, FILE * out, int quality);
 BGD_DECLARE(void) gdImageJpegCtx (gdImagePtr im, gdIOCtx * out, int quality);
 
 BGD_DECLARE(void) gdImageWebpCtx (gdImagePtr im, gdIOCtx * outfile, int quantization);
 
 /* Legal values for Disposal. gdDisposalNone is always used by
-	the built-in optimizer if previm is passed. */
+   the built-in optimizer if previm is passed. */
 
 enum {
-    gdDisposalUnknown,
-    gdDisposalNone,
-    gdDisposalRestoreBackground,
-    gdDisposalRestorePrevious
+	gdDisposalUnknown,
+	gdDisposalNone,
+	gdDisposalRestoreBackground,
+	gdDisposalRestorePrevious
 };
 
 BGD_DECLARE(void) gdImageGifAnimBegin(gdImagePtr im, FILE *outFile, int GlobalCM, int Loops);
 BGD_DECLARE(void *) gdImageGifAnimAddPtr(gdImagePtr im, int *size, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm);
 BGD_DECLARE(void *) gdImageGifAnimEndPtr(int *size);
 
-/* A custom data sink. For backwards compatibility. Use
-	gdIOCtx instead. */
-/* The sink function must return -1 on error, otherwise the number
-        of bytes written, which must be equal to len. */
-/* context will be passed to your sink function. */
+/* A custom data sink. For backwards compatibility. Use gdIOCtx
+   instead. The sink function must return -1 on error, otherwise the
+   number of bytes written, which must be equal to len.  Context will
+   be passed to your sink function.
+*/
 typedef struct {
 	int (*sink) (void *context, const char *buffer, int len);
 	void *context;
 BGD_DECLARE(void *) gdImageGd2Ptr (gdImagePtr im, int cs, int fmt, int *size);
 
 /* Style is a bitwise OR ( | operator ) of these.
-	gdArc and gdChord are mutually exclusive;
-	gdChord just connects the starting and ending
-	angles with a straight line, while gdArc produces
-	a rounded edge. gdPie is a synonym for gdArc.
-	gdNoFill indicates that the arc or chord should be
-	outlined, not filled. gdEdged, used together with
-	gdNoFill, indicates that the beginning and ending
-	angles should be connected to the center; this is
-	a good way to outline (rather than fill) a
-	'pie slice'. */
+   gdArc and gdChord are mutually exclusive;
+   gdChord just connects the starting and ending
+   angles with a straight line, while gdArc produces
+   a rounded edge. gdPie is a synonym for gdArc.
+   gdNoFill indicates that the arc or chord should be
+   outlined, not filled. gdEdged, used together with
+   gdNoFill, indicates that the beginning and ending
+   angles should be connected to the center; this is
+   a good way to outline (rather than fill) a
+   'pie slice'. */
 #define gdArc   0
 #define gdPie   gdArc
 #define gdChord 1
                                         int pct);
 
 /* Stretches or shrinks to fit, as needed. Does NOT attempt
-	to average the entire set of source pixels that scale down onto the
-	destination pixel. */
+   to average the entire set of source pixels that scale down onto the
+   destination pixel. */
 BGD_DECLARE(void) gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
                                       int srcX, int srcY, int dstW, int dstH, int srcW,
                                       int srcH);
 
 /* gd 2.0: stretches or shrinks to fit, as needed. When called with a
-	truecolor destination image, this function averages the
-	entire set of source pixels that scale down onto the
-	destination pixel, taking into account what portion of the
-	destination pixel each source pixel represents. This is a
-	floating point operation, but this is not a performance issue
-	on modern hardware, except for some embedded devices. If the
-	destination is a palette image, gdImageCopyResized is
-	substituted automatically. */
+   truecolor destination image, this function averages the
+   entire set of source pixels that scale down onto the
+   destination pixel, taking into account what portion of the
+   destination pixel each source pixel represents. This is a
+   floating point operation, but this is not a performance issue
+   on modern hardware, except for some embedded devices. If the
+   destination is a palette image, gdImageCopyResized is
+   substituted automatically. */
 BGD_DECLARE(void) gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX,
                                         int dstY, int srcX, int srcY, int dstW, int dstH,
                                         int srcW, int srcH);
 
 /* gd 2.0.8: gdImageCopyRotated is added. Source
-        is a rectangle, with its upper left corner at
-        srcX and srcY. Destination is the *center* of
-        the rotated copy. Angle is in degrees, same as
-        gdImageArc. Floating point destination center
-        coordinates allow accurate rotation of
-        objects of odd-numbered width or height. */
+   is a rectangle, with its upper left corner at
+   srcX and srcY. Destination is the *center* of
+   the rotated copy. Angle is in degrees, same as
+   gdImageArc. Floating point destination center
+   coordinates allow accurate rotation of
+   objects of odd-numbered width or height. */
 BGD_DECLARE(void) gdImageCopyRotated (gdImagePtr dst,
                                       gdImagePtr src,
                                       double dstX, double dstY,
 BGD_DECLARE(void) gdImageSetAntiAliasedDontBlend (gdImagePtr im, int c, int dont_blend);
 BGD_DECLARE(void) gdImageSetStyle (gdImagePtr im, int *style, int noOfPixels);
 /* Line thickness (defaults to 1). Affects lines, ellipses,
-	rectangles, polygons and so forth. */
+   rectangles, polygons and so forth. */
 BGD_DECLARE(void) gdImageSetThickness (gdImagePtr im, int thickness);
 /* On or off (1 or 0) for all three of these. */
 BGD_DECLARE(void) gdImageInterlace (gdImagePtr im, int interlaceArg);
 BGD_DECLARE(gdImagePtr) gdImageNeuQuant(gdImagePtr im, const int max_color, int sample_factor);
 
 enum gdPixelateMode {
-    GD_PIXELATE_UPPERLEFT,
-    GD_PIXELATE_AVERAGE
+	GD_PIXELATE_UPPERLEFT,
+	GD_PIXELATE_AVERAGE
 };
 
 BGD_DECLARE(int) gdImagePixelate(gdImagePtr im, int block_size, const unsigned int mode);
 BGD_DECLARE(int) gdImageGrayScale(gdImagePtr src);
 BGD_DECLARE(int) gdImageNegate(gdImagePtr src);
 
-
 /* Macros to access information about images. */
 
 /* Returns nonzero if the image is a truecolor image,
-	zero for a palette image. */
+   zero for a palette image. */
 #define gdImageTrueColor(im) ((im)->trueColor)
 
 #define gdImageSX(im) ((im)->sx)
 #define gdImageSY(im) ((im)->sy)
 #define gdImageColorsTotal(im) ((im)->colorsTotal)
 #define gdImageRed(im, c) ((im)->trueColor ? gdTrueColorGetRed(c) : \
-	(im)->red[(c)])
+			   (im)->red[(c)])
 #define gdImageGreen(im, c) ((im)->trueColor ? gdTrueColorGetGreen(c) : \
-	(im)->green[(c)])
+			     (im)->green[(c)])
 #define gdImageBlue(im, c) ((im)->trueColor ? gdTrueColorGetBlue(c) : \
-	(im)->blue[(c)])
+			    (im)->blue[(c)])
 #define gdImageAlpha(im, c) ((im)->trueColor ? gdTrueColorGetAlpha(c) : \
-	(im)->alpha[(c)])
+			     (im)->alpha[(c)])
 #define gdImageGetTransparent(im) ((im)->transparent)
 #define gdImageGetInterlaced(im) ((im)->interlace)
 
 /* These macros provide direct access to pixels in
-	palette-based and truecolor images, respectively.
-	If you use these macros, you must perform your own
-	bounds checking. Use of the macro for the correct type
-	of image is also your responsibility. */
+   palette-based and truecolor images, respectively.
+   If you use these macros, you must perform your own
+   bounds checking. Use of the macro for the correct type
+   of image is also your responsibility. */
 #define gdImagePalettePixel(im, x, y) (im)->pixels[(y)][(x)]
 #define gdImageTrueColorPixel(im, x, y) (im)->tpixels[(y)][(x)]
 
 
 BGD_DECLARE(gdIOCtx *) gdNewFileCtx (FILE *);
 /* If data is null, size is ignored and an initial data buffer is
-  allocated automatically. NOTE: this function assumes gd has the right
-  to free or reallocate "data" at will! Also note that gd will free
-  "data" when the IO context is freed. If data is not null, it must point
-  to memory allocated with gdMalloc, or by a call to gdImage[something]Ptr.
-  If not, see gdNewDynamicCtxEx for an alternative. */
+   allocated automatically. NOTE: this function assumes gd has the right
+   to free or reallocate "data" at will! Also note that gd will free
+   "data" when the IO context is freed. If data is not null, it must point
+   to memory allocated with gdMalloc, or by a call to gdImage[something]Ptr.
+   If not, see gdNewDynamicCtxEx for an alternative. */
 BGD_DECLARE(gdIOCtx *) gdNewDynamicCtx (int size, void *data);
 /* 2.0.21: if freeFlag is nonzero, gd will free and/or reallocate "data" as
-  needed as described above. If freeFlag is zero, gd will never free
-  or reallocate "data", which means that the context should only be used
-  for *reading* an image from a memory buffer, or writing an image to a
-  memory buffer which is already large enough. If the memory buffer is
-  not large enough and an image write is attempted, the write operation
-  will fail. Those wishing to write an image to a buffer in memory have
-  a much simpler alternative in the gdImage[something]Ptr functions. */
+   needed as described above. If freeFlag is zero, gd will never free
+   or reallocate "data", which means that the context should only be used
+   for *reading* an image from a memory buffer, or writing an image to a
+   memory buffer which is already large enough. If the memory buffer is
+   not large enough and an image write is attempted, the write operation
+   will fail. Those wishing to write an image to a buffer in memory have
+   a much simpler alternative in the gdImage[something]Ptr functions. */
 BGD_DECLARE(gdIOCtx *) gdNewDynamicCtxEx (int size, void *data, int freeFlag);
 BGD_DECLARE(gdIOCtx *) gdNewSSCtx (gdSourcePtr in, gdSinkPtr out);
 BGD_DECLARE(void *) gdDPExtractData (struct gdIOCtx *ctx, int *size);
 BGD_DECLARE(int) gdTransformAffineCopy(gdImagePtr dst, int dst_x, int dst_y, const gdImagePtr src, gdRectPtr src_region, const double affine[6]);
 /*
 gdTransformAffineCopy(gdImagePtr dst, int x0, int y0, int x1, int y1,
-			const gdImagePtr src, int src_width, int src_height,
-			const double affine[6]);
+		      const gdImagePtr src, int src_width, int src_height,
+		      const double affine[6]);
 */
 int gdTransformAffineBoundingBox(gdRectPtr src, const double affine[6], gdRectPtr bbox);