include/vgraph.h

00001 #ifndef VGRAPH_H
00002 #define VGRAPH_H
00003 
00004 
00005 
00006 // virtual graphics and drawing
00007 // routines to manage display of a UI
00008 
00009 #include "liqbase.h"
00010 #include "liqcell.h"
00011 
00012         
00013 
00014 typedef unsigned int vcolor;
00015 
00016 //#define vcolor_YUV(y,u,v)  ((unsigned int)( (((unsigned int)(y))<<24) | (((unsigned int)(u))<<16) | (((unsigned int)(v))<<8) | 0) )
00017 
00018 // this is endian specific and horrible, it just means if memory converted to char * its ordered "YUVA"
00019 #define vcolor_YUV(y,u,v)  ((unsigned int)( (((unsigned int)(v))<<16) | (((unsigned int)(u))<<8) | (((unsigned int)(y))) ) )
00020 
00021 typedef
00022 struct vgraph
00023 {
00024         int usagecount;
00025         
00026         
00027         liqcliprect *cliprect;
00028         liqimage *target;
00029 
00030         int scalex;
00031         int scaley;
00032         
00033         int scalew;
00034         int scaleh;
00035         
00036         
00037         liqcell *window;
00038 
00039         
00040         unsigned int backcolor;
00041         unsigned int pencolor;
00042         unsigned int penthick;
00043         
00044         liqfont *font;          // i just release the one I have when I change fonts...   maybe even use a central fontlibrary :)
00045         
00046         int scaleaspectlock;
00047         
00048 }
00049         vgraph;
00050         
00051         
00052 vgraph *vgraph_new();
00053 vgraph *vgraph_hold(                                    vgraph *self);
00054 void    vgraph_release(                                 vgraph *self);
00055 //void  vgraph_free(vgraph *self);
00056         
00057 int             vgraph_settarget(                       vgraph *self, liqimage *target );
00058 int             vgraph_setwindow(                       vgraph *self, liqcell *window);// int x,int y,    int w,int h );
00059 void    vgraph_convert_target2window(   vgraph *self, int tx,int ty,  int *wx, int *wy);
00060 void    vgraph_convert_window2target(   vgraph *self, int wx,int wy,  int *tx, int *ty);
00061 void    vgraph_setcliprect(                     vgraph *self, liqcliprect *cliprect );
00062 liqcliprect *vgraph_getcliprect(                vgraph *self);
00063 
00064 
00065 
00066 int vgraph_setscaleaspectlock(vgraph *self,int newscaleaspectlock);
00067 int vgraph_getscaleaspectlock(vgraph *self);
00068 
00069 
00070 int             vgraph_setbackcolor(                    vgraph *self, vcolor backcolor );
00071 int             vgraph_setpencolor(                     vgraph *self, vcolor pencolor );
00072 int             vgraph_setpenthick(                     vgraph *self, int penthick );
00073 int             vgraph_setfont(                         vgraph *self, liqfont *font);                   //  char *fontname, int fontsize, int fontattributes
00074 int             vgraph_drawclear(                       vgraph *self                                  );
00075 int             vgraph_drawpoint(                       vgraph *self, int x, int y                    );
00076 int             vgraph_drawline(                        vgraph *self, int x, int y, int ex,int ey     );
00077 int             vgraph_drawbox(                         vgraph *self, int x, int y, int w,int h       );
00078 int             vgraph_drawrect(                        vgraph *self, int x, int y, int w,int h       );
00079 int             vgraph_drawcircle(                      vgraph *self, int x, int y, int radius        );
00080 int             vgraph_drawellipse(                     vgraph *self, int x, int y, int rx,int ry     );
00081 int             vgraph_drawtext(                        vgraph *self, int x, int y, char *text        );
00082 int             vgraph_drawsketch(                      vgraph *self, int x, int y, int w,int h , liqsketch *sketch      );
00083 int             vgraph_drawimage(                       vgraph *self, int x, int y, int w,int h , liqimage  *image      );
00084 int             vgraph_drawcell(                        vgraph *self, int x, int y, int w,int h , liqcell   *cell      );
00085 
00086 #endif

Generated on Sat May 23 23:03:14 2009 for libliqbase by  doxygen 1.5.1