#include <math.h>#include "gd.h"#include "gdfonts.h"#include "gdfontt.h"#include "gdfontmb.h"#include "gdfontg.h"#include "gdfontl.h"Go to the source code of this file.
Defines | |
| #define | TRUE 1 |
| #define | FALSE 0 |
| #define | GDC_NOVALUE -MAXFLOAT |
| #define | GDC_NULL GDC_NOVALUE |
| #define | ABS(x) ( (x)<0.0? -(x): (x) ) |
| #define | MAX(x, y) ( (x)>(y)?(x):(y) ) |
| #define | MIN(x, y) ( (x)<(y)?(x):(y) ) |
| #define | GDC_NOCOLOR 0x1000000L |
| #define | GDC_DFLTCOLOR 0x2000000L |
| #define | PVRED 0x00FF0000 |
| #define | PVGRN 0x0000FF00 |
| #define | PVBLU 0x000000FF |
| #define | l2gdcal(c) ((c)&PVRED)>>16 , ((c)&PVGRN)>>8 , ((c)&0x000000FF) |
| #define | l2gdshd(c) (((c)&PVRED)>>16)/2 , (((c)&PVGRN)>>8)/2 , (((c)&0x000000FF))/2 |
| #define | _gdcntrst(bg) |
| #define | _clrallocate(im, rawclr, bgc) |
| #define | _clrshdallocate(im, rawclr, bgc) |
| #define | EXTERND extern |
| #define | DEFAULTO(val) |
| #define | EXTERND extern |
Enumerations | |
| enum | GDC_font_size { GDC_pad = 0, GDC_TINY = 1, GDC_SMALL = 2, GDC_MEDBOLD = 3, GDC_LARGE = 4, GDC_GIANT = 5, GDC_numfonts = 6 } |
| enum | GDC_HOLD_IMAGE_T { GDC_DESTROY_IMAGE = 0, GDC_EXPOSE_IMAGE = 1, GDC_REUSE_IMAGE = 2 } |
Functions | |
| void | GDC_destroy_image (void *) |
| void | out_err (int GIFWIDTH, int GIFHEIGHT, FILE *, unsigned long BGColor, unsigned long LineColor, char *str) |
Variables | |
| static int | _gdccfoo1 |
| static unsigned long | _gdccfoo2 |
| char | GDC_generate_gif |
| GDC_HOLD_IMAGE_T | GDC_hold_img |
| void * | GDC_image |
| #define _clrallocate | ( | im, | |||
| rawclr, | |||||
| bgc | ) |
Value:
( (_gdccfoo2=rawclr==GDC_DFLTCOLOR? _gdcntrst(bgc): rawclr), \ (_gdccfoo1=gdImageColorExact(im,l2gdcal(_gdccfoo2))) != -1? \ _gdccfoo1: \ gdImageColorsTotal(im) == gdMaxColors? \ gdImageColorClosest(im,l2gdcal(_gdccfoo2)): \ gdImageColorAllocate(im,l2gdcal(_gdccfoo2)) )
| #define _clrshdallocate | ( | im, | |||
| rawclr, | |||||
| bgc | ) |
Value:
( (_gdccfoo2=rawclr==GDC_DFLTCOLOR? _gdcntrst(bgc): rawclr), \ (_gdccfoo1=gdImageColorExact(im,l2gdshd(_gdccfoo2))) != -1? \ _gdccfoo1: \ gdImageColorsTotal(im) == gdMaxColors? \ gdImageColorClosest(im,l2gdshd(_gdccfoo2)): \ gdImageColorAllocate(im,l2gdshd(_gdccfoo2)) )
| #define _gdcntrst | ( | bg | ) |
| #define ABS | ( | x | ) | ( (x)<0.0? -(x): (x) ) |
| #define GDC_NOVALUE -MAXFLOAT |
| #define l2gdcal | ( | c | ) | ((c)&PVRED)>>16 , ((c)&PVGRN)>>8 , ((c)&0x000000FF) |
| #define l2gdshd | ( | c | ) | (((c)&PVRED)>>16)/2 , (((c)&PVGRN)>>8)/2 , (((c)&0x000000FF))/2 |
| #define MAX | ( | x, | |||
| y | ) | ( (x)>(y)?(x):(y) ) |
| #define MIN | ( | x, | |||
| y | ) | ( (x)<(y)?(x):(y) ) |
| enum GDC_font_size |
Definition at line 60 of file gdc.h.
00060 { GDC_pad = 0, 00061 GDC_TINY = 1, 00062 GDC_SMALL = 2, 00063 GDC_MEDBOLD = 3, 00064 GDC_LARGE = 4, 00065 GDC_GIANT = 5, 00066 GDC_numfonts= 6 }; /* GDC[PIE]_fontc depends on this */
| enum GDC_HOLD_IMAGE_T |
Definition at line 68 of file gdc.h.
00068 { 00069 GDC_DESTROY_IMAGE = 0, /* default */ 00070 GDC_EXPOSE_IMAGE = 1, /* user must call GDC_destroy_image() */ 00071 GDC_REUSE_IMAGE = 2 /* i.e., paint on top of */ 00072 } GDC_HOLD_IMAGE_T; /* EXPOSE & REUSE */
| void GDC_destroy_image | ( | void * | ) |
Definition at line 128 of file gdc.cpp.
References gdImageDestroy().
00129 { 00130 if( im ) 00131 gdImageDestroy( (gdImagePtr)im ); 00132 }
| void out_err | ( | int | GIFWIDTH, | |
| int | GIFHEIGHT, | |||
| FILE * | , | |||
| unsigned long | BGColor, | |||
| unsigned long | LineColor, | |||
| char * | str | |||
| ) |
Definition at line 136 of file gdc.cpp.
References GDC_EXPOSE_IMAGE, GDC_fontc, GDC_generate_gif, GDC_hold_img, GDC_image, GDC_MEDBOLD, GDC_REUSE_IMAGE, gdFontMediumBold, gdImageColorAllocate(), gdImageCreate(), gdImageDestroy(), gdImageGif(), gdImageString(), and l2gdcal.
Referenced by out_graph().
00142 { 00143 00144 gdImagePtr im; 00145 int lineclr; 00146 int bgclr; 00147 00148 00149 if( (GDC_hold_img & GDC_REUSE_IMAGE) && 00150 GDC_image != (void*)NULL ) 00151 im = (gdImage *) GDC_image; 00152 else 00153 im = gdImageCreate( GIFWIDTH, GIFHEIGHT ); 00154 00155 bgclr = gdImageColorAllocate( im, l2gdcal(BGColor) ); 00156 lineclr = gdImageColorAllocate( im, l2gdcal(LineColor) ); 00157 00158 gdImageString( im, 00159 gdFontMediumBold, 00160 GIFWIDTH/2 - GDC_fontc[GDC_MEDBOLD].w*strlen((const char *)err_str)/2, 00161 GIFHEIGHT/3, 00162 (unsigned char *) err_str, 00163 lineclr ); 00164 00165 /* usually GDC_generate_gif is used in conjunction with hard or hold options */ 00166 if( GDC_generate_gif ) 00167 { 00168 fflush(fptr); // clear anything buffered 00169 gdImageGif(im, fptr); 00170 } 00171 00172 if( GDC_hold_img & GDC_EXPOSE_IMAGE ) 00173 GDC_image = (void*)im; 00174 else 00175 gdImageDestroy(im); 00176 return; 00177 }
| char GDC_generate_gif |
Referenced by out_err(), and out_graph().
Referenced by out_err(), and out_graph().
| void* GDC_image |
Referenced by out_err(), and out_graph().
1.5.1