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

fl_draw.h

00001 /*
00002  * $Id: fl_draw.h,v 1.8 2003/03/06 17:28:11 laza2000 Exp $
00003  *
00004  * Extended Fast Light Toolkit (EFLTK)
00005  * Copyright (C) 2002-2003 by EDE-Team
00006  * WWW: http://www.sourceforge.net/projects/ede
00007  *
00008  * Fast Light Toolkit (FLTK)
00009  * Copyright (C) 1998-2003 by Bill Spitzak and others.
00010  * WWW: http://www.fltk.org
00011  *
00012  * This library is distributed under the GNU LIBRARY GENERAL PUBLIC LICENSE
00013  * version 2. See COPYING for details.
00014  *
00015  * Author : Mikko Lahteenmaki
00016  * Email  : mikko@fltk.net
00017  *
00018  * Please report all bugs and problems to "efltk-bugs@fltk.net"
00019  *
00020  */
00021 
00022 #ifndef _FL_DRAW_H_
00023 #define _FL_DRAW_H_
00024 
00025 #include "Fl_Flags.h" // for alignment values
00026 #include "Fl_Color.h"
00027 #include "Fl_Font.h"
00028 #include "Fl_Device.h"
00029 
00030 inline void fl_load_identity() { fl_current_dev->load_identity(); }
00031 
00032 //fl_vertex.cpp current transformation:
00033 inline void fl_push_matrix() { fl_current_dev->push_matrix(); }
00034 inline void fl_pop_matrix()  { fl_current_dev->pop_matrix();  }
00035 inline void fl_scale(float x, float y) { fl_current_dev->scale(x, y); }
00036 inline void fl_scale(float x) { fl_current_dev->scale(x); }
00037 inline void fl_translate(float x, float y) { fl_current_dev->translate(x,y); }
00038 inline void fl_translate(int x, int y) { fl_current_dev->translate(x,y); }
00039 inline void fl_rotate(float d) { fl_current_dev->rotate(d); }
00040 inline void fl_mult_matrix(float a, float b, float c, float d, float e, float f) { fl_current_dev->mult_matrix(a,b,c,d,e,f); }
00041 
00042 // get and use transformed positions:
00043 inline void fl_transform(float& x, float& y) { fl_current_dev->transform(x,y); }
00044 inline void fl_transform(int& x, int& y) { fl_current_dev->transform(x,y); }
00045 inline void fl_transform_distance(float& x, float& y) { fl_current_dev->transform_distance(x,y); }
00046 
00047 // fl_clip.cpp: 
00048 inline void fl_push_clip(int x, int y, int w, int h)   { fl_current_dev->push_clip(x,y,w,h); }
00049 inline void fl_clip_out(int x, int y, int w, int h)    { fl_current_dev->clip_out(x,y,w,h); }
00050 inline void fl_push_no_clip()                  { fl_current_dev->push_no_clip(); }
00051 inline void fl_pop_clip()                  { fl_current_dev->pop_clip(); }
00052 inline int  fl_not_clipped(int x, int y, int w, int h) { return fl_current_dev->not_clipped(x,y,w,h); }
00053 inline int  fl_clip_box(int _x, int _y, int _w, int _h,
00054                         int& x, int& y, int& w, int& h) { return fl_current_dev->clip_box(_x, _y, _w, _h, x, y, w, h); }
00055 
00056 // fl_color.cpp Colors: 
00057 extern FL_API   Fl_Color fl_color_;
00058 
00059 inline void     fl_color(Fl_Color c)               {fl_current_dev->color(c);}; // select indexed color
00060 inline void     fl_color(uchar r, uchar g, uchar b)        {fl_current_dev->color(r,g,b);}; // select actual color
00061 inline Fl_Color fl_color()                     {return fl_current_dev->color();}
00062 
00063 //  line type:
00064 inline void fl_line_style(int style, int width=0, char* dashes=0)
00065          {fl_current_dev->line_style(style,width,dashes);}
00066 enum {
00067   FL_SOLID  = 0,
00068   FL_DASH   = 1,
00069   FL_DOT    = 2,
00070   FL_DASHDOT    = 3,
00071   FL_DASHDOTDOT = 4,
00072 
00073   FL_CAP_FLAT   = 0x100,
00074   FL_CAP_ROUND  = 0x200,
00075   FL_CAP_SQUARE = 0x300,
00076 
00077   FL_JOIN_MITER = 0x1000,
00078   FL_JOIN_ROUND = 0x2000,
00079   FL_JOIN_BEVEL = 0x3000
00080 };
00081 
00082 //Build the path:
00083 //fl_vertex.cpp
00084 inline void fl_newpath() { fl_current_dev->newpath(); }
00085 inline void fl_vertex(float x, float y) { fl_current_dev->vertex(x, y); }
00086 inline void fl_vertex(int x, int y) { fl_current_dev->vertex(x, y); }
00087 inline void fl_vertices(int n, const float v[][2]) { fl_current_dev->vertices(n, v); }
00088 inline void fl_vertices(int n, const int v[][2])   { fl_current_dev->vertices(n, v); }
00089 inline void fl_transformed_vertices(int n, const float v[][2]) { fl_current_dev->transformed_vertices(n, v); }
00090 inline void fl_closepath() { fl_current_dev->closepath(); }
00091 
00092 //fl_curve.cpp
00093 inline void fl_curve(float a,float b,float c,float d,float e,float f,float g,float h) { fl_current_dev->curve(a,b,c,d,e,f,g,h); }
00094 //fl_arc.cpp
00095 inline void fl_arc(float x,float y,float w,float h, float a1, float a2) { fl_current_dev->arc(x, y, w,h, a1,a2); }
00096 //fl_vertex.cpp
00097 inline void fl_circle(float x, float y, float r) { fl_current_dev->circle(x, y, r); }
00098 inline void fl_ellipse(float x, float y, float w, float h) { fl_current_dev->ellipse(x, y, w, h); }
00099 
00100 // fl_vertex.cpp, draw the path:
00101 inline void fl_points() { fl_current_dev->points(); }
00102 inline void fl_stroke() { fl_current_dev->stroke(); }
00103 inline void fl_fill()   { fl_current_dev->fill(); }
00104 inline void fl_fill_stroke(Fl_Color c) { fl_current_dev->fill_stroke(c); }
00105 
00106 //fl_rect.cpp drawing that bypasses the path mechanism:
00107 inline void fl_rect(int x, int y, int w, int h)     { fl_current_dev->rect(x,y,w,h); }
00108 inline void fl_rectf(int x, int y, int w, int h)    { fl_current_dev->rectf(x,y,w,h); }
00109 inline void fl_point(int x, int y)          { fl_current_dev->point(x,y); }
00110 inline void fl_line(int x1, int y1, int x2, int y2) { fl_current_dev->line(x1, y1, x2, y2); }
00111 
00112 // fl_arci.cpp
00113 enum { FL_PIE, FL_CHORD, FL_ARC };
00114 inline void fl_pie(int x,int y,int w,int h,float a1,float a2,int what=FL_PIE) { fl_current_dev->pie(x,y,w,h,a1,a2,what); }
00115 
00116 // current font+size:
00117 inline void fl_font(Fl_Font face, float size)  { fl_current_dev->font(face,size); }
00118 inline void fl_font(const char* s, float size) { fl_current_dev->font(s,size); }
00119 inline void fl_font(const char* s, int attributes, float size) { fl_current_dev->font(s, attributes, size); }
00120 
00121 inline const char* fl_encoding() { return fl_current_dev->encoding(); }
00122 inline void        fl_encoding(const char* s) { fl_current_dev->encoding(s); }
00123 
00124 // information you can get about the current font+size+encoding:
00125 extern FL_API Fl_Font   fl_font_;
00126 extern FL_API float fl_size_; // should be 2x2 transformation matrix
00127 
00128 inline Fl_Font      fl_font() { return fl_current_dev->font(); }
00129 inline float        fl_size() { return fl_current_dev->size(); }
00130 inline const char*  fl_fontname(Fl_Font f, int *i = 0) { return fl_current_dev->fontname(f, i); }
00131 
00132 
00133 // measure things in the current font:
00134 inline float fl_width(unsigned int ucs)     { return fl_current_dev->width(ucs); } //Unicode char
00135 inline float fl_width(const char* s)        { return fl_current_dev->width(s);   }
00136 inline float fl_width(const Fl_String& s)   { return fl_current_dev->width(s);   }
00137 inline float fl_width(const char* s, int n)     { return fl_current_dev->width(s,n); }
00138 
00139 inline float fl_height()            { return fl_current_dev->height();  }
00140 inline float fl_descent()           { return fl_current_dev->descent(); }
00141 
00142 // draw using current font:
00143 inline void fl_transformed_draw(const char* s, int n, float x, float y) { fl_current_dev->transformed_draw(s,n,x,y); }
00144 inline void fl_rtl_draw(const char *s, int n, float x, float y)     { fl_current_dev->rtl_draw(s,n,x,y); }
00145 
00146 inline void fl_draw(const char* s, float x, float y)        { fl_current_dev->draw(s,x,y);   }
00147 inline void fl_draw(const Fl_String & s, float x, float y)  { fl_current_dev->draw(s,x,y);   }
00148 inline void fl_draw(const char* s, int n, float x, float y)     { fl_current_dev->draw(s,n,x,y); }
00149 
00150 // the "fancy" text formatter:
00151 FL_API void fl_measure(const char*d, int& w, int& h, Fl_Flags f); 
00152 FL_API void fl_draw(const char*d, int x,int y,int w,int h, Fl_Flags f);
00153 FL_API void fl_measure(const Fl_String &s, int& w, int& h, Fl_Flags f);
00154 FL_API void fl_draw(const Fl_String &s, int x,int y,int w,int h, Fl_Flags f);
00155 
00156 extern FL_API const int* fl_column_widths_;
00157 inline const int*    fl_column_widths() {return fl_column_widths_;}
00158 inline void          fl_column_widths(const int* i) {fl_column_widths_ = i;}
00159 
00160 // images:
00161 inline void fl_draw_image(const uchar* im, int x,int y,int w,int h, int delta=3, int ldelta=0){fl_current_dev->draw_image(im,x,y,w,h,delta,ldelta);};
00162 inline void fl_draw_image_mono(const uchar* im, int x,int y,int w,int h, int delta=1, int ld=0){fl_current_dev->draw_image_mono(im,x,y,w,h,delta,ld);};
00163 typedef void (*Fl_Draw_Image_Cb)(void*,int,int,int,uchar*);
00164 inline void fl_draw_image(Fl_Draw_Image_Cb cb, void* im, int x,int y,int w,int h, int delta=3){fl_current_dev->draw_image(cb, im, x,y,w,h,delta);};
00165 inline void fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* im, int x,int y,int w,int h, int delta=1){fl_current_dev->draw_image(cb, im, x,y,w,h,delta);};
00166 
00167 inline void fl_rectf(int x, int y, int w, int h, Fl_Color c){fl_current_dev->rectf(x,y,w,h,c);};
00168 inline void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) { fl_rectf(x,y,w,h,fl_rgb(r,g,b)); }
00169 
00170 // XPM interpreter (probably should be part of Fl_Pixmap):
00171 FL_API int  fl_draw_pixmap(const char*const* data, int x,int y,Fl_Color c=FL_GRAY);
00172 FL_API int  fl_measure_pixmap(const char*const* data, int &w, int &h);
00173 FL_API void fl_set_mask_bitmap(uchar **ppBitmap);
00174 
00175 
00176 // depreciated:
00177 extern FL_API void fl_scroll(int X, int Y, int W, int H, int dx, int dy,
00178                  void (*draw_area)(void*, int,int,int,int), void*);
00179 FL_API void fl_overlay_rect(int,int,int,int);
00180 FL_API void fl_overlay_clear();
00181 FL_API void fl_cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE);
00182 
00183 // XForms symbols (should not be here...)
00184 FL_API int fl_draw_symbol(const char* label,int x,int y,int w,int h, Fl_Color);
00185 FL_API int fl_add_symbol(const char* name, void (*drawit)(Fl_Color), int scalable);
00186 
00187 #endif
00188 

Generated on Thu Jul 31 15:33:43 2003 for eFLTK by doxygen1.2.15