inc/vGfx.h File Reference

#include "memgfx.h"
#include "hash.h"

Include dependency graph for vGfx.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  vGfx

Defines

#define vgDot(v, x, y, color)   v->dot(v->data,x,y,color)
#define vgGetDot(v, x, y)   v->getDot(v->data,x,y)
#define vgBox(v, x, y, width, height, color)   v->box(v->data,x,y,width,height,color)
#define vgLine(v, x1, y1, x2, y2, color)   v->line(v->data,x1,y1,x2,y2,color)
#define vgText(v, x, y, color, font, string)   v->text(v->data,x,y,color,font,string)
#define vgTextRight(v, x, y, width, height, color, font, string)   v->textRight(v->data,x,y,width,height,color,font,string)
#define vgTextCentered(v, x, y, width, height, color, font, string)   v->textCentered(v->data,x,y,width,height,color,font,string)
#define vgFindColorIx(v, r, g, b)   v->findColorIx(v->data, r, g, b)
#define vgColorIxToRgb(v, colorIx)   v->colorIxToRgb(v->data, colorIx)
#define vgSetClip(v, x, y, width, height)   v->setClip(v->data, x, y, width, height)
#define vgUnclip(v)   v->unclip(v->data);
#define vgVerticalSmear(v, x, y, w, h, dots, zeroClear)   v->verticalSmear(v->data,x,y,w,h,dots,zeroClear)
#define vgFillUnder(v, x1, y1, x2, y2, bottom, color)   v->fillUnder(v->data,x1,y1,x2,y2,bottom,color)
#define vgDrawPoly(v, poly, color, filled)   v->drawPoly(v->data,poly,color,filled)
#define vgSetHint(v, hint, value)   v->setHint(v->data,hint,value)
#define vgGetHint(v, hint)   v->getHint(v->data,hint)

Functions

vGfxvgOpenGif (int width, int height, char *fileName)
vGfxvgOpenPostScript (int width, int height, char *fileName)
void vgClose (struct vGfx **pVg)
int vgFindRgb (struct vGfx *vg, struct rgbColor *rgb)
Color vgContrastingColor (struct vGfx *vg, int backgroundIx)


Define Documentation

#define vgBox ( v,
x,
y,
width,
height,
color   )     v->box(v->data,x,y,width,height,color)

Definition at line 107 of file vGfx.h.

Referenced by vgDrawRulerBumpText().

#define vgColorIxToRgb ( v,
colorIx   )     v->colorIxToRgb(v->data, colorIx)

Definition at line 127 of file vGfx.h.

Referenced by vgContrastingColor().

#define vgDot ( v,
x,
y,
color   )     v->dot(v->data,x,y,color)

Definition at line 99 of file vGfx.h.

#define vgDrawPoly ( v,
poly,
color,
filled   )     v->drawPoly(v->data,poly,color,filled)

Definition at line 153 of file vGfx.h.

Referenced by vgNextItemButton().

#define vgFillUnder ( v,
x1,
y1,
x2,
y2,
bottom,
color   )     v->fillUnder(v->data,x1,y1,x2,y2,bottom,color)

Definition at line 146 of file vGfx.h.

#define vgFindColorIx ( v,
r,
g,
 )     v->findColorIx(v->data, r, g, b)

Definition at line 124 of file vGfx.h.

Referenced by vgFindRgb().

#define vgGetDot ( v,
x,
 )     v->getDot(v->data,x,y)

Definition at line 103 of file vGfx.h.

#define vgGetHint ( v,
hint   )     v->getHint(v->data,hint)

Definition at line 161 of file vGfx.h.

#define vgLine ( v,
x1,
y1,
x2,
y2,
color   )     v->line(v->data,x1,y1,x2,y2,color)

Definition at line 110 of file vGfx.h.

Referenced by vgBarbedHorizontalLine().

#define vgSetClip ( v,
x,
y,
width,
height   )     v->setClip(v->data, x, y, width, height)

Definition at line 130 of file vGfx.h.

#define vgSetHint ( v,
hint,
value   )     v->setHint(v->data,hint,value)

Definition at line 157 of file vGfx.h.

#define vgText ( v,
x,
y,
color,
font,
string   )     v->text(v->data,x,y,color,font,string)

Definition at line 113 of file vGfx.h.

#define vgTextCentered ( v,
x,
y,
width,
height,
color,
font,
string   )     v->textCentered(v->data,x,y,width,height,color,font,string)

Definition at line 120 of file vGfx.h.

Referenced by vgDrawRulerBumpText().

#define vgTextRight ( v,
x,
y,
width,
height,
color,
font,
string   )     v->textRight(v->data,x,y,width,height,color,font,string)

Definition at line 116 of file vGfx.h.

#define vgUnclip (  )     v->unclip(v->data);

Definition at line 134 of file vGfx.h.

#define vgVerticalSmear ( v,
x,
y,
w,
h,
dots,
zeroClear   )     v->verticalSmear(v->data,x,y,w,h,dots,zeroClear)

Definition at line 142 of file vGfx.h.


Function Documentation

void vgClose ( struct vGfx **  pVg  ) 

Definition at line 13 of file vGfx.c.

References vGfx::close, vGfx::data, and freez().

00015 {
00016 struct vGfx *vg = *pVg;
00017 if (vg != NULL)
00018     {
00019     vg->close(&vg->data);
00020     freez(pVg);
00021     }
00022 }

Here is the call graph for this function:

Color vgContrastingColor ( struct vGfx vg,
int  backgroundIx 
)

Definition at line 40 of file vGfx.c.

References rgbColor::b, rgbColor::g, MG_BLACK, MG_WHITE, rgbColor::r, and vgColorIxToRgb.

00043 {
00044 struct rgbColor c = vgColorIxToRgb(vg, backgroundIx);
00045 int val = (int)c.r + c.g + c.g + c.b;
00046 if (val > 512)
00047     return MG_BLACK;
00048 else
00049     return MG_WHITE;
00050 }

int vgFindRgb ( struct vGfx vg,
struct rgbColor rgb 
)

Definition at line 34 of file vGfx.c.

References rgbColor::b, rgbColor::g, rgbColor::r, and vgFindColorIx.

00036 {
00037 return vgFindColorIx(vg, rgb->r, rgb->g, rgb->b);
00038 }

struct vGfx* vgOpenGif ( int  width,
int  height,
char *  fileName 
) [read]

Definition at line 33 of file vGif.c.

References AllocVar, cloneString(), vGfx::close, vGfx::data, freez(), gif, memGifClose(), mgClearPixels(), mgNew(), vgHalfInit(), and vgMgMethods().

00035 {
00036 struct memGif *gif;
00037 struct memGfx *mg;
00038 struct vGfx *vg;
00039 
00040 /* Set up virtual graphics with memory methods. */
00041 vg = vgHalfInit(width, height);
00042 vgMgMethods(vg);
00043 vg->close = (vg_close)memGifClose;
00044 
00045 /* Get our mg + fileName structure.  We're forcing
00046  * inheritence from mg essentially. */
00047 AllocVar(gif);
00048 gif->fileName = cloneString(fileName);
00049 
00050 /* Fill in the mg part of this structure with normal memGfx. */
00051 mg = mgNew(width, height);
00052 mgClearPixels(mg);
00053 gif->mg = *mg;
00054 freez(&mg);     /* We don't need this copy any more. */
00055 
00056 vg->data = gif;
00057 return vg;
00058 }

Here is the call graph for this function:

struct vGfx* vgOpenPostScript ( int  width,
int  height,
char *  fileName 
) [read]

Definition at line 384 of file pscmGfx.c.

References vGfx::box, vGfx::close, vGfx::colorIxToRgb, vGfx::data, vGfx::dot, vGfx::drawPoly, vGfx::fillUnder, vGfx::findColorIx, vGfx::getHint, vGfx::line, pscmBox(), pscmClose(), pscmColorIxToRgb(), pscmDot(), pscmDrawPoly(), pscmFillUnder(), pscmFindColorIx(), pscmGetHint(), pscmLine(), pscmOpen(), pscmSetClip(), pscmSetHint(), pscmText(), pscmTextCentered(), pscmTextRight(), pscmUnclip(), pscmVerticalSmear(), vGfx::setClip, vGfx::setHint, vGfx::text, vGfx::textCentered, vGfx::textRight, vGfx::unclip, vGfx::verticalSmear, vg_colorIxToRgb, and vgHalfInit().

00386 {
00387 struct vGfx *vg = vgHalfInit(width, height);
00388 vg->data = pscmOpen(width, height, fileName);
00389 vg->close = (vg_close)pscmClose;
00390 vg->dot = (vg_dot)pscmDot;
00391 vg->box = (vg_box)pscmBox;
00392 vg->line = (vg_line)pscmLine;
00393 vg->text = (vg_text)pscmText;
00394 vg->textRight = (vg_textRight)pscmTextRight;
00395 vg->textCentered = (vg_textCentered)pscmTextCentered;
00396 vg->findColorIx = (vg_findColorIx)pscmFindColorIx;
00397 vg->colorIxToRgb = (vg_colorIxToRgb)pscmColorIxToRgb;
00398 vg->setClip = (vg_setClip)pscmSetClip;
00399 vg->unclip = (vg_unclip)pscmUnclip;
00400 vg->verticalSmear = (vg_verticalSmear)pscmVerticalSmear;
00401 vg->fillUnder = (vg_fillUnder)pscmFillUnder;
00402 vg->drawPoly = (vg_drawPoly)pscmDrawPoly;
00403 vg->setHint = (vg_setHint)pscmSetHint;
00404 vg->getHint = (vg_getHint)pscmGetHint;
00405 return vg;
00406 }

Here is the call graph for this function:


Generated on Tue Dec 25 19:18:38 2007 for blat by  doxygen 1.5.2