diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/fl_arc.cxx | 8 | ||||
| -rw-r--r-- | src/fl_arci.cxx | 34 | ||||
| -rw-r--r-- | src/fl_color.cxx | 59 | ||||
| -rw-r--r-- | src/fl_curve.cxx | 8 | ||||
| -rw-r--r-- | src/fl_line_style.cxx | 27 | ||||
| -rw-r--r-- | src/fl_rect.cxx | 102 | ||||
| -rw-r--r-- | src/fl_vertex.cxx | 62 |
7 files changed, 20 insertions, 280 deletions
diff --git a/src/fl_arc.cxx b/src/fl_arc.cxx index 6b0cb13ea..0ee4269a4 100644 --- a/src/fl_arc.cxx +++ b/src/fl_arc.cxx @@ -43,14 +43,6 @@ static double _fl_hypot(double x, double y) { return sqrt(x*x + y*y); } -/** - Add a series of points to the current path on the arc of a circle; you - can get elliptical paths by using scale and rotate before calling fl_arc(). - \param[in] x,y,r center and radius of circular arc - \param[in] start,end angles of start and end of arc measured in degrees - counter-clockwise from 3 o'clock. If \p end is less than \p start - then it draws the arc in a clockwise direction. -*/ void Fl_Device::arc(double x, double y, double r, double start, double end) { // draw start point accurately: diff --git a/src/fl_arci.cxx b/src/fl_arci.cxx index 81414599c..c41ce1d20 100644 --- a/src/fl_arci.cxx +++ b/src/fl_arci.cxx @@ -47,28 +47,6 @@ #endif #include <config.h> -/** - Draw ellipse sections using integer coordinates. - - These functions match the rather limited circle drawing code provided by X - and WIN32. The advantage over using fl_arc with floating point coordinates - is that they are faster because they often use the hardware, and they draw - much nicer small circles, since the small sizes are often hard-coded bitmaps. - - If a complete circle is drawn it will fit inside the passed bounding box. - The two angles are measured in degrees counterclockwise from 3 o'clock and - are the starting and ending angle of the arc, \p a2 must be greater or equal - to \p a1. - - fl_arc() draws a series of lines to approximate the arc. Notice that the - integer version of fl_arc() has a different number of arguments than the - double version fl_arc(double x, double y, double r, double start, double a) - - \param[in] x,y,w,h bounding box of complete circle - \param[in] a1,a2 start and end angles of arc measured in degrees - counter-clockwise from 3 o'clock. \p a2 must be greater - than or equal to \p a1. -*/ void Fl_Device::arc(int x,int y,int w,int h,double a1,double a2) { if (w <= 0 || h <= 0) return; @@ -108,18 +86,6 @@ void Fl_Device::arc(int x,int y,int w,int h,double a1,double a2) { #endif } -/** - Draw filled ellipse sections using integer coordinates. - - Like fl_arc(), but fl_pie() draws a filled-in pie slice. - This slice may extend outside the line drawn by fl_arc(); - to avoid this use w - 1 and h - 1. - - \param[in] x,y,w,h bounding box of complete circle - \param[in] a1,a2 start and end angles of arc measured in degrees - counter-clockwise from 3 o'clock. \p a2 must be greater - than or equal to \p a1. -*/ void Fl_Device::pie(int x,int y,int w,int h,double a1,double a2) { if (w <= 0 || h <= 0) return; diff --git a/src/fl_color.cxx b/src/fl_color.cxx index 33f92478d..735757427 100644 --- a/src/fl_color.cxx +++ b/src/fl_color.cxx @@ -124,6 +124,26 @@ Fl_XColor fl_xmap[1][256]; # define fl_overlay 0 # endif +/** Current color for drawing operations */ +Fl_Color fl_color_; + +void Fl_Device::color(Fl_Color i) { + if (i & 0xffffff00) { + unsigned rgb = (unsigned)i; + fl_color((uchar)(rgb >> 24), (uchar)(rgb >> 16), (uchar)(rgb >> 8)); + } else { + fl_color_ = i; + if(!fl_gc) return; // don't get a default gc if current window is not yet created/valid + XSetForeground(fl_display, fl_gc, fl_xpixel(i)); + } +} + +void Fl_Device::color(uchar r,uchar g,uchar b) { + fl_color_ = fl_rgb_color(r, g, b); + if(!fl_gc) return; // don't get a default gc if current window is not yet created/valid + XSetForeground(fl_display, fl_gc, fl_xpixel(r,g,b)); +} + /** \addtogroup fl_attributes @{ */ //////////////////////////////////////////////////////////////// @@ -161,22 +181,6 @@ ulong fl_xpixel(uchar r,uchar g,uchar b) { ) >> fl_extrashift; } -/** - Set the color for all subsequent drawing operations. - The closest possible match to the RGB color is used. - The RGB color is used directly on TrueColor displays. - For colormap visuals the nearest index in the gray - ramp or color cube is used. - If no valid graphical context (fl_gc) is available, - the foreground is not set for the current window. - \param[in] r,g,b color components -*/ -void Fl_Device::color(uchar r,uchar g,uchar b) { - fl_color_ = fl_rgb_color(r, g, b); - if(!fl_gc) return; // don't get a default gc if current window is not yet created/valid - XSetForeground(fl_display, fl_gc, fl_xpixel(r,g,b)); -} - //////////////////////////////////////////////////////////////// // Get a color out of the fltk colormap. Again for truecolor // visuals this is easy. For colormap this actually tries to allocate @@ -316,29 +320,6 @@ ulong fl_xpixel(Fl_Color i) { # endif } -/** Current color for drawing operations */ -Fl_Color fl_color_; - -/** - Sets the color for all subsequent drawing operations. - For colormapped displays, a color cell will be allocated out of - \p fl_colormap the first time you use a color. If the colormap fills up - then a least-squares algorithm is used to find the closest color. - If no valid graphical context (fl_gc) is available, - the foreground is not set for the current window. - \param[in] i color -*/ -void Fl_Device::color(Fl_Color i) { - if (i & 0xffffff00) { - unsigned rgb = (unsigned)i; - fl_color((uchar)(rgb >> 24), (uchar)(rgb >> 16), (uchar)(rgb >> 8)); - } else { - fl_color_ = i; - if(!fl_gc) return; // don't get a default gc if current window is not yet created/valid - XSetForeground(fl_display, fl_gc, fl_xpixel(i)); - } -} - /** Free color \p i if used, and clear mapping table entry. \param[in] i color index diff --git a/src/fl_curve.cxx b/src/fl_curve.cxx index c6663a739..d9406787e 100644 --- a/src/fl_curve.cxx +++ b/src/fl_curve.cxx @@ -38,14 +38,6 @@ #include <FL/fl_draw.H> #include <math.h> -/** - Add a series of points on a Bezier curve to the path. - The curve ends (and two of the points) are at X0,Y0 and X3,Y3. - \param[in] X0,Y0 curve start point - \param[in] X1,Y1 curve control point - \param[in] X2,Y2 curve control point - \param[in] X3,Y3 curve end point -*/ void Fl_Device::curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, diff --git a/src/fl_line_style.cxx b/src/fl_line_style.cxx index b73074323..e93f159ec 100644 --- a/src/fl_line_style.cxx +++ b/src/fl_line_style.cxx @@ -50,33 +50,6 @@ void fl_quartz_restore_line_style_() { } #endif -/** - Sets how to draw lines (the "pen"). - If you change this it is your responsibility to set it back to the default - using \c fl_line_style(0). - - \param[in] style A bitmask which is a bitwise-OR of a line style, a cap - style, and a join style. If you don't specify a dash type you - will get a solid line. If you don't specify a cap or join type - you will get a system-defined default of whatever value is - fastest. - \param[in] width The thickness of the lines in pixels. Zero results in the - system defined default, which on both X and Windows is somewhat - different and nicer than 1. - \param[in] dashes A pointer to an array of dash lengths, measured in pixels. - The first location is how long to draw a solid portion, the next - is how long to draw the gap, then the solid, etc. It is terminated - with a zero-length entry. A \c NULL pointer or a zero-length - array results in a solid line. Odd array sizes are not supported - and result in undefined behavior. - - \note Because of how line styles are implemented on Win32 systems, - you \e must set the line style \e after setting the drawing - color. If you set the color after the line style you will lose - the line style settings. - \note The \p dashes array does not work under Windows 95, 98 or Me, - since those operating systems do not support complex line styles. -*/ void Fl_Device::line_style(int style, int width, char* dashes) { #if defined(USE_X11) diff --git a/src/fl_rect.cxx b/src/fl_rect.cxx index 4585fe334..9ec3fcc4f 100644 --- a/src/fl_rect.cxx +++ b/src/fl_rect.cxx @@ -48,9 +48,6 @@ extern float fl_quartz_line_width_; #endif #endif -/** - Draws a 1-pixel border \e inside the given bounding box -*/ void Fl_Device::rect(int x, int y, int w, int h) { if (w<=0 || h<=0) return; @@ -80,9 +77,6 @@ void Fl_Device::rect(int x, int y, int w, int h) { #endif } -/** - Colors a rectangle that exactly fills the given bounding box -*/ void Fl_Device::rectf(int x, int y, int w, int h) { if (w<=0 || h<=0) return; #if defined(USE_X11) @@ -110,9 +104,6 @@ void Fl_Device::rectf(int x, int y, int w, int h) { #endif } -/** - Draws a horizontal line from (x,y) to (x1,y) -*/ void Fl_Device::xyline(int x, int y, int x1) { #if defined(USE_X11) XDrawLine(fl_display, fl_window, fl_gc, x, y, x1, y); @@ -137,9 +128,6 @@ void Fl_Device::xyline(int x, int y, int x1) { #endif } -/** - Draws a horizontal line from (x,y) to (x1,y), then vertical from (x1,y) to (x1,y2) -*/ void Fl_Device::xyline(int x, int y, int x1, int y2) { #if defined (USE_X11) XPoint p[3]; @@ -172,10 +160,6 @@ void Fl_Device::xyline(int x, int y, int x1, int y2) { #endif } -/** - Draws a horizontal line from (x,y) to (x1,y), then a vertical from (x1,y) to (x1,y2) - and then another horizontal from (x1,y2) to (x3,y2) -*/ void Fl_Device::xyline(int x, int y, int x1, int y2, int x3) { #if defined(USE_X11) XPoint p[4]; @@ -211,9 +195,6 @@ void Fl_Device::xyline(int x, int y, int x1, int y2, int x3) { #endif } -/** - Draws a vertical line from (x,y) to (x,y1) -*/ void Fl_Device::yxline(int x, int y, int y1) { #if defined(USE_X11) XDrawLine(fl_display, fl_window, fl_gc, x, y, x, y1); @@ -240,9 +221,6 @@ void Fl_Device::yxline(int x, int y, int y1) { #endif } -/** - Draws a vertical line from (x,y) to (x,y1), then a horizontal from (x,y1) to (x2,y1) -*/ void Fl_Device::yxline(int x, int y, int y1, int x2) { #if defined(USE_X11) XPoint p[3]; @@ -275,10 +253,6 @@ void Fl_Device::yxline(int x, int y, int y1, int x2) { #endif } -/** - Draws a vertical line from (x,y) to (x,y1) then a horizontal from (x,y1) - to (x2,y1), then another vertical from (x2,y1) to (x2,y3) -*/ void Fl_Device::yxline(int x, int y, int y1, int x2, int y3) { #if defined(USE_X11) XPoint p[4]; @@ -314,9 +288,6 @@ void Fl_Device::yxline(int x, int y, int y1, int x2, int y3) { #endif } -/** - Draws a line from (x,y) to (x1,y1) -*/ void Fl_Device::line(int x, int y, int x1, int y1) { #if defined(USE_X11) XDrawLine(fl_display, fl_window, fl_gc, x, y, x1, y1); @@ -345,9 +316,6 @@ void Fl_Device::line(int x, int y, int x1, int y1) { #endif } -/** - Draws a line from (x,y) to (x1,y1) and another from (x1,y1) to (x2,y2) -*/ void Fl_Device::line(int x, int y, int x1, int y1, int x2, int y2) { #if defined(USE_X11) XPoint p[3]; @@ -382,9 +350,6 @@ void Fl_Device::line(int x, int y, int x1, int y1, int x2, int y2) { #endif } -/** - Outlines a 3-sided polygon with lines -*/ void Fl_Device::loop(int x, int y, int x1, int y1, int x2, int y2) { #if defined(USE_X11) XPoint p[4]; @@ -415,9 +380,6 @@ void Fl_Device::loop(int x, int y, int x1, int y1, int x2, int y2) { #endif } -/** - Outlines a 4-sided polygon with lines -*/ void Fl_Device::loop(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) { #if defined(USE_X11) XPoint p[5]; @@ -451,9 +413,6 @@ void Fl_Device::loop(int x, int y, int x1, int y1, int x2, int y2, int x3, int y #endif } -/** - Fills a 3-sided polygon. The polygon must be convex. -*/ void Fl_Device::polygon(int x, int y, int x1, int y1, int x2, int y2) { XPoint p[4]; p[0].x = x; p[0].y = y; @@ -483,9 +442,6 @@ void Fl_Device::polygon(int x, int y, int x1, int y1, int x2, int y2) { #endif } -/** - Fills a 4-sided polygon. The polygon must be convex. -*/ void Fl_Device::polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) { XPoint p[5]; p[0].x = x; p[0].y = y; @@ -517,9 +473,6 @@ void Fl_Device::polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, in #endif } -/** - Draws a single pixel at the given coordinates -*/ void Fl_Device::point(int x, int y) { #if defined(USE_X11) XDrawPoint(fl_display, fl_window, fl_gc, x, y); @@ -564,13 +517,6 @@ Fl_Region XRectangleRegion(int x, int y, int w, int h) { } #endif -#if defined(__APPLE_QUARTZ__) -// warning: the Quartz implementation currently uses Quickdraw calls to achieve -// clipping. A future version should instead use 'CGContectClipToRect' -// and friends. -#endif - -/** Undoes any clobbering of clip done by your program */ void fl_restore_clip() { fl_clip_state_number++; Fl_Region r = rstack[rstackptr]; @@ -624,12 +570,6 @@ void fl_restore_clip() { #endif } -/** - Replaces the top of the clipping stack with a clipping region of any shape. - - Fl_Region is an operating system specific type. - \param[in] r clipping region -*/ void fl_clip_region(Fl_Region r) { Fl_Region oldr = rstack[rstackptr]; if (oldr) XDestroyRegion(oldr); @@ -637,18 +577,10 @@ void fl_clip_region(Fl_Region r) { fl_restore_clip(); } -/** - \returns the current clipping region. -*/ Fl_Region fl_clip_region() { return rstack[rstackptr]; } -/** - Intersects the current clip region with a rectangle and pushes this - new region onto the stack. - \param[in] x,y,w,h position and size -*/ void Fl_Device::push_clip(int x, int y, int w, int h) { Fl_Region r; if (w > 0 && h > 0) { @@ -695,9 +627,6 @@ void Fl_Device::push_clip(int x, int y, int w, int h) { } // make there be no clip (used by fl_begin_offscreen() only!) -/** - Pushes an empty clip region onto the stack so nothing will be clipped. -*/ void Fl_Device::push_no_clip() { if (rstackptr < STACK_MAX) rstack[++rstackptr] = 0; else Fl::warning("fl_push_no_clip: clip stack overflow!\n"); @@ -705,13 +634,6 @@ void Fl_Device::push_no_clip() { } // pop back to previous clip: -/** - Restores the previous clip region. - - You must call fl_pop_clip() once for every time you call fl_push_clip(). - Unpredictable results may occur if the clip stack is not empty when - you return to FLTK. -*/ void Fl_Device::pop_clip() { if (rstackptr > 0) { Fl_Region oldr = rstack[rstackptr--]; @@ -720,16 +642,6 @@ void Fl_Device::pop_clip() { fl_restore_clip(); } -/** - Does the rectangle intersect the current clip region? - \param[in] x,y,w,h position and size of rectangle - \returns non-zero if any of the rectangle intersects the current clip - region. If this returns 0 you don't have to draw the object. - - \note - Under X this returns 2 if the rectangle is partially clipped, - and 1 if it is entirely inside the clip region. -*/ int Fl_Device::not_clipped(int x, int y, int w, int h) { if (x+w <= 0 || y+h <= 0) return 0; Fl_Region r = rstack[rstackptr]; @@ -767,20 +679,6 @@ int Fl_Device::not_clipped(int x, int y, int w, int h) { } // return rectangle surrounding intersection of this rectangle and clip: -/** - Intersects the rectangle with the current clip region and returns the - bounding box of the result. - - Returns non-zero if the resulting rectangle is different to the original. - This can be used to limit the necessary drawing to a rectangle. - \p W and \p H are set to zero if the rectangle is completely outside - the region. - \param[in] x,y,w,h position and size of rectangle - \param[out] X,Y,W,H position and size of resulting bounding box. - \p W and \p H are set to zero if the rectangle is - completely outside the region. - \returns Non-zero if the resulting rectangle is different to the original. -*/ int Fl_Device::clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int& H){ X = x; Y = y; W = w; H = h; Fl_Region r = rstack[rstackptr]; diff --git a/src/fl_vertex.cxx b/src/fl_vertex.cxx index d2823391d..9aafae4de 100644 --- a/src/fl_vertex.cxx +++ b/src/fl_vertex.cxx @@ -145,24 +145,12 @@ static int n; static int what; enum {LINE, LOOP, POLYGON, POINT_}; -/** - Starts drawing a list of points. Points are added to the list with fl_vertex() -*/ void Fl_Device::begin_points() {n = 0; what = POINT_;} -/** - Starts drawing a list of lines. -*/ void Fl_Device::begin_line() {n = 0; what = LINE;} -/** - Starts drawing a closed sequence of lines. -*/ void Fl_Device::begin_loop() {n = 0; what = LOOP;} -/** - Starts drawing a convex filled polygon. -*/ void Fl_Device::begin_polygon() {n = 0; what = POLYGON;} /** @@ -201,10 +189,6 @@ static void fl_transformed_vertex(COORD_T x, COORD_T y) { } } -/** - Adds coordinate pair to the vertex list without further transformations. - \param[in] xf,yf transformed coordinate -*/ void Fl_Device::transformed_vertex(double xf, double yf) { #ifdef __APPLE_QUARTZ__ fl_transformed_vertex(COORD_T(xf), COORD_T(yf)); @@ -213,17 +197,10 @@ void Fl_Device::transformed_vertex(double xf, double yf) { #endif } -/** - Adds a single vertex to the current path. - \param[in] x,y coordinate -*/ void Fl_Device::vertex(double x,double y) { fl_transformed_vertex(x*m.a + y*m.c + m.x, x*m.b + y*m.d + m.y); } -/** - Ends list of points, and draws. -*/ void Fl_Device::end_points() { #if defined(USE_X11) if (n>1) XDrawPoints(fl_display, fl_window, fl_gc, p, n, 0); @@ -250,9 +227,6 @@ void Fl_Device::end_points() { #endif } -/** - Ends list of lines, and draws. -*/ void Fl_Device::end_line() { if (n < 2) { fl_end_points(); @@ -283,18 +257,12 @@ static void fixloop() { // remove equal points from closed path while (n>2 && p[n-1].x == p[0].x && p[n-1].y == p[0].y) n--; } -/** - Ends closed sequence of lines, and draws. -*/ void Fl_Device::end_loop() { fixloop(); if (n>2) fl_transformed_vertex((COORD_T)p[0].x, (COORD_T)p[0].y); fl_end_line(); } -/** - Ends convex filled polygon, and draws. -*/ void Fl_Device::end_polygon() { fixloop(); if (n < 3) { @@ -332,20 +300,6 @@ static int counts[20]; static int numcount; #endif -/** - Starts drawing a complex filled polygon. - - The polygon may be concave, may have holes in it, or may be several - disconnected pieces. Call fl_gap() to separate loops of the path. - - To outline the polygon, use fl_begin_loop() and replace each fl_gap() - with fl_end_loop();fl_begin_loop() pairs. - - \note - For portability, you should only draw polygons that appear the same - whether "even/odd" or "non-zero" winding rules are used to fill them. - Holes should be drawn in the opposite direction to the outside loop. -*/ void Fl_Device::begin_complex_polygon() { fl_begin_polygon(); gap_ = 0; @@ -354,12 +308,6 @@ void Fl_Device::begin_complex_polygon() { #endif } -/** - Call fl_gap() to separate loops of the path. - - It is unnecessary but harmless to call fl_gap() before the first vertex, - after the last vertex, or several times in a row. -*/ void Fl_Device::gap() { while (n>gap_+2 && p[n-1].x == p[gap_].x && p[n-1].y == p[gap_].y) n--; if (n > gap_+2) { @@ -373,9 +321,6 @@ void Fl_Device::gap() { } } -/** - Ends complex filled polygon, and draws. -*/ void Fl_Device::end_complex_polygon() { fl_gap(); if (n < 3) { @@ -411,13 +356,6 @@ void Fl_Device::end_complex_polygon() { // warning: these do not draw rotated ellipses correctly! // See fl_arc.c for portable version. -/** - fl_circle() is equivalent to fl_arc(x,y,r,0,360), but may be faster. - - It must be the \e only thing in the path: if you want a circle as part of - a complex polygon you must use fl_arc() - \param[in] x,y,r center and radius of circle -*/ void Fl_Device::circle(double x, double y,double r) { double xt = fl_transform_x(x,y); double yt = fl_transform_y(x,y); |
