/*   gifgen.h
* ===========================================================================
*
*                            PUBLIC DOMAIN NOTICE
*            National Center for Biotechnology Information (NCBI)
*
*  This software/database is a "United States Government Work" under the
*  terms of the United States Copyright Act.  It was written as part of
*  the author's official duties as a United States Government employee and
*  thus cannot be copyrighted.  This software/database is freely available
*  to the public for use. The National Library of Medicine and the U.S.
*  Government do not place any restriction on its use or reproduction.
*  We would, however, appreciate having the NCBI and the author cited in
*  any work or product based on this material
*
*  Although all reasonable efforts have been taken to ensure the accuracy
*  and reliability of the software and data, the NLM and the U.S.
*  Government do not and cannot warrant the performance or results that
*  may be obtained by using this software or data. The NLM and the U.S.
*  Government disclaim all warranties, express or implied, including
*  warranties of performance, merchantability or fitness for any particular
*  purpose.
*
* ===========================================================================
*/

/*
** Based on GIFENCOD by David Rowley .A
** Lempel-Zim compression based on "compress".
**
** Modified by Marcel Wijkstra 
**
** Copyright (C) 1989 by Jef Poskanzer.
**
** Permission to use, copy, modify, and distribute this software and its
** documentation for any purpose and without fee is hereby granted, provided
** that the above copyright notice appear in all copies and that both that
** copyright notice and this permission notice appear in supporting
** documentation.  This software is provided "as is" without express or
** implied warranty.
**
** The Graphics Interchange Format(c) is the Copyright property of
** CompuServe Incorporated.  GIF(sm) is a Service Mark property of
** CompuServe Incorporated.
*/

/* +-------------------------------------------------------------------+ */
/* | Copyright 1990, 1991, 1993, David Koblas.  (koblas@netcom.com)    | */
/* |   Permission to use, copy, modify, and distribute this software   | */
/* |   and its documentation for any purpose and without fee is hereby | */
/* |   granted, provided that the above copyright notice appear in all | */
/* |   copies and that both that copyright notice and this permission  | */
/* |   notice appear in supporting documentation.  This software is    | */
/* |   provided "as is" without express or implied warranty.           | */
/* +-------------------------------------------------------------------+ */

/*
 * File Name:  gifgen.c
 *
 * Author:  Alex Smirnov
 *
 * Version Creation Date:   10/20/95
 *
 * File Description: 
 *       GIF generator header file
 *
 * $Log: gifgen.h,v $
 * Revision 5.0  1996/05/28  13:18:57  ostell
 * Set to revision 5.0
 *
 * Revision 1.2  1996/04/19  14:17:56  vakatov
 * Inserted non-NCBI copyright headers.
 * Added VC log.
 *
 *
 * ==========================================================================
 */


#ifndef GIFGEN_H
#define GIFGEN_H 1

/**************************************************************************/
/* INCLUDE */
/**************************************************************************/
#include <stdio.h>

/**************************************************************************/
/* DEFINES */
/**************************************************************************/
#define gdMaxColors     256
#define gdDashSize      4
#define gdStyled        (-2)
#define gdBrushed       (-3)
#define gdStyledBrushed (-4)
#define gdTiled         (-5)
#define gdTransparent   (-6)

#define gdImageSX(im)             ((im)->sx)
#define gdImageSY(im)             ((im)->sy)
#define gdImageColorsTotal(im)    ((im)->colorsTotal)
#define gdImageRed(im,c)          ((im)->red[(c)])
#define gdImageGreen(im,c)        ((im)->green[(c)])
#define gdImageBlue(im,c)         ((im)->blue[(c)])
#define gdImageGetTransparent(im) ((im)->transparent)
#define gdImageGetInterlaced(im)  ((im)->interlace)

/**************************************************************************/
/* TYPEDEFS */
/**************************************************************************/
typedef struct {
	int    nchars;  /* # of characters in font */
	int    offset;  /* First character is numbered... (usually 32 = space) */
	int    w;       /* Character width  */
	int    h;       /* Character height */
	int    d;       /* Character descent */
	char * data;    /* Font data; array of characters, one row after another.
		                Easily included in code, also easily loaded from
		                data files. */
} gdFont, *gdFontPtr;

typedef struct gdImageStruct {
	unsigned char * pixels;
	int             sx;
	int             sy;
	int             colorsTotal;
	int             red[gdMaxColors];
	int             green[gdMaxColors];
	int             blue[gdMaxColors]; 
	int             open[gdMaxColors];
	int             transparent;
	int           * polyInts;
	int             polyAllocated;
	struct gdImageStruct * brush;
	struct gdImageStruct * tile;	
	int             brushColorMap[gdMaxColors];
	int             tileColorMap[gdMaxColors];
	int             styleLength;
	int             stylePos;
	int           * style;
	int             interlace;
} gdImage, * gdImagePtr;

typedef struct {
	int x, y;
} gdPoint, *gdPointPtr;

/* Functions to manipulate images. */
gdImagePtr gdImageCreate         (int sx, int sy);
void       gdImageDestroy        (gdImagePtr im);
void       gdImageSetPixel       (gdImagePtr im, int x, int y, int color);
int        gdImageGetPixel       (gdImagePtr im, int x, int y);
void       gdImageLine           (gdImagePtr im, int x1, int y1, 
                                  int x2, int y2, int color);
void       gdImageDashedLine     (gdImagePtr im, int x1, int y1, 
                                  int x2, int y2, int color);
void       gdImageRectangle      (gdImagePtr im, int x1, int y1, 
                                  int x2, int y2, int color);
void       gdImageFilledRectangle   (gdImagePtr im, int x1, int y1, 
                                     int x2, int y2, int color);
int        gdImageBoundsSafe     (gdImagePtr im, int x, int y);
void       gdImageChar           (gdImagePtr im, gdFontPtr f, int x, int y, 
                                  int c, int color);
void       gdImageString         (gdImagePtr im, gdFontPtr f, int x, int y, 
                                  char *s, int color);
void       gdImagePolygon        (gdImagePtr im, gdPointPtr p, int n, int c);
void       gdImageFilledPolygon  (gdImagePtr im, gdPointPtr p, int n, int c);
int        gdImageColorAllocate  (gdImagePtr im, int r, int g, int b);
int        gdImageColorClosest   (gdImagePtr im, int r, int g, int b);
int        gdImageColorExact     (gdImagePtr im, int r, int g, int b);
void       gdImageColorDeallocate   (gdImagePtr im, int color);
void       gdImageColorTransparent  (gdImagePtr im, int color);
void       gdImageGif            (gdImagePtr im, FILE *out);
void       gdImageArc            (gdImagePtr im, int cx, int cy, int w, int h, 
                                  int s, int e, int color);
void       gdImageInterlace      (gdImagePtr im, int interlaceArg);
void       gdImageCopyBits       (gdImagePtr im, int x, int y, int w, int h,
                                  char * ptr, int color );

/**************************************************************************/
/* GLOBAL VARIABLE */
/**************************************************************************/

extern gdFontPtr gdFont8X16;
extern gdFontPtr gdFont9X15b;
extern gdFontPtr gdFont7X13b;
extern gdFontPtr gdFont6X12;
extern gdFontPtr gdFont5X8;

#endif

