00001
00002
00003
00004
00005 #ifndef VGFX_H
00006 #define VGFX_H
00007
00008 #ifndef MEMGFX_H
00009 #include "memgfx.h"
00010 #include "hash.h"
00011 #endif
00012
00013 struct vGfx
00014
00015
00016 {
00017 struct vGfx *next;
00018 void *data;
00019 boolean pixelBased;
00020 int width, height;
00021
00022 void (*close)(void **pV);
00023
00024
00025 void (*dot)(void *v, int x, int y, int colorIx);
00026
00027
00028
00029 int (*getDot)(void *v, int x, int y);
00030
00031
00032
00033 void (*box)(void *v, int x, int y,
00034 int width, int height, int colorIx);
00035
00036
00037 void (*line)(void *v,
00038 int x1, int y1, int x2, int y2, int colorIx);
00039
00040
00041 void (*text)(void *v, int x, int y, int colorIx, void *font, char *text);
00042
00043
00044 void (*textRight)(void *v, int x, int y, int width, int height,
00045 int colorIx, void *font, char *text);
00046
00047
00048 void (*textCentered)(void *v, int x, int y, int width, int height,
00049 int colorIx, void *font, char *text);
00050
00051
00052 int (*findColorIx)(void *v, int r, int g, int b);
00053
00054
00055
00056 struct rgbColor (*colorIxToRgb)(void *v, int colorIx);
00057
00058
00059 void (*setClip)(void *v, int x, int y, int width, int height);
00060
00061
00062 void (*unclip)(void *v);
00063
00064
00065 void (*verticalSmear)(void *v,
00066 int xOff, int yOff, int width, int height,
00067 unsigned char *dots, boolean zeroClear);
00068
00069
00070 void (*fillUnder)(void *v, int x1, int y1, int x2, int y2,
00071 int bottom, Color color);
00072
00073
00074
00075
00076
00077 void (*drawPoly)(void *v, struct gfxPoly *poly, Color color,
00078 boolean filled);
00079
00080
00081 void (*setHint)(void *v, char *hint, char *value);
00082
00083
00084 char * (*getHint)(void *v, char *hint);
00085
00086
00087 };
00088
00089 struct vGfx *vgOpenGif(int width, int height, char *fileName);
00090
00091
00092
00093 struct vGfx *vgOpenPostScript(int width, int height, char *fileName);
00094
00095
00096 void vgClose(struct vGfx **pVg);
00097
00098
00099 #define vgDot(v,x,y, color) v->dot(v->data,x,y,color)
00100
00101
00102
00103 #define vgGetDot(v,x,y) v->getDot(v->data,x,y)
00104
00105
00106
00107 #define vgBox(v,x,y,width,height,color) v->box(v->data,x,y,width,height,color)
00108
00109
00110 #define vgLine(v,x1,y1,x2,y2,color) v->line(v->data,x1,y1,x2,y2,color)
00111
00112
00113 #define vgText(v,x,y,color,font,string) v->text(v->data,x,y,color,font,string)
00114
00115
00116 #define vgTextRight(v,x,y,width,height,color,font,string) \
00117 v->textRight(v->data,x,y,width,height,color,font,string)
00118
00119
00120 #define vgTextCentered(v,x,y,width,height,color,font,string) \
00121 v->textCentered(v->data,x,y,width,height,color,font,string)
00122
00123
00124 #define vgFindColorIx(v,r,g,b) v->findColorIx(v->data, r, g, b)
00125
00126
00127 #define vgColorIxToRgb(v,colorIx) v->colorIxToRgb(v->data, colorIx)
00128
00129
00130 #define vgSetClip(v,x,y,width,height) \
00131 v->setClip(v->data, x, y, width, height)
00132
00133
00134 #define vgUnclip(v) v->unclip(v->data);
00135
00136
00137
00138
00139
00140
00141
00142 #define vgVerticalSmear(v,x,y,w,h,dots,zeroClear) \
00143 v->verticalSmear(v->data,x,y,w,h,dots,zeroClear)
00144
00145
00146 #define vgFillUnder(v,x1,y1,x2,y2,bottom,color) \
00147 v->fillUnder(v->data,x1,y1,x2,y2,bottom,color)
00148
00149
00150
00151
00152
00153 #define vgDrawPoly(v,poly,color,filled) \
00154 v->drawPoly(v->data,poly,color,filled)
00155
00156
00157 #define vgSetHint(v,hint,value) \
00158 v->setHint(v->data,hint,value)
00159
00160
00161 #define vgGetHint(v,hint) \
00162 v->getHint(v->data,hint)
00163
00164
00165
00166
00167 int vgFindRgb(struct vGfx *vg, struct rgbColor *rgb);
00168
00169
00170 Color vgContrastingColor(struct vGfx *vg, int backgroundIx);
00171
00172
00173
00174 #endif