From 74d47ce80c68cff16554a37e554bcb6df9ff3728 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Thu, 19 Dec 2002 21:34:26 +0000 Subject: [PATCH] Doco updates. Added filename_setext() macro for FLTK_1_0_COMPAT. Fixed copy() methods so they don't overflow the source image buffer. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2881 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- CHANGES | 6 ++++++ FL/filename.H | 5 +++-- documentation/drawing.html | 41 ++++++++++++++++++++++++++++++++++++ documentation/migration.html | 4 ++++ src/Fl_Bitmap.cxx | 8 +++---- src/Fl_Image.cxx | 8 +++---- src/Fl_Pixmap.cxx | 8 +++---- 7 files changed, 66 insertions(+), 14 deletions(-) diff --git a/CHANGES b/CHANGES index 8fa14fe9c..cbb071198 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,11 @@ CHANGES IN FLTK 1.1.3 + - Documentation updates. + - Added backward-compatibility macro for + filename_setext(). + - Fl_Bitmap::copy(), Fl_Pixmap::copy(), and + Fl_RGB_Image::copy() all could overflow the source + image when scaling the image. - Double/triple clicks in Fl_Input fields didn't copy the expanded selection to the clipboard. - Fl_Glut_Window and Fl_Gl_Window didn't always initialize diff --git a/FL/filename.H b/FL/filename.H index 86e1910bb..b9edb9bdb 100644 --- a/FL/filename.H +++ b/FL/filename.H @@ -1,5 +1,5 @@ /* - * "$Id: filename.H,v 1.11.2.4.2.10 2002/07/08 15:20:57 easysw Exp $" + * "$Id: filename.H,v 1.11.2.4.2.11 2002/12/19 21:34:25 easysw Exp $" * * Filename header file for the Fast Light Tool Kit (FLTK). * @@ -109,6 +109,7 @@ FL_EXPORT int fl_filename_list(const char *d, struct dirent ***l, # define filename_match fl_filename_match # define filename_name fl_filename_name # define filename_relative fl_filename_relative +# define filename_setext fl_filename_setext # define numericsort fl_numericsort # endif /* FLTK_1_0_COMPAT */ @@ -116,5 +117,5 @@ FL_EXPORT int fl_filename_list(const char *d, struct dirent ***l, #endif /* FL_FILENAME_H */ /* - * End of "$Id: filename.H,v 1.11.2.4.2.10 2002/07/08 15:20:57 easysw Exp $". + * End of "$Id: filename.H,v 1.11.2.4.2.11 2002/12/19 21:34:25 easysw Exp $". */ diff --git a/documentation/drawing.html b/documentation/drawing.html index c3f8d7ca8..e88eed887 100644 --- a/documentation/drawing.html +++ b/documentation/drawing.html @@ -46,6 +46,8 @@ following types of drawing functions: +

Boxes

+ +

FLTK provides three functions that can be used to draw boxes +for buttons and other UI controls. Each function uses the +supplied upper-lefthand corner and width and height to determine +where to draw the box. + +

void fl_draw_box(Fl_Boxtype b, int x, int y, int w, int h, Fl_Color c);

+ +

The first box drawing function is fl_draw_box() +which draws a standard boxtype c in the specified +color c. + +

void fl_frame(const char *s, int x, int y, int w, int h);

+ +

The fl_frame() function draws a series of line +segments around the given box. The string s must +contain groups of 4 letters which specify one of 24 standard +grayscale values, where 'A' is black and 'X' is white. The order +of each set of 4 characters is: top, left, bottom, right. The +results of calling fl_frame() with a string that is +not a multiple of 4 characters in length are undefined. + +

The only difference between this function and +fl_frame2() is the order of the line segments. + +

void fl_frame2(const char *s, int x, int y, int w, int h);

+ +

The fl_frame2() function draws a series of line +segments around the given box. The string s must +contain groups of 4 letters which specify one of 24 standard +grayscale values, where 'A' is black and 'X' is white. The order +of each set of 4 characters is: bottom, right, top, left. The +results of calling fl_frame2() with a string that is +not a multiple of 4 characters in length are undefined. + +

The only difference between this function and +fl_frame() is the order of the line segments. +

Clipping

You can limit all your drawing to a rectangular region by calling diff --git a/documentation/migration.html b/documentation/migration.html index 9e50b0533..be0f283a1 100644 --- a/documentation/migration.html +++ b/documentation/migration.html @@ -91,6 +91,10 @@ symbol on the command-line when you compile filename_relative() fl_filename_relative() + + filename_setext() + fl_filename_setext() + frame() fl_frame() diff --git a/src/Fl_Bitmap.cxx b/src/Fl_Bitmap.cxx index c4d8a8f73..6989fb753 100644 --- a/src/Fl_Bitmap.cxx +++ b/src/Fl_Bitmap.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.19 2002/11/19 16:37:34 easysw Exp $" +// "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.20 2002/12/19 21:34:25 easysw Exp $" // // Bitmap drawing routines for the Fast Light Tool Kit (FLTK). // @@ -437,8 +437,8 @@ Fl_Image *Fl_Bitmap::copy(int W, int H) { memset(new_array, 0, H * (W + 7) / 8); // Scale the image using a nearest-neighbor algorithm... - for (dy = H, sy = 0, yerr = H / 2, new_ptr = new_array; dy > 0; dy --) { - for (dx = W, xerr = W / 2, old_ptr = array + sy * (w() + 7) / 8, sx = 0, new_bit = 128; + for (dy = H, sy = 0, yerr = H, new_ptr = new_array; dy > 0; dy --) { + for (dx = W, xerr = W, old_ptr = array + sy * (w() + 7) / 8, sx = 0, new_bit = 128; dx > 0; dx --) { old_bit = (uchar)(128 >> (sx & 7)); @@ -474,5 +474,5 @@ Fl_Image *Fl_Bitmap::copy(int W, int H) { // -// End of "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.19 2002/11/19 16:37:34 easysw Exp $". +// End of "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.20 2002/12/19 21:34:25 easysw Exp $". // diff --git a/src/Fl_Image.cxx b/src/Fl_Image.cxx index 46b45d8d5..eb9135ecf 100644 --- a/src/Fl_Image.cxx +++ b/src/Fl_Image.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Image.cxx,v 1.5.2.3.2.25 2002/11/19 16:37:35 easysw Exp $" +// "$Id: Fl_Image.cxx,v 1.5.2.3.2.26 2002/12/19 21:34:25 easysw Exp $" // // Image drawing code for the Fast Light Tool Kit (FLTK). // @@ -169,8 +169,8 @@ Fl_Image *Fl_RGB_Image::copy(int W, int H) { new_image->alloc_array = 1; // Scale the image using a nearest-neighbor algorithm... - for (dy = H, sy = 0, yerr = H / 2, new_ptr = new_array; dy > 0; dy --) { - for (dx = W, xerr = W / 2, old_ptr = array + sy * (w() * d() + ld()); + for (dy = H, sy = 0, yerr = H, new_ptr = new_array; dy > 0; dy --) { + for (dx = W, xerr = W, old_ptr = array + sy * (w() * d() + ld()); dx > 0; dx --) { for (c = 0; c < d(); c ++) *new_ptr++ = old_ptr[c]; @@ -392,5 +392,5 @@ void Fl_RGB_Image::label(Fl_Menu_Item* m) { // -// End of "$Id: Fl_Image.cxx,v 1.5.2.3.2.25 2002/11/19 16:37:35 easysw Exp $". +// End of "$Id: Fl_Image.cxx,v 1.5.2.3.2.26 2002/12/19 21:34:25 easysw Exp $". // diff --git a/src/Fl_Pixmap.cxx b/src/Fl_Pixmap.cxx index 4b706579d..c1b038277 100644 --- a/src/Fl_Pixmap.cxx +++ b/src/Fl_Pixmap.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.23 2002/11/19 16:37:35 easysw Exp $" +// "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.24 2002/12/19 21:34:26 easysw Exp $" // // Pixmap drawing code for the Fast Light Tool Kit (FLTK). // @@ -279,11 +279,11 @@ Fl_Image *Fl_Pixmap::copy(int W, int H) { } // Scale the image using a nearest-neighbor algorithm... - for (dy = H, sy = 0, yerr = H / 2; dy > 0; dy --, new_row ++) { + for (dy = H, sy = 0, yerr = H; dy > 0; dy --, new_row ++) { *new_row = new char[chars_per_line]; new_ptr = *new_row; - for (dx = W, xerr = W / 2, old_ptr = data()[sy + ncolors + 1]; + for (dx = W, xerr = W, old_ptr = data()[sy + ncolors + 1]; dx > 0; dx --) { for (c = 0; c < chars_per_pixel; c ++) *new_ptr++ = old_ptr[c]; @@ -461,5 +461,5 @@ void Fl_Pixmap::desaturate() { } // -// End of "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.23 2002/11/19 16:37:35 easysw Exp $". +// End of "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.24 2002/12/19 21:34:26 easysw Exp $". //