home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Web / Utilities / wwwcount-2.3 / combine / combine.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-02  |  6.6 KB  |  418 lines

  1. /*
  2.  *    combine.h    -    Header file for combine librarly
  3.  *
  4.  *    RCS:
  5.  *        $Revision: 2.3 $
  6.  *        $Date: 1996/05/03 02:21:34 $
  7.  *
  8.  *    Security:
  9.  *        Unclassified
  10.  *
  11.  *    Description:
  12.  *        This file contains all necessary definitions, typedefs for
  13.  *        xnitfview program
  14.  *
  15.  *    Dependencies:
  16.  *        None
  17.  *
  18.  *    Comments:
  19.  *        text
  20.  *
  21.  *    Development History:
  22.  *        when    who        why
  23.  *  07-11-95    muquit  first cut
  24.  */
  25.  
  26. #ifndef COMBINE_H
  27. #define COMBINE_H
  28.  
  29. #include <stdio.h>
  30.  
  31. #if STDC_HEADERS
  32. #include <stdlib.h>
  33. #include <ctype.h>
  34. #include <string.h>
  35. #endif
  36.  
  37. #if HAVE_STRING_H
  38. #include <string.h>
  39. #endif
  40.  
  41. #if HAVE_MALLOC_H
  42. #include <malloc.h>
  43. #endif
  44.  
  45. #if TIME_WITH_SYS_TIME
  46. #include <sys/time.h>
  47. #include <time.h>
  48. #else
  49. #if HAVE_SYS_TIME_H
  50. #include <sys/time.h>
  51. #else
  52. #include <time.h>
  53. #endif
  54. #endif
  55.  
  56. #ifdef SYS_WIN32
  57. #include <io.h>
  58. #include <fcntl.h>
  59. #endif
  60.  
  61. #include <math.h>
  62. #include <sys/types.h>
  63. #include <sys/stat.h>
  64.  
  65. #include "defines.h"
  66.  
  67. #if __STDC__ || defined(sgi) || defined(_AIX)
  68. #define _FD(formal_parameters) formal_parameters
  69. #else
  70. #define    const
  71. #define    _FD(formal_parameters) ()
  72. #endif
  73.  
  74. /*
  75. ** structs
  76. */
  77. typedef struct _DigitInfo
  78. {
  79.     int
  80.         maxdigits;
  81.   
  82.     unsigned int
  83.         leftpad;
  84.  
  85.     unsigned int
  86.         Frame;
  87.   
  88.     unsigned int
  89.         alpha,
  90.         width,
  91.         height;
  92.  
  93.     unsigned int
  94.         use_strip,
  95.         comma;
  96.  
  97.     int
  98.         nsegment;
  99.    
  100.     int
  101.         replace_color;  /* internal flag */
  102.  
  103.     unsigned char
  104.         alpha_red,
  105.         alpha_green,
  106.         alpha_blue;
  107.  
  108.     unsigned char   /* opaque color to replace */
  109.         opaque_red,
  110.         opaque_green,
  111.         opaque_blue;
  112.  
  113.     unsigned char   /* pen color to replace a opaque color */
  114.         pen_red,
  115.         pen_green,
  116.         pen_blue;
  117.  
  118.     char
  119.         ddhead[100];
  120.  
  121.     char
  122.         datafile[2048];
  123.  
  124.     char
  125.         literal[2048];
  126.   
  127.     char
  128.         gif_file[1024];     /* display this gif file */
  129.  
  130.     unsigned int
  131.         st;
  132.  
  133.     unsigned int
  134.         show;
  135.  
  136.     unsigned int
  137.         increment_counter;
  138.  
  139.     unsigned int
  140.         image_type; /* 1 GIF, 2 XBM for now */
  141.  
  142.     unsigned int
  143.         negate;
  144.  
  145.     unsigned int
  146.         rotate;
  147.  
  148.     int
  149.         rotate_degrees;
  150.  
  151.     int
  152.         display_type;
  153.  
  154.     int 
  155.         date_format;
  156.  
  157.     int
  158.         time_format;
  159.  
  160.     char
  161.         time_z[50];
  162. } DigitInfo;
  163.  
  164. typedef struct _RectangleInfo
  165. {
  166.     unsigned int
  167.         width,
  168.         height;
  169.  
  170.     int
  171.         x,
  172.         y;
  173. } RectangleInfo;
  174.  
  175. typedef struct _EllipseInfo
  176. {
  177.     int
  178.         line_style;
  179.     int
  180.         line_thickness;
  181.  
  182.     int
  183.         semimajor_axis,
  184.         semiminor_axis;
  185.  
  186.     int
  187.         centerX,
  188.         centerY;
  189.  
  190.     unsigned  int
  191.         fill;
  192.  
  193.     int
  194.         edge_red,
  195.         edge_green,
  196.         edge_blue;
  197.  
  198.     int
  199.         fill_red,
  200.         fill_green,
  201.         fill_blue;
  202.  
  203.      int
  204.         rotation;
  205. } EllipseInfo;
  206.  
  207.  
  208. typedef struct _RGB
  209. {
  210.     unsigned char
  211.         red,
  212.         green,
  213.         blue,
  214.         flags;
  215.  
  216.     unsigned short
  217.         index;
  218. } RGB;
  219.  
  220. typedef struct _Runlength
  221. {
  222.     unsigned char
  223.         red,
  224.         green,
  225.         blue,
  226.         length;
  227.  
  228.     unsigned short
  229.         index;
  230. } Runlength;
  231.  
  232. typedef struct _FrameInfo
  233. {
  234.     int
  235.         x,
  236.         y;
  237.  
  238.     int
  239.         inner_bevel,
  240.         outer_bevel;
  241.  
  242.     unsigned int
  243.         width,
  244.         height;
  245.     RGB
  246.         matte_color,
  247.         highlight_color,
  248.         shadow_color;
  249.  
  250. } FrameInfo;
  251.  
  252. typedef struct _Image
  253. {
  254.     char
  255.         filename[2048];
  256.  
  257.     FILE
  258.         *fp;
  259.  
  260.     RGB
  261.         *colormap;
  262.  
  263.     unsigned int
  264.         colors;
  265.  
  266.     char 
  267.         type[12],
  268.         *comments;
  269.  
  270.     unsigned int
  271.         rows,
  272.         columns,
  273.         xorig,
  274.         yorig,
  275.         id,
  276.         alpha,
  277.         class,
  278.         scene,
  279.         compression;
  280.  
  281.     char
  282.         *signature;
  283.  
  284.     Runlength
  285.         *pixels;
  286.  
  287.     unsigned int
  288.         runlength,
  289.         pack_siz;
  290.  
  291.     unsigned long
  292.         packets;
  293. } Image;
  294.  
  295. typedef struct _Diversity
  296. {
  297.     unsigned char
  298.         red,
  299.         green,
  300.         blue;
  301.  
  302.     unsigned short
  303.         index;
  304.  
  305.     unsigned long
  306.         count;
  307. } Diversity;
  308.  
  309. typedef struct _ImageInfo
  310. {
  311.     char
  312.         filename[256];
  313.  
  314.     unsigned int
  315.         interlace;
  316.  
  317. } ImageInfo;
  318.  
  319. /*
  320. ** font struct from gd library
  321. */
  322.  
  323. typedef struct _gdFont
  324. {
  325.     /*
  326.     ** # of characters in font
  327.     */
  328.     int
  329.         nchars;
  330.     /*
  331.     ** First character is numbered... (usually 32 = space)
  332.     */
  333.     int
  334.         offset;
  335.     /*
  336.     ** Character width and height
  337.     */
  338.     int
  339.         w;
  340.     int
  341.         h;
  342.     /*
  343.     ** Font data; array of characters, one row after another.
  344.     ** Easily included in code, also easily loaded from
  345.     ** data files.
  346.     */
  347.     char
  348.         *data;
  349. } gdFont;
  350.  
  351. typedef gdFont
  352.     *gdFontPtr;
  353.  
  354. typedef struct _SFontInfo
  355. {
  356.     unsigned int
  357.         do_bg;
  358.  
  359.     unsigned char
  360.         fgr,
  361.         fgg,
  362.         fgb;
  363.  
  364.     unsigned char
  365.         bgr,
  366.         bgg,
  367.         bgb;
  368.  
  369. } SFontInfo;
  370. /*
  371. ** prototypes/ declarations
  372. */
  373.  
  374. Image *CreateBaseImage _FD ((unsigned int, unsigned int, int, int, int,
  375.         unsigned int));
  376. void FlattenImage _FD ((Image *, Image *, unsigned int, int, int));
  377. void ColormapSignature _FD ((Image *));
  378. Image *AllocateImageStruct _FD((void));
  379. void DestroyAnyImageStruct _FD ((Image **));
  380. int Read_Data _FD ((char *, int, int, FILE *));
  381. int ReadDataBlock _FD ((char *, FILE *));
  382. int LZWDecodeImage _FD ((Image *));
  383. void SyncImage _FD ((Image *));
  384. Image *DuplicateImage _FD ((Image *, unsigned int, unsigned int, unsigned int));
  385. int WriteGIFImage _FD ((Image *, char *));
  386. void LSBFirstWriteShort _FD ((unsigned int, FILE *));
  387. unsigned int LZWEncodeImage _FD ((Image *, unsigned int));
  388. unsigned int UncompressImage _FD ((Image *));
  389. Image *ReadImage _FD ((char *));
  390. int ReadGIFImage _FD ((Image *));
  391. Image *CombineImages _FD ((char *,DigitInfo *));
  392. void CompressImage _FD ((Image *));
  393. void QuantizeImage _FD ((Image *, unsigned int, unsigned int, unsigned int,
  394.         unsigned int, unsigned int));
  395. void RGBTransformImage _FD ((Image *, unsigned int));
  396. void TransformRGBImage _FD ((Image *, unsigned int));
  397. void CompressColormap _FD ((Image *));
  398. void Fputc _FD ((char, FILE *));
  399. Image *FrameImage _FD((Image *, FrameInfo *));
  400. void XModulate _FD((RGB *, unsigned char, unsigned char, unsigned char, int));
  401. void AlphaImage _FD((Image *, unsigned char, unsigned char, unsigned char));
  402. void OpaqueImage _FD((Image *, unsigned char, unsigned char, unsigned char,
  403.     unsigned char,unsigned char,unsigned char));
  404. void GetFrameInfo _FD ((unsigned int, unsigned int, FrameInfo *));
  405. void ImageString _FD ((Image *, gdFontPtr, int, int, char *, SFontInfo *));
  406. void ImaegChar _FD ((Image *, gdFontPtr, int, int, char, SFontInfo));
  407. void SetPixel _FD ((Image *,int, int,SFontInfo *,unsigned int));
  408. /*
  409. Image *ReadXBM _FD ((int,DigitInfo *));
  410. unsigned int WriteXBM _FD ((Image *));
  411. */
  412. void NegateImage _FD ((Image *));
  413. Image *RotateImage _FD ((Image *,int));
  414. int GetGIFsize _FD ((char *,unsigned int *,unsigned int *));
  415. Image *CropImage _FD ((Image *,RectangleInfo *));
  416.  
  417. #endif /* COMBINE_H */
  418.