include/liqcliprect.h

00001 /* liqbase
00002  * Copyright (C) 2008 Gary Birkett
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License version 2
00006  * as published by the Free Software Foundation.
00007  *
00008  * This program is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  * GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program; if not, write to the Free Software
00015  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00016  */
00017 
00018 /*
00019  *
00020  * Header for the cliprect library.  this is the prefered way to interact with graphics.
00021  *
00022  */
00023 
00024 
00025 
00026 #ifndef LIQCLIPRECT_H
00027 #define LIQCLIPRECT_H
00028 
00029 
00030 #include "liqfont.h"
00031 #include "liqsketch.h"
00032 #include "liqimage.h"
00033 
00034 typedef struct liqcliprect
00035 {
00036         int usagecount;
00037         int sx;
00038         int sy;
00039         int ex;
00040         int ey;
00041         liqimage *surface;              // thinking about this one... it may make encapsutation easier
00042 } liqcliprect;
00043 
00044 
00045 
00046 //##################################################################
00047 //##################################################################
00048 //##################################################################
00049 
00050 liqcliprect *   liqcliprect_newfromimage(               liqimage *surface);
00051 
00052 //##################################################################
00053 //##################################################################
00054 //##################################################################
00055 
00056 liqcliprect *   liqcliprect_new();
00057 liqcliprect *   liqcliprect_hold(liqcliprect *self);
00058 void                    liqcliprect_release(liqcliprect *self);
00059 void                    liqcliprect_free(liqcliprect *self);
00060 
00061 int     liqcliprect_getx(liqcliprect *self);
00062 int     liqcliprect_gety(liqcliprect *self);
00063 int     liqcliprect_getw(liqcliprect *self);
00064 int     liqcliprect_geth(liqcliprect *self);
00065 
00066 //liqcliprect*liqcliprect_create();
00067 //void          liqcliprect_free(                                       liqcliprect *self);
00068 
00069 //inline void liqcliprect_initfromimage(                liqcliprect *self,liqimage *surface);
00070 
00071 
00072 inline void liqcliprect_shrink(                                 liqcliprect *self,int sx,int sy,int ex,int ey);
00073 inline void liqcliprect_copy(                                   liqcliprect *self,liqcliprect *other);
00074 
00075 inline int  liqcliprect_isvalid(                                liqcliprect *self);
00076 
00077 /*
00078 inline int liqcliprect_rectcheckinside(struct liqcliprect *self,int sx,int sy,int ex,int ey);
00079 inline int liqcliprect_pointcheckinside(struct liqcliprect *self,int x,int y);
00080  */
00081 void            liqcliprect_print(                                      liqcliprect *self,char *prefix);
00082 
00083 //##################################################################
00084 //################################################################## drawing functions
00085 //##################################################################
00086 
00087 inline void liqcliprect_drawclear(                              liqcliprect *self,unsigned char grey,unsigned char u,unsigned char v);
00088 void            liqcliprect_drawpsetcolor(                      liqcliprect *self,int x, int y, unsigned char grey,unsigned char u,unsigned char v);
00089 inline void liqcliprect_drawpgetcolor(          liqcliprect *self,int x1, int y1, unsigned char *grey,unsigned char *u,unsigned char *v);
00090 
00091 //##################################################################
00092 //################################################################## lines and boxes
00093 //##################################################################
00094 
00095 void            liqcliprect_drawlinerowcolor(           liqcliprect *self,int x1, int y1, int x2, int y2, unsigned char grey,unsigned char u,unsigned char v);
00096 void            liqcliprect_drawlinecolcolor(           liqcliprect *self,int x1, int y1,int x2, int y2, unsigned char grey,unsigned char u,unsigned char v);
00097 void            liqcliprect_drawlinecolor(                      liqcliprect *self,int x1, int y1, int x2, int y2, unsigned char grey,unsigned char u,unsigned char v);
00098 void            liqcliprect_drawboxlinecolor(           liqcliprect *self,int x,int y,int w,int h,unsigned char grey,unsigned char u,unsigned char v);
00099 void            liqcliprect_drawboxfillcolor(           liqcliprect *self,int x,int y,int w,int h,unsigned char grey,unsigned char u,unsigned char v);
00100 
00101 void            liqcliprect_drawcolorcube(liqcliprect *self,int x,int y,int w,int h,unsigned char grey);
00102 
00103 
00104 //##################################################################
00105 //################################################################## quick font tools
00106 //##################################################################
00107 
00108 inline void liqcliprect_drawglyph_grey(                 liqcliprect *self,liqfont *font,int x,int y,unsigned char glyph);
00109 int             liqcliprect_drawtext(                   liqcliprect *self,liqfont *font,int xs,int ys,char *data);
00110 int             liqcliprect_drawtextn(                          liqcliprect *self,liqfont *font,int xs,int ys,char *data,int datalen);
00111 void            liqcliprect_drawtextcentredon(          liqcliprect *self,liqfont *font,int cx,int cy,char *text);
00112 void            liqcliprect_drawtextcentredonlimit(liqcliprect *self,liqfont *font,int cx,int cy,char *text,int availablewidth);
00113 void            liqcliprect_drawtextinside(                     liqcliprect *self,liqfont *font,int x,int y,int w,int h,char *text,int alignx);
00114 
00115 
00116 //##################################################################
00117 //################################################################## slower font tools
00118 //##################################################################
00119 
00120 
00121 inline void liqcliprect_drawglyph_color(liqcliprect *self,liqfont *font,int x,int y,unsigned char glyph,unsigned char grey,unsigned char u,unsigned char v);
00122 int             liqcliprect_drawtext_color(liqcliprect *self,liqfont *font,int xs,int ys,char *data,unsigned char grey,unsigned char u,unsigned char v);
00123 int             liqcliprect_drawtextn_color(liqcliprect *self,liqfont *font,int xs,int ys,char *data,int datalen,unsigned char grey,unsigned char u,unsigned char v);
00124 void            liqcliprect_drawtextcentredon_color(liqcliprect *self,liqfont *font,int cx,int cy,char *text,unsigned char grey,unsigned char u,unsigned char v);
00125 void            liqcliprect_drawtextcentredonlimit_color(liqcliprect *self,liqfont *font,int cx,int cy,char *text,int availablewidth,unsigned char grey,unsigned char u,unsigned char v);
00126 void            liqcliprect_drawtextinside_color(liqcliprect *self,liqfont *font,int x,int y,int w,int h,char *text,int alignx,unsigned char grey,unsigned char u,unsigned char v);
00127 
00128 
00129 //##################################################################
00130 //################################################################## page
00131 //##################################################################
00132 
00133 
00134 void            liqcliprect_drawsketch(                         liqcliprect *self,liqsketch *page,int l,int t,int w,int h,int drawmode);        // 0=preview, 1=latest point only, 2=fully detailed
00135 
00136 
00137 //##################################################################
00138 //################################################################## images
00139 //##################################################################
00140 
00141 
00142 inline void liqcliprect_drawimagecolor(                 liqcliprect *self,liqimage *image,int x,int y,int w,int h, int aspectlock);
00143 inline void liqcliprect_drawimageblendcolor(    liqcliprect *self,liqimage *image,int x,int y,int w,int h,char blend,int aspectlock);
00144 
00145 #endif

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