diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-07-01 18:03:10 +0200 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-07-06 20:28:20 +0200 |
| commit | f09e17c3c564e8310125a10c03397cbf473ff643 (patch) | |
| tree | 8d0fd4a28e3686c33aaa140d07ddba26ab28bdc2 /src/Fl_Pixmap.cxx | |
| parent | b0e0c355edaa2e23148cb0260ada907aec930f05 (diff) | |
Remove $Id$ tags, update URL's, and more
- remove obsolete svn '$Id$' tags from all source files
- update .fl files and generated files accordingly
- replace 'http://www.fltk.org' URL's with 'https://...'
- replace bug report URL 'str.php' with 'bugs.php'
- remove trailing whitespace
- fix other whitespace errors flagged by Git
- add and/or fix missing or wrong standard headers
- convert tabs to spaces in all source files
The only relevant code changes are in the fluid/ folder where
some .fl files and other source files were used to generate
the '$Id' headers and footers.
Diffstat (limited to 'src/Fl_Pixmap.cxx')
| -rw-r--r-- | src/Fl_Pixmap.cxx | 136 |
1 files changed, 65 insertions, 71 deletions
diff --git a/src/Fl_Pixmap.cxx b/src/Fl_Pixmap.cxx index cd8479157..61bfcb962 100644 --- a/src/Fl_Pixmap.cxx +++ b/src/Fl_Pixmap.cxx @@ -1,6 +1,4 @@ // -// "$Id$" -// // Pixmap drawing code for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2018 by Bill Spitzak and others. @@ -9,11 +7,11 @@ // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // -// http://www.fltk.org/COPYING.php +// https://www.fltk.org/COPYING.php // -// Please report all bugs and problems on the following page: +// Please see the following page on how to report bugs and issues: // -// http://www.fltk.org/str.php +// https://www.fltk.org/bugs.php // // Draws X pixmap data, keeping it stashed in a server pixmap so it @@ -81,12 +79,12 @@ void Fl_Pixmap::label(Fl_Menu_Item* m) { void Fl_Pixmap::copy_data() { if (alloc_data) return; - char **new_data, // New data array - **new_row; // Current row in image - int i, // Looping var - ncolors, // Number of colors in image - chars_per_pixel,// Characters per color - chars_per_line; // Characters per line + char **new_data, // New data array + **new_row; // Current row in image + int i, // Looping var + ncolors, // Number of colors in image + chars_per_pixel,// Characters per color + chars_per_line; // Characters per line // Figure out how many colors there are, and how big they are... sscanf(data()[0],"%*d%*d%d%d", &ncolors, &chars_per_pixel); @@ -128,7 +126,7 @@ void Fl_Pixmap::copy_data() { } Fl_Image *Fl_Pixmap::copy(int W, int H) { - Fl_Pixmap *new_image; // New pixmap + Fl_Pixmap *new_image; // New pixmap if (!data()) { // happens with bad pixmap data return new Fl_Pixmap((char *const*)0); } @@ -142,21 +140,21 @@ Fl_Image *Fl_Pixmap::copy(int W, int H) { if (W <= 0 || H <= 0) return 0; // OK, need to resize the image data; allocate memory and - char **new_data, // New array for image data - **new_row, // Pointer to row in image data - *new_ptr, // Pointer into new array - new_info[255]; // New information line - const char *old_ptr; // Pointer into old array - int i, // Looping var - c, // Channel number - sy, // Source coordinate - dx, dy, // Destination coordinates - xerr, yerr, // X & Y errors - xmod, ymod, // X & Y moduli - xstep, ystep; // X & Y step increments - int ncolors, // Number of colors in image - chars_per_pixel,// Characters per color - chars_per_line; // Characters per line + char **new_data, // New array for image data + **new_row, // Pointer to row in image data + *new_ptr, // Pointer into new array + new_info[255]; // New information line + const char *old_ptr; // Pointer into old array + int i, // Looping var + c, // Channel number + sy, // Source coordinate + dx, dy, // Destination coordinates + xerr, yerr, // X & Y errors + xmod, ymod, // X & Y moduli + xstep, ystep; // X & Y step increments + int ncolors, // Number of colors in image + chars_per_pixel,// Characters per color + chars_per_line; // Characters per line // Figure out how many colors there are, and how big they are... sscanf(data()[0],"%*d%*d%d%d", &ncolors, &chars_per_pixel); @@ -199,16 +197,16 @@ Fl_Image *Fl_Pixmap::copy(int W, int H) { new_ptr = *new_row; for (dx = W, xerr = W, old_ptr = data()[sy + ncolors + 1]; - dx > 0; - dx --) { + dx > 0; + dx --) { for (c = 0; c < chars_per_pixel; c ++) *new_ptr++ = old_ptr[c]; old_ptr += xstep; xerr -= xmod; if (xerr <= 0) { - xerr += W; - old_ptr += chars_per_pixel; + xerr += W; + old_ptr += chars_per_pixel; } } @@ -235,8 +233,8 @@ void Fl_Pixmap::color_average(Fl_Color c, float i) { copy_data(); // Get the color to blend with... - uchar r, g, b; - unsigned ia, ir, ig, ib; + uchar r, g, b; + unsigned ia, ir, ig, ib; Fl::get_color(c, r, g, b); if (i < 0.0f) i = 0.0f; @@ -248,10 +246,10 @@ void Fl_Pixmap::color_average(Fl_Color c, float i) { ib = b * (256 - ia); // Update the colormap to do the blend... - char line[255]; // New colormap line - int color, // Looping var - ncolors, // Number of colors in image - chars_per_pixel;// Characters per color + char line[255]; // New colormap line + int color, // Looping var + ncolors, // Number of colors in image + chars_per_pixel;// Characters per color sscanf(data()[0],"%*d%*d%d%d", &ncolors, &chars_per_pixel); @@ -272,14 +270,14 @@ void Fl_Pixmap::color_average(Fl_Color c, float i) { const char *p = data()[color + 1] + chars_per_pixel + 1; const char *previous_word = p; for (;;) { - while (*p && isspace(*p)) p++; - char what = *p++; - while (*p && !isspace(*p)) p++; - while (*p && isspace(*p)) p++; - if (!*p) {p = previous_word; break;} - if (what == 'c') break; - previous_word = p; - while (*p && !isspace(*p)) p++; + while (*p && isspace(*p)) p++; + char what = *p++; + while (*p && !isspace(*p)) p++; + while (*p && isspace(*p)) p++; + if (!*p) {p = previous_word; break;} + if (what == 'c') break; + previous_word = p; + while (*p && !isspace(*p)) p++; } if (fl_parse_color(p, r, g, b)) { @@ -288,13 +286,13 @@ void Fl_Pixmap::color_average(Fl_Color c, float i) { b = (ia * b + ib) >> 8; if (chars_per_pixel > 1) sprintf(line, "%c%c c #%02X%02X%02X", - data()[color + 1][0], - data()[color + 1][1], r, g, b); + data()[color + 1][0], + data()[color + 1][1], r, g, b); else sprintf(line, "%c c #%02X%02X%02X", data()[color + 1][0], r, g, b); delete[] (char *)data()[color + 1]; - ((char **)data())[color + 1] = new char[strlen(line) + 1]; - strcpy((char *)data()[color + 1], line); + ((char **)data())[color + 1] = new char[strlen(line) + 1]; + strcpy((char *)data()[color + 1], line); } } } @@ -308,8 +306,8 @@ void Fl_Pixmap::delete_data() { } void Fl_Pixmap::set_data(const char * const * p) { - int height, // Number of lines in image - ncolors; // Number of colors in image + int height, // Number of lines in image + ncolors; // Number of colors in image if (p) { sscanf(p[0],"%*d%d%d", &height, &ncolors); @@ -327,11 +325,11 @@ void Fl_Pixmap::desaturate() { copy_data(); // Update the colormap to grayscale... - char line[255]; // New colormap line - int i, // Looping var - ncolors, // Number of colors in image - chars_per_pixel;// Characters per color - uchar r, g, b; + char line[255]; // New colormap line + int i, // Looping var + ncolors, // Number of colors in image + chars_per_pixel;// Characters per color + uchar r, g, b; sscanf(data()[0],"%*d%*d%d%d", &ncolors, &chars_per_pixel); @@ -350,31 +348,27 @@ void Fl_Pixmap::desaturate() { const char *p = data()[i + 1] + chars_per_pixel + 1; const char *previous_word = p; for (;;) { - while (*p && isspace(*p)) p++; - char what = *p++; - while (*p && !isspace(*p)) p++; - while (*p && isspace(*p)) p++; - if (!*p) {p = previous_word; break;} - if (what == 'c') break; - previous_word = p; - while (*p && !isspace(*p)) p++; + while (*p && isspace(*p)) p++; + char what = *p++; + while (*p && !isspace(*p)) p++; + while (*p && isspace(*p)) p++; + if (!*p) {p = previous_word; break;} + if (what == 'c') break; + previous_word = p; + while (*p && !isspace(*p)) p++; } if (fl_parse_color(p, r, g, b)) { g = (uchar)((r * 31 + g * 61 + b * 8) / 100); if (chars_per_pixel > 1) sprintf(line, "%c%c c #%02X%02X%02X", data()[i + 1][0], - data()[i + 1][1], g, g, g); + data()[i + 1][1], g, g, g); else sprintf(line, "%c c #%02X%02X%02X", data()[i + 1][0], g, g, g); delete[] (char *)data()[i + 1]; - ((char **)data())[i + 1] = new char[strlen(line) + 1]; - strcpy((char *)data()[i + 1], line); + ((char **)data())[i + 1] = new char[strlen(line) + 1]; + strcpy((char *)data()[i + 1], line); } } } } - -// -// End of "$Id$". -// |
