"Fossies" - the Fresh Open Source Software Archive

Member "epstool-3.08/src/cimg.h" (10 Jun 2005, 5679 Bytes) of package /linux/misc/old/ghost/ghostgum/epstool-3.08.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /* Copyright (C) 2001-2005 Ghostgum Software Pty Ltd.  All rights reserved.
    2 
    3   This software is provided AS-IS with no warranty, either express or
    4   implied.
    5 
    6   This software is distributed under licence and may not be copied,
    7   modified or distributed except as expressly authorised under the terms
    8   of the licence contained in the file LICENCE in this distribution.
    9 
   10   For more information about licensing, please refer to
   11   http://www.ghostgum.com.au/ or contact Ghostsgum Software Pty Ltd, 
   12   218 Gallaghers Rd, Glen Waverley VIC 3150, AUSTRALIA, 
   13   Fax +61 3 9886 6616.
   14 */
   15 
   16 /* $Id: cimg.h,v 1.16 2005/06/10 09:39:24 ghostgum Exp $ */
   17 /* Image information and format conversions header */
   18 
   19 /***************************************/
   20 /* image details */
   21 
   22 struct IMAGE_s {
   23     unsigned int width;     /* pixels */
   24     unsigned int height;    /* pixels */
   25     unsigned int raster;    /* bytes per row */
   26     unsigned int format;   /* pixel format */
   27     unsigned char *image;
   28 
   29 #ifdef UNIX
   30     GdkRgbCmap *cmap;   /* colour map = palette */
   31 #endif
   32 
   33 #ifdef _Windows
   34     BITMAPINFOHEADER bmih;
   35     HPALETTE palette;
   36     /* Windows and OS/2 require a raster line which is a multiple 
   37      * of 4 bytes.  If raster is not what we expect, then we need 
   38      * to lie about about how many pixels are really on the line 
   39      * when doing bitmap transfers.  
   40      * align_width contains our calculation of how many pixels are 
   41      * needed to match raster.
   42      * If align_width != width, then bitmap transfer uses:
   43      *  source width      = img->align_width
   44      *  destination width = img->width
   45      */
   46     int align_width;
   47 #endif
   48 };
   49     
   50 typedef enum SEPARATIONS_e {
   51     SEP_CYAN = 8,
   52     SEP_MAGENTA = 4,
   53     SEP_YELLOW = 2,
   54     SEP_BLACK = 1
   55 } SEPARATIONS;
   56 
   57 
   58 /* platform specific */
   59 
   60 /* Initialise image, creating palette if necessary
   61  * Return 0 if OK, -ve if image format not supported by platform
   62  */
   63 int image_platform_init(IMAGE *img);
   64 
   65 /* Free any platform specific image members such as a palette */
   66 
   67 int image_platform_finish(IMAGE *img);
   68 /* If format is supported by platform, return it that format.
   69  * Otherwise, return the preferred format into which it should
   70  * be converted.
   71  */
   72 unsigned int image_platform_format(unsigned int format);
   73 
   74 /* platform independent */
   75 int image_copy(IMAGE *newimg, IMAGE *oldimg, unsigned int format);
   76 int image_copy_resize(IMAGE *newimg, IMAGE *oldimg, unsigned int format,
   77     float xddpi, float yddpi, float xrdpi, float yrdpi);
   78 unsigned char colour_to_grey(unsigned char r, unsigned char g, 
   79     unsigned char b);
   80 void image_colour(unsigned int format, int index, 
   81     unsigned char *r, unsigned char *g, unsigned char *b);
   82 int image_depth(IMAGE *img);
   83 
   84 int image_to_mono(IMAGE *img, unsigned char *dest, unsigned char *source);
   85 
   86 int image_to_grey(IMAGE *img, unsigned char *dest, unsigned char *source);
   87 void image_1grey_to_8grey(int width, unsigned char *dest, unsigned char *source);
   88 void image_4grey_to_8grey(int width, unsigned char *dest, unsigned char *source);
   89 void image_1native_to_8grey(int width, unsigned char *dest, unsigned char *source);
   90 void image_4native_to_8grey(int width, unsigned char *dest, unsigned char *source);
   91 void image_8native_to_8grey(int width, unsigned char *dest, unsigned char *source);
   92 void image_24RGB_to_8grey(int width, unsigned char *dest, 
   93     unsigned char *source);
   94 void image_24BGR_to_8grey(int width, unsigned char *dest, 
   95     unsigned char *source);
   96 
   97 int image_to_24BGR(IMAGE *img, unsigned char *dest, unsigned char *source);
   98 void image_4native_to_24BGR(int width, unsigned char *dest, unsigned char *source);
   99 void image_32CMYK_to_24BGR(int width, unsigned char *dest, 
  100     unsigned char *source, int sep);
  101 void image_16RGB565_to_24BGR(int width, unsigned char *dest, unsigned char *source);
  102 void image_16RGB555_to_24BGR(int width, unsigned char *dest, unsigned char *source);
  103 void image_16BGR565_to_24BGR(int width, unsigned char *dest, unsigned char *source);
  104 void image_16BGR555_to_24BGR(int width, unsigned char *dest, unsigned char *source);
  105 
  106 int image_to_24RGB(IMAGE *img, unsigned char *dest, unsigned char *source);
  107 void image_1grey_to_24RGB(int width, unsigned char *dest, unsigned char *source);
  108 void image_4grey_to_24RGB(int width, unsigned char *dest, unsigned char *source);
  109 void image_8grey_to_24RGB(int width, unsigned char *dest, unsigned char *source);
  110 void image_1native_to_24RGB(int width, unsigned char *dest, unsigned char *source);
  111 void image_4native_to_24RGB(int width, unsigned char *dest, unsigned char *source);
  112 void image_8native_to_24RGB(int width, unsigned char *dest, unsigned char *source);
  113 void image_32CMYK_to_24RGB(int width, unsigned char *dest, unsigned char *source, int sep);
  114 void image_16RGB565_to_24RGB(int width, unsigned char *dest, unsigned char *source);
  115 void image_16RGB555_to_24RGB(int width, unsigned char *dest, unsigned char *source);
  116 void image_16BGR565_to_24RGB(int width, unsigned char *dest, unsigned char *source);
  117 void image_16BGR555_to_24RGB(int width, unsigned char *dest, unsigned char *source);
  118 
  119 int image_merge_cmyk(IMAGE *img, IMAGE *layer, float cyan, float magenta,
  120    float yellow, float black);
  121 int image_down_scale(IMAGE *newimg, IMAGE *oldimg);
  122 /* use_85 parameter */
  123 #define IMAGE_ENCODE_HEX 0
  124 #define IMAGE_ENCODE_ASCII85 1
  125 /* compress parameter */
  126 #define IMAGE_COMPRESS_NONE 0
  127 #define IMAGE_COMPRESS_RLE 1
  128 #define IMAGE_COMPRESS_LZW 2
  129 int image_to_eps(GFile *f, IMAGE *img, int llx, int lly, int urx, int ury,
  130     float fllx, float flly, float furx, float fury, int use_a85, int compress);
  131 int image_to_epsfile(IMAGE *img, LPCTSTR filename, float xdpi, float ydpi);
  132 int packbits(BYTE *comp, BYTE *raw, int length);