summaryrefslogtreecommitdiff
path: root/src/fl_plastic.cxx
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2005-03-24 15:56:37 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2005-03-24 15:56:37 +0000
commitead8aa8fcb61f56daa29171f7de702464a53dfdd (patch)
tree78d349587b78f75b4dbcc44de13007a4df53980f /src/fl_plastic.cxx
parentda9b29a60002549900f2b1475cda884ce687065a (diff)
Now provide FL_PLASTIC_ROUND_UP/DOWN_BOX box types which are used
by the plastic scheme. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4183 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_plastic.cxx')
-rw-r--r--src/fl_plastic.cxx51
1 files changed, 25 insertions, 26 deletions
diff --git a/src/fl_plastic.cxx b/src/fl_plastic.cxx
index bbf397010..1a462f8ae 100644
--- a/src/fl_plastic.cxx
+++ b/src/fl_plastic.cxx
@@ -101,18 +101,18 @@ static void frame_round(int x, int y, int w, int h, const char *c, Fl_Color bc)
uchar *g = fl_gray_ramp();
int b = strlen(c) / 4 + 1;
- for (x += b, y += b, w -= 2 * b, h -= 2 * b; b > 1; b --)
+ for (; b > 1; b --, x ++, y ++, w -= 2, h -= 2)
{
- // Draw lines around the perimeter of the button, 4 colors per
+ // Draw arcs around the perimeter of the button, 4 colors per
// circuit.
fl_color(shade_color(g[*c++], bc));
- fl_line(x, y + h + b, x + w - 1, y + h + b, x + w + b - 1, y + h);
+ fl_arc(x, y, w, h, 45.0, 135.0);
fl_color(shade_color(g[*c++], bc));
- fl_line(x + w + b - 1, y + h, x + w + b - 1, y, x + w - 1, y - b);
+ fl_arc(x, y, w, h, 315.0, 405.0);
fl_color(shade_color(g[*c++], bc));
- fl_line(x + w - 1, y - b, x, y - b, x - b, y);
+ fl_arc(x, y, w, h, 225.0, 315.0);
fl_color(shade_color(g[*c++], bc));
- fl_line(x - b, y, x - b, y + h, x, y + h + b);
+ fl_arc(x, y, w, h, 135.0, 225.0);
}
}
@@ -191,29 +191,36 @@ static void shade_rect(int x, int y, int w, int h, const char *c, Fl_Color bc) {
static void shade_round(int x, int y, int w, int h, const char *c, Fl_Color bc) {
uchar *g = fl_gray_ramp();
- int i, j;
+ int i, j, k;
int clen = strlen(c) - 1;
int chalf = clen / 2;
int cstep = 1;
-
+ static const int kvals[] = { 5, 3, 2, 1 };
if (clen >= h) cstep = 2;
for (i = 0, j = 0; j < chalf; i ++, j += cstep) {
+ // Indent k inside a circle...
+ k = kvals[i];
+
// Draw the top line and points...
fl_color(shade_color(g[c[i]], bc));
- fl_xyline(x + 1, y + i, x + w - 1);
+ fl_xyline(x + k, y + i, x + w - k);
fl_color(shade_color(g[c[i] - 2], bc));
- fl_point(x, y + i + 1);
- fl_point(x + w - 1, y + i + 1);
+ fl_point(x + k - 1, y + i + 1);
+ fl_point(x + k - 2, y + i + 2);
+ fl_point(x + w - k, y + i + 1);
+ fl_point(x + w - k - 1, y + i + 2);
// Draw the bottom line and points...
fl_color(shade_color(g[c[clen - i]], bc));
- fl_xyline(x + 1, y + h - i, x + w - 1);
+ fl_xyline(x + k, y + h - i, x + w - k);
fl_color(shade_color(g[c[clen - i] - 2], bc));
- fl_point(x, y + h - i);
- fl_point(x + w - 1, y + h - i);
+ fl_point(x + k - 1, y + h - i);
+ fl_point(x + k - 2, y + h - i - 1);
+ fl_point(x + w - k, y + h - i);
+ fl_point(x + w - k - 1, y + h - i - 1);
}
// Draw the interior and sides...
@@ -256,13 +263,8 @@ static void thin_up_box(int x, int y, int w, int h, Fl_Color c) {
static void up_round(int x, int y, int w, int h, Fl_Color c) {
-#ifdef USE_OLD_PLASTIC_BOX
- shade_rect(x + 2, y + 2, w - 4, h - 5, "RVQNOPQRSTUVWVQ", c);
- up_frame(x, y, w, h, c);
-#else
- shade_rect(x + 1, y + 1, w - 2, h - 3, "RVQNOPQRSTUVWVQ", c);
- frame_rect(x, y, w, h - 1, "IJLM", c);
-#endif // USE_OLD_PLASTIC_BOX
+ shade_round(x + 1, y + 1, w - 2, h - 3, "RVQNOPQRSTUVWVQ", c);
+ frame_round(x, y, w, h - 1, "IJLM", c);
}
@@ -273,16 +275,13 @@ static void down_frame(int x, int y, int w, int h, Fl_Color c) {
static void down_box(int x, int y, int w, int h, Fl_Color c) {
shade_rect(x + 2, y + 2, w - 4, h - 5, "STUVWWWVT", c);
-
-
down_frame(x, y, w, h, c);
}
static void down_round(int x, int y, int w, int h, Fl_Color c) {
- shade_rect(x + 2, y + 2, w - 4, h - 5, "STUVWWWVT", c);
-
- down_frame(x, y, w, h, c);
+ shade_round(x + 2, y + 2, w - 4, h - 5, "STUVWWWVT", c);
+ frame_round(x, y, w, h - 1, "MLJI", c);
}