version 1.1, 2000/01/09 17:01:15 |
version 1.1.1.2, 2000/01/22 14:16:28 |
|
|
* png |
* png |
* |
* |
* AUTHORS |
* AUTHORS |
* Alexander Lehmann |
* Alexander Lehmann original code, |
* derived from pbm.trm by Russell Lang |
* derived from pbm.trm by Russell Lang. |
* |
* |
* send your comments or suggestions to (info-gnuplot@dartmouth.edu). |
* send your comments or suggestions to (info-gnuplot@dartmouth.edu). |
* |
* |
Line 69 register_term(png_driver) |
|
Line 69 register_term(png_driver) |
|
#endif |
#endif |
|
|
#ifdef TERM_PROTO |
#ifdef TERM_PROTO |
TERM_PUBLIC void PNGoptions __PROTO((void)); |
TERM_PUBLIC void PNG_options __PROTO((void)); |
TERM_PUBLIC void PNGinit __PROTO((void)); |
TERM_PUBLIC void PNG_init __PROTO((void)); |
TERM_PUBLIC void PNGreset __PROTO((void)); |
TERM_PUBLIC void PNG_reset __PROTO((void)); |
TERM_PUBLIC void PNGsetfont __PROTO((void)); |
TERM_PUBLIC void PNG_setfont __PROTO((void)); |
TERM_PUBLIC void PNGgraphics __PROTO((void)); |
TERM_PUBLIC void PNG_graphics __PROTO((void)); |
TERM_PUBLIC void PNGtext __PROTO((void)); |
TERM_PUBLIC void PNG_text __PROTO((void)); |
TERM_PUBLIC void PNGlinetype __PROTO((int linetype)); |
TERM_PUBLIC void PNG_linetype __PROTO((int linetype)); |
TERM_PUBLIC void PNGpoint __PROTO((unsigned int x, unsigned int y, int point)); |
TERM_PUBLIC void PNG_point __PROTO((unsigned int x, unsigned int y, int point)); |
#endif /* TERM_PROTO */ |
#endif /* TERM_PROTO */ |
|
|
|
/* make XMAX and YMAX a multiple of 8 */ |
|
#define PNG_XMAX (640) |
|
#define PNG_YMAX (480) |
|
#define PNG_VCHAR (FNT5X9_VCHAR) |
|
#define PNG_HCHAR (FNT5X9_VCHAR) |
|
#define PNG_VTIC FNT5X9_HBITS |
|
#define PNG_HTIC FNT5X9_HBITS |
|
|
#ifdef TERM_BODY |
#ifdef TERM_BODY |
|
|
#include "png.h" |
#include "png.h" |
Line 90 TERM_PUBLIC void PNGpoint __PROTO((unsigned int x, uns |
|
Line 98 TERM_PUBLIC void PNGpoint __PROTO((unsigned int x, uns |
|
|
|
/* png version test now in configure */ |
/* png version test now in configure */ |
|
|
/* From version.c */ |
|
extern char version[]; |
|
extern char patchlevel[]; |
|
|
|
/* make XMAX and YMAX a multiple of 8 */ |
|
#define PNG_XMAX (640) |
|
#define PNG_YMAX (480) |
|
#define PNG_VCHAR (FNT5X9_VCHAR) |
|
#define PNG_HCHAR (FNT5X9_VCHAR) |
|
#define PNG_VTIC FNT5X9_HBITS |
|
#define PNG_HTIC FNT5X9_HBITS |
|
|
|
static int png_font = 1; /* small font */ |
static int png_font = 1; /* small font */ |
static int png_mode = 0; /* 0:monochrome 1:gray 2:color */ |
static int png_mode = 0; /* 0:monochrome 1:gray 2:color */ |
|
|
Line 111 static int png_gray[] = { 7, 1, 6, 5, 4, 3, 2, 1, 7 }; |
|
Line 107 static int png_gray[] = { 7, 1, 6, 5, 4, 3, 2, 1, 7 }; |
|
static int png_color_table[] ={ 15, 8, 3, 5, 6, 4, 2, 1, 11, 13, 14 }; /* colors */ |
static int png_color_table[] ={ 15, 8, 3, 5, 6, 4, 2, 1, 11, 13, 14 }; /* colors */ |
static png_color png_palette[16]; |
static png_color png_palette[16]; |
|
|
void PNGoptions() |
TERM_PUBLIC void |
|
PNG_options() |
{ |
{ |
png_font = 1; |
png_font = 1; /* small */ |
png_mode = 0; |
png_mode = 0; |
|
|
term_options[0] = NUL; |
term_options[0] = NUL; |
Line 136 void PNGoptions() |
|
Line 133 void PNGoptions() |
|
/* reset to default, since term is already set */ |
/* reset to default, since term is already set */ |
png_font = 1; |
png_font = 1; |
png_mode = 0; |
png_mode = 0; |
int_error("expecting: {small, medium, large} and {monochrome, gray, color}", c_token); |
int_error("expecting: {small, medium, large}, or {monochrome, gray, color}", c_token); |
} |
} |
c_token++; |
c_token++; |
} |
} |
Line 144 void PNGoptions() |
|
Line 141 void PNGoptions() |
|
/* setup options string */ |
/* setup options string */ |
|
|
switch (png_font) { |
switch (png_font) { |
case 1: |
case 3: |
strcat(term_options, "small"); |
strcat(term_options, "large"); |
break; |
break; |
case 2: |
case 2: |
strcat(term_options, "medium"); |
strcat(term_options, "medium"); |
break; |
break; |
case 3: |
case 1: |
strcat(term_options, "large"); |
default: |
|
strcat(term_options, "small"); |
break; |
break; |
} |
} |
|
|
switch (png_mode) { |
switch (png_mode) { |
case 0: |
case 2: |
strcat(term_options, " monochrome"); |
strcat(term_options, " color"); |
break; |
break; |
case 1: |
case 1: |
strcat(term_options, " gray"); |
strcat(term_options, " gray"); |
break; |
break; |
case 2: |
case 0: |
strcat(term_options, " color"); |
default: |
|
strcat(term_options, " monochrome"); |
break; |
break; |
} |
} |
|
|
} |
} |
|
|
|
|
void PNGinit() |
TERM_PUBLIC void |
|
PNG_init() |
{ |
{ |
PNGsetfont(); /* HBB 980226: do this here! */ |
PNG_setfont(); /* HBB 980226: do this here! */ |
} |
} |
|
|
|
|
void PNGreset() |
TERM_PUBLIC void |
|
PNG_reset() |
{ |
{ |
#ifdef VMS |
#ifdef VMS |
fflush_binary(); |
fflush_binary(); |
|
|
} |
} |
|
|
|
|
void PNGsetfont() |
TERM_PUBLIC void |
|
PNG_setfont() |
{ |
{ |
switch (png_font) { |
switch (png_font) { |
case 1: |
case 3: |
b_charsize(FNT5X9); |
b_charsize(FNT13X25); |
term->v_char = FNT5X9_VCHAR; |
term->v_char = FNT13X25_VCHAR; |
term->h_char = FNT5X9_HCHAR; |
term->h_char = FNT13X25_HCHAR; |
term->v_tic = FNT5X9_HBITS; |
term->v_tic = FNT13X25_HBITS; |
term->h_tic = FNT5X9_HBITS; |
term->h_tic = FNT13X25_HBITS; |
break; |
break; |
case 2: |
case 2: |
b_charsize(FNT9X17); |
b_charsize(FNT9X17); |
Line 200 void PNGsetfont() |
|
Line 203 void PNGsetfont() |
|
term->v_tic = FNT9X17_HBITS; |
term->v_tic = FNT9X17_HBITS; |
term->h_tic = FNT9X17_HBITS; |
term->h_tic = FNT9X17_HBITS; |
break; |
break; |
case 3: |
case 1: |
b_charsize(FNT13X25); |
default: |
term->v_char = FNT13X25_VCHAR; |
b_charsize(FNT5X9); |
term->h_char = FNT13X25_HCHAR; |
term->v_char = FNT5X9_VCHAR; |
term->v_tic = FNT13X25_HBITS; |
term->h_char = FNT5X9_HCHAR; |
term->h_tic = FNT13X25_HBITS; |
term->v_tic = FNT5X9_HBITS; |
|
term->h_tic = FNT5X9_HBITS; |
break; |
break; |
} |
} |
} |
} |
|
|
|
|
void PNGgraphics() |
TERM_PUBLIC void |
|
PNG_graphics() |
{ |
{ |
int numplanes; |
int numplanes = 1; |
|
|
switch (png_mode) { |
switch (png_mode) { |
case 0: |
case 2: |
numplanes = 1; |
numplanes = 4; |
break; |
break; |
case 1: |
case 1: |
numplanes = 3; |
numplanes = 3; |
break; |
break; |
case 2: |
case 0: |
numplanes = 4; |
default: |
|
numplanes = 1; |
break; |
break; |
} |
} |
|
|
Line 239 void PNGgraphics() |
|
Line 245 void PNGgraphics() |
|
b_setlinetype(0); /* solid lines */ |
b_setlinetype(0); /* solid lines */ |
} |
} |
|
|
void PNGtext() |
TERM_PUBLIC void |
|
PNG_text() |
{ |
{ |
register int x, j, row; |
register int x, j, row; |
png_structp png_ptr; |
png_structp png_ptr; |
|
|
b_freebitmap(); |
b_freebitmap(); |
return; |
return; |
} |
} |
|
|
|
#ifdef __OLD_PNGLIB__ |
|
/* deprecated and no longer necessary */ |
png_info_init(info_ptr); |
png_info_init(info_ptr); |
png_write_init(png_ptr); |
png_write_init(png_ptr); */ |
|
#endif /* __OLD_PNGLIB__ */ |
|
|
png_init_io(png_ptr, gpoutfile); |
png_init_io(png_ptr, gpoutfile); |
|
|
|
|
png_palette[i].green = green * 85; |
png_palette[i].green = green * 85; |
png_palette[i].blue = blue * 85; |
png_palette[i].blue = blue * 85; |
} |
} |
sprintf(text, "gnuplot %sversion %s patchlevel %s", OS, version, patchlevel); |
sprintf(text, "gnuplot %sversion %s patchlevel %s", |
|
OS, version, patchlevel); |
|
|
pngtext.compression = -1; |
pngtext.compression = -1; |
pngtext.key = "Software"; |
pngtext.key = "Software"; |
|
|
b_freebitmap(); |
b_freebitmap(); |
} |
} |
|
|
void PNGlinetype(linetype) |
|
|
TERM_PUBLIC void |
|
PNG_linetype(linetype) |
int linetype; |
int linetype; |
{ |
{ |
switch (png_mode) { |
switch (png_mode) { |
case 0: |
case 2: |
b_setlinetype(linetype); |
if (linetype >= 9) |
|
linetype %= 9; |
|
b_setvalue(png_color_table[linetype + 2]); |
break; |
break; |
case 1: |
case 1: |
if (linetype >= 7) |
if (linetype >= 7) |
linetype %= 7; |
linetype %= 7; |
b_setvalue(png_gray[linetype + 2]); |
b_setvalue(png_gray[linetype + 2]); |
break; |
break; |
case 2: |
case 0: |
if (linetype >= 9) |
default: |
linetype %= 9; |
b_setlinetype(linetype); |
b_setvalue(png_color_table[linetype + 2]); |
|
break; |
break; |
} |
} |
} |
} |
|
|
void PNGpoint(x, y, point) |
TERM_PUBLIC void |
|
PNG_point(x, y, point) |
unsigned int x, y; |
unsigned int x, y; |
int point; |
int point; |
{ |
{ |
Line 421 TERM_TABLE_START(png_driver) |
|
Line 437 TERM_TABLE_START(png_driver) |
|
"png", |
"png", |
"Portable Network Graphics [small medium large] [monochrome gray color]", |
"Portable Network Graphics [small medium large] [monochrome gray color]", |
PNG_XMAX, PNG_YMAX, PNG_VCHAR, |
PNG_XMAX, PNG_YMAX, PNG_VCHAR, |
PNG_HCHAR, PNG_VTIC, PNG_HTIC, PNGoptions, |
PNG_HCHAR, PNG_VTIC, PNG_HTIC, PNG_options, |
PNGinit, PNGreset, PNGtext, null_scale, |
PNG_init, PNG_reset, PNG_text, null_scale, |
PNGgraphics, b_move, b_vector, PNGlinetype, |
PNG_graphics, b_move, b_vector, PNG_linetype, |
b_put_text, b_text_angle, null_justify_text, PNGpoint, |
b_put_text, b_text_angle, null_justify_text, PNG_point, |
do_arrow, set_font_null, |
do_arrow, set_font_null, |
0, /* pointsize */ |
0, /* pointsize */ |
TERM_CAN_MULTIPLOT | TERM_BINARY |
TERM_CAN_MULTIPLOT | TERM_BINARY |
|
|
" set terminal png {small | medium | large}", |
" set terminal png {small | medium | large}", |
" {monochrome | gray | color}", |
" {monochrome | gray | color}", |
"", |
"", |
" The defaults are small (fontsize) and monochrome." |
" The defaults are small (fontsize) and monochrome. Default size of the output", |
|
" is 640*480 pixel." |
END_HELP(png) |
END_HELP(png) |
#endif /* TERM_HELP */ |
#endif /* TERM_HELP */ |