24 #include "starbase.c.h"
35 #define MAX(i,j) ( (i) > (j) ? (i) : (j) )
42 #define RASTERSIZE_LIM 1023
45 #define COLMAP_OFFSET 8
48 #define MONOCHROME_MODE 1
49 #define EIGHT_BIT_COLOR_MODE 2
108 int argc;
char *argv[];
118 "getbob l%- g%-gamma!f p%-pos!d!d d%-display!s x%-driver!s file%s",
143 for ( i= 0; i < 4; i++ )
170 for ( i = 0; i < 256; i++ )
174 gammamap[i] = (
int)(0.5 + 255 * pow( i / 255.0, 1.0/
gam ));
187 init_8_bit_color_map()
198 colmap[i][0] = ((i%6) * 51) / 255.0;
199 colmap[i][1] = (((i/6)%6) * 51) / 255.0;
200 colmap[i][2] = (((i/36)%6) * 51) / 255.0;
217 init_monochrome_color_map( ncolors )
226 for ( k = 0; k < ncolors; k++ )
228 color_val = (k * 255) / (ncolors - 1);
240 #define DMAP(v,x,y) (errN[v]>dm16[x][y] ? divN[v] + 1
: divN[v])
251 register unsigned char *r, *g, *b;
252 register int i, dither_col, dither_row;
255 int g_offset, b_offset;
271 for ( i = 0; i < xmax; i++, r++, g++, b++,
272 dither_col = ((dither_col + 1) & 15),
275 DMAP( *r, dither_col, dither_row ) +
276 DMAP( *g, dither_col, dither_row ) * 6 +
277 DMAP( *b, dither_col, dither_row ) * 36 +
285 b_offset = 2 * g_offset;
287 for ( i = 0; i < xmax; i++, r++, g++, b++,
288 dither_col = ((dither_col + 1) & 15),
293 dither_col, dither_row ) * 6 +
295 dither_col, dither_row ) * 36 +
301 for ( i = 0; i < xmax; i++, r++, g++, b++,
302 dither_col = ((dither_col + 1) & 15),
325 register unsigned char *r, *g, *b;
326 register int i, dither_col, dither_row;
330 int g_offset, b_offset;
345 for ( i = 0; i < xmax; i++, r++, g++, b++,
346 dither_col = ((dither_col + 1) & 15),
350 (35*(*r) + 55*(*g) + 10*(*b)) / 100;
360 b_offset = 2 * g_offset;
362 for ( i = 0; i < xmax; i++, r++, g++, b++,
363 dither_col = ((dither_col + 1) & 15),
369 10 *
hdr.cmap[*b + b_offset] ) / 100;
377 for ( i = 0; i < xmax; i++, r++, g++, b++,
378 dither_col = ((dither_col + 1) & 15),
401 single p_lim[2][3], res[3], p1[3], p2[3];
403 int dev_xmax, dev_ymax;
405 picture_fd = gopen( display_name, OUTDEV, driver_name, 0 );
408 fprintf( stderr,
"Can't open device.\n" );
413 inquire_sizes(
picture_fd, p_lim, res, p1, p2, &map_size );
415 if ( map_size >= 256 )
418 init_8_bit_color_map();
437 dev_xmax =
MAX( p_lim[0][0], p_lim[1][0] );
438 dev_ymax =
MAX( p_lim[0][1], p_lim[1][1] );
454 mapping_mode( picture_fd, DISTORT );
472 write_color_map( star_fd )
506 void bcopy( src_ptr, dst_ptr, size )
507 register int * src_ptr, * dst_ptr;
511 register char * byte_src_ptr, * byte_dst_ptr;
515 words=size/
sizeof(
int);
516 bytes = size - words*
sizeof(
int);
518 *dst_ptr++ = *src_ptr++;
521 byte_src_ptr = (
char *)src_ptr;
522 byte_dst_ptr = (
char *)dst_ptr;
524 *byte_dst_ptr++ = *byte_src_ptr++;
FILE * rle_open_f(char *prog_name, char *file_name, char *mode)
single starbase_color_type[3]
void make_square(double N, divN, modN, magic)
void rle_names(rle_hdr *the_hdr, const char *pgmname, const char *fname, int img_num)
static starbase_color_type colmap[216]
char * cmd_name(char **argv)
void main(int argc, char **argv)
starbase_color_index_type dest_pixels[1023]
int rle_getrow(rle_hdr *the_hdr, scanline)
int scanargs(int argc, char **argv, const char *format,...)
unsigned char starbase_color_index_type
unsigned char scanline[4][1023]
void rle_get_setup_ok(rle_hdr *the_hdr, const char *prog_name, const char *file_name)
#define RLE_CLR_BIT(glob, bit)
#define EIGHT_BIT_COLOR_MODE
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)