00001 /* 00002 * This software is copyrighted as noted below. It may be freely copied, 00003 * modified, and redistributed, provided that the copyright notice is 00004 * preserved on all copies. 00005 * 00006 * There is no warranty or other guarantee of fitness for this software, 00007 * it is provided solely "as is". Bug reports or fixes may be sent 00008 * to the author, who may or may not act on them as he desires. 00009 * 00010 * You may not include this software in a program or other software product 00011 * without supplying the source, or without informing the end-user that the 00012 * source is available for no extra charge. 00013 * 00014 * If you modify this software, you should include a notice giving the 00015 * name of the person performing the modification, the date of modification, 00016 * and the reason for such modification. 00017 */ 00018 /* 00019 * svfb_global.h - externally visible variables for svfb. 00020 * 00021 * Author: Todd W. Fuqua 00022 * Computer Science Dept. 00023 * University of Utah 00024 * Date: Sun Jul 29 1984 00025 * Copyright (c) 1984 Todd W. Fuqua 00026 * 00027 * $Header: /cvsroot/brlcad/brlcad/include/svfb_global.h,v 14.2 2005/10/23 04:44:26 brlcad Exp $ 00028 */ 00029 00030 enum sv_dispatch { 00031 RUN_DISPATCH 00032 }; 00033 00034 /* On BIGENDIAN machines swap the bytes. Everything but vax's and 00035 * pdp-11's (not sure if it's pdp11 or PDP11 ??) 00036 * are considered BIGENDIAN machines. 00037 */ 00038 #if !defined(vax) && !defined(pdp11) 00039 #define SWAB(shrt) (shrt = ((shrt >> 8) & 0xff) | ((shrt << 8) & 0xff00)) 00040 #else 00041 #define SWAB(shrt) 00042 #endif 00043 00044 /* **************************************************************** 00045 * TAG( rle_pixel rle_map ) 00046 * 00047 * Typedef for 8-bit (or less) pixel data. 00048 * 00049 * Typedef for 16-bit color map data. 00050 */ 00051 typedef unsigned char rle_pixel; 00052 typedef unsigned short rle_map; 00053 00054 /* 00055 * Defines for traditional channel numbers 00056 */ 00057 #define SV_RED 0 /* red channel traditionally here */ 00058 #define SV_GREEN 1 /* green channel traditionally here */ 00059 #define SV_BLUE 2 /* blue channel traditionally here */ 00060 #define SV_ALPHA -1 /* Alpha channel here */ 00061 00062 /* 00063 * Return values from rle_get_setup 00064 */ 00065 #define RLE_SUCCESS 0 00066 #define RLE_NOT_RLE -1 00067 #define RLE_NO_SPACE -2 00068 #define RLE_EMPTY -3 00069 #define RLE_EOF -4 00070 00071 /* 00072 * TAG( sv_globals ) 00073 * 00074 * Definition of "globals" structure used by RLE routines 00075 */ 00076 00077 extern struct sv_globals { 00078 enum sv_dispatch sv_dispatch; /* type of file to create */ 00079 int sv_ncolors, /* number of color channels */ 00080 * sv_bg_color, /* pointer to bg color vector */ 00081 sv_alpha, /* if !0, save alpha channel */ 00082 sv_background, /* (background) 0->just save pixels, */ 00083 /* 1->overlay, 2->clear to bg first */ 00084 sv_xmin, /* lower X bound (left) */ 00085 sv_xmax, /* upper X bound (right) */ 00086 sv_ymin, /* lower Y bound (bottom) */ 00087 sv_ymax, /* upper Y bound (top) */ 00088 sv_ncmap, /* number of color channels in color map */ 00089 /* map only saved if != 0 */ 00090 sv_cmaplen; /* log2 of color map length */ 00091 rle_map * sv_cmap; /* pointer to color map array */ 00092 char ** sv_comments; /* pointer to array of pointers to comments */ 00093 FILE * svfb_fd; /* output file */ 00094 /* 00095 * Bit map of channels to read/save. Indexed by (channel mod 256). 00096 * Alpha channel sets bit 255. 00097 * 00098 * Indexing (0 <= c <= 255): 00099 * sv_bits[c/8] & (1 << (c%8)) 00100 */ 00101 #define SV_SET_BIT(glob,bit) \ 00102 ((glob).sv_bits[((bit)&0xff)/8] |= (1<<((bit)&0x7))) 00103 #define SV_CLR_BIT(glob,bit) \ 00104 ((glob).sv_bits[((bit)&0xff)/8] &= ~(1<<((bit)&0x7))) 00105 #define SV_BIT(glob,bit) \ 00106 ((glob).sv_bits[((bit)&0xff)/8] & (1<<((bit)&0x7))) 00107 char sv_bits[256/8]; 00108 /* 00109 * Local storage for rle_getrow & sv_putrow. 00110 * rle_getrow has 00111 * scan_y int current Y scanline 00112 * vert_skip int number of lines to skip 00113 * sv_putrow has 00114 * nblank int number of blank lines 00115 * brun short(*)[2] Array of background runs. 00116 * fileptr long Position in output file. 00117 */ 00118 union { 00119 struct { 00120 int scan_y, 00121 vert_skip; 00122 char is_eof, /* Set when EOF or EofOp encountered */ 00123 is_seek; /* If true, can seek input file */ 00124 } get; 00125 struct { 00126 int nblank; 00127 short (*brun)[2]; 00128 long fileptr; 00129 } put; 00130 } sv_private; 00131 } sv_globals; 00132 00133 00134 /* 00135 * buildmap - build a more usable colormap from data in globals struct. 00136 */ 00137 extern rle_pixel ** 00138 buildmap(); 00139 /* ( globals, minmap, gamma ) 00140 * struct sv_globals * globals; 00141 * int minmap; 00142 * double gamma; 00143 */ 00144 00145 /* 00146 * rle_getcom - get a specific comment from the image comments. 00147 */ 00148 extern char * 00149 rle_getcom(); 00150 /* ( name, globals ) 00151 * char * name; 00152 * struct sv_globals * globals; 00153 */ 00154 00155 /* 00156 * rle_putcom - put (or replace) a comment into the image comments. 00157 */ 00158 extern char * 00159 rle_putcom(); 00160 /* ( value, globals ) 00161 * char * value; 00162 * struct sv_globals * globals; 00163 */ 00164 00165 /* 00166 * rle_delcom - delete a specific comment from the image comments. 00167 */ 00168 extern char * 00169 rle_delcom(); 00170 /* ( name, globals ) 00171 * char * name; 00172 * struct sv_globals * globals; 00173 */ 00174 00175 /* 00176 * Local Variables: 00177 * mode: C 00178 * tab-width: 8 00179 * c-basic-offset: 4 00180 * indent-tabs-mode: t 00181 * End: 00182 * ex: shiftwidth=4 tabstop=8 00183 */