Main Page   Modules   Alphabetical List   Compound List   File List   Compound Members   File Members  

/home/micah/picogui/pg1/client/c/include/picogui/pgfx.h

Go to the documentation of this file.
00001 /* $Id: pgfx.h 3806 2003-05-04 06:11:21Z micah $
00002  *
00003  * picogui/pgfx.h - The PicoGUI abstract graphics interface
00004  * 
00005  * This is a thin wrapper providing a set of primitives that can render to
00006  * a canvas (persistant or immediate mode) and other fast graphics interfaces
00007  *
00008  * PicoGUI small and efficient client/server GUI
00009  * Copyright (C) 2000-2003 Micah Dowty <micahjd@users.sourceforge.net>
00010  *
00011  * This library is free software; you can redistribute it and/or
00012  * modify it under the terms of the GNU Lesser General Public
00013  * License as published by the Free Software Foundation; either
00014  * version 2.1 of the License, or (at your option) any later version.
00015  * 
00016  * This library is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  * Lesser General Public License for more details.
00020  * 
00021  * You should have received a copy of the GNU Lesser General Public
00022  * License along with this library; if not, write to the Free Software
00023  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
00024  * 
00025  * Contributors: 
00026  * 
00027  * 
00028  * 
00029  */
00030 
00042 #ifndef _H_PG_PGFX
00043 #define _H_PG_PGFX
00044 
00064 /************ Data structures */
00065 
00077 
00078 typedef int pgu;
00079 
00092 typedef int pgprim;
00093 
00094 
00108 typedef struct pgfx_context {
00109    struct pgfx_lib *lib;   
00110    pghandle device;        
00111    pgcolor color;          
00112    pgu cx;                 
00113    pgu cy;                 
00114    unsigned long flags;    
00115    int sequence;           
00116 } *pgcontext;
00117 
00118 
00126 struct pgfx_lib {
00128    pgprim (*pixel)     (pgcontext c, pgu x,  pgu y);
00130    pgprim (*line)      (pgcontext c, pgu x1, pgu y1, pgu x2, pgu y2);
00132    pgprim (*rect)      (pgcontext c, pgu x,  pgu y,  pgu w,  pgu h);
00134    pgprim (*frame)     (pgcontext c, pgu x,  pgu y,  pgu w,  pgu h);
00136    pgprim (*slab)      (pgcontext c, pgu x,  pgu y,  pgu w);
00138    pgprim (*bar)       (pgcontext c, pgu x,  pgu y,  pgu h);
00140    pgprim (*ellipse)   (pgcontext c, pgu x,  pgu y,  pgu w,  pgu h); 
00142    pgprim (*fellipse)  (pgcontext c, pgu x,  pgu y,  pgu w,  pgu h);  
00144    pgprim (*fpolygon)  (pgcontext c, pghandle array);   
00146    pgprim (*text)      (pgcontext c, pgu x,  pgu y,  pghandle string);
00148    pgprim (*bitmap)    (pgcontext c, pgu x,  pgu y,  pgu w,  pgu h,
00149                         pghandle bitmap);
00151    pgprim (*rotatebitmap) (pgcontext c, pgu x,  pgu y,  pgu w,  pgu h,
00152                            pghandle bitmap);
00154    pgprim (*tilebitmap)(pgcontext c, pgu x,  pgu y,  pgu w,  pgu h,
00155                         pghandle bitmap);
00157    pgprim (*gradient)  (pgcontext c, pgu x,  pgu y,  pgu w,  pgu h,
00158                         pgu angle, pgcolor c1, pgcolor c2);
00160    pgprim (*blur)(pgcontext c, pgu x,pgu y,pgu w,pgu h,pgu radius);
00161 
00162    /* Nonvisual primitives */
00163    
00165    pgprim (*setcolor)(pgcontext c, pgcolor color);
00167    pgprim (*setfont)(pgcontext c, pghandle font);
00169    pgprim (*setlgop)(pgcontext c, short lgop);
00171    pgprim (*setangle)(pgcontext c, pgu angle);              /* For text */
00173    pgprim (*setsrc)(pgcontext c, pgu x,pgu y,pgu w,pgu h);  /* For bitmaps */
00175    pgprim (*setmapping)(pgcontext c, pgu x,pgu y,pgu w,pgu h,short type);
00177    pgprim (*setclip)(pgcontext c, pgu x,pgu y,pgu w,pgu h);
00178    
00180    void (*update)(pgcontext c);
00181    
00182    /* FIXME: add functions to manipulate grops after they're created 
00183     * also update documentation when this is done. */
00184 };
00185 
00187 
00188 /************ Primitives */
00189 
00199 
00200 inline pgprim pgPixel(pgcontext c,pgu x,pgu y);
00202 inline pgprim pgLine(pgcontext c,pgu x1,pgu y1,pgu x2,pgu y2);
00204 inline pgprim pgRect(pgcontext c,pgu x,pgu y,pgu w,pgu h);
00206 inline pgprim pgFrame(pgcontext c,pgu x,pgu y,pgu w,pgu h);
00208 inline pgprim pgSlab(pgcontext c,pgu x,pgu y,pgu w);
00210 inline pgprim pgBar(pgcontext c,pgu x,pgu y,pgu h);
00212 inline pgprim pgEllipse(pgcontext c,pgu x,pgu y,pgu w,pgu h);
00214 inline pgprim pgFEllipse(pgcontext c,pgu x,pgu y,pgu w,pgu h);
00216 inline pgprim pgFPolygon(pgcontext c, pghandle array); 
00218 inline pgprim pgBlur(pgcontext c, pgu x, pgu y, pgu w, pgu h, pgu radius); 
00232 inline pgprim pgText(pgcontext c,pgu x,pgu y,pghandle string);
00243 inline pgprim pgBitmap(pgcontext c,pgu x,pgu y,pgu w,pgu h,pghandle bitmap);
00259 inline pgprim pgRotateBitmap(pgcontext c,pgu x,pgu y,pgu w,pgu h,pghandle bitmap);
00270 inline pgprim pgTileBitmap(pgcontext c,pgu x,pgu y,pgu w,pgu h,pghandle bitmap);
00279 inline pgprim pgGradient(pgcontext c,pgu x,pgu y,pgu w,pgu h,
00280                          pgu angle,pgcolor c1,pgcolor c2);
00282 inline pgprim pgSetColor(pgcontext c,pgcolor color);
00284 inline pgprim pgSetFont(pgcontext c,pghandle font);
00306 inline pgprim pgSetLgop(pgcontext c,short lgop);
00316 inline pgprim pgSetAngle(pgcontext c,pgu angle);
00325 inline pgprim pgSetSrc(pgcontext c,pgu x,pgu y,pgu w,pgu h);
00341 inline pgprim pgSetMapping(pgcontext c,pgu x,pgu y,pgu w,pgu h,short type);
00342 
00349 inline pgprim pgSetClip(pgcontext c,pgu x,pgu y,pgu w,pgu h);
00350 
00359 inline void pgContextUpdate(pgcontext c);
00360 
00362 void    pgMoveTo(pgcontext c, pgu x, pgu y);
00364 pgprim  pgLineTo(pgcontext c, pgu x, pgu y);
00365 
00367 
00368 /************ Constants */
00369 
00395 #define PGFX_IMMEDIATE    1
00396 
00405 #define PGFX_PERSISTENT   2
00406 
00407 /************ Context management functions */
00408 
00417 pgcontext pgNewCanvasContext(pghandle canvas,short mode);
00418 
00429 pgcontext pgNewBitmapContext(pghandle bitmap);
00430 
00432 void pgDeleteContext(pgcontext c);
00433 
00436 
00437 #endif /* _H_PG_PGFX */
00438 
00439 /* The End */

Generated on Fri May 23 03:39:44 2003 for PicoGUI by doxygen1.3-rc3