| 22 | }; |
| 23 | |
| 24 | function drawDigit(ctx, x, y, w, h, ch) { |
| 25 | const segs = SEG[ch] || SEG[" "]; |
| 26 | const t = Math.max(2, h * 0.10); |
| 27 | |
| 28 | function bar(px, py, pw, ph, on) { |
| 29 | ctx.fillStyle = on ? theme.widget_text : theme.widget_border; |
| 30 | ctx.fillRect(px, py, pw, ph); |
| 31 | } |
| 32 | |
| 33 | bar(x + t, y, w - 2 * t, t, segs[0]); // a |
| 34 | bar(x + w - t, y + t, t, h * 0.5 - t * 1.5, segs[1]); // b |
| 35 | bar(x + w - t, y + h * 0.5 + t * 0.5, t, h * 0.5 - t * 1.5, segs[2]); // c |
| 36 | bar(x + t, y + h - t, w - 2 * t, t, segs[3]); // d |
| 37 | bar(x, y + h * 0.5 + t * 0.5, t, h * 0.5 - t * 1.5, segs[4]); // e |
| 38 | bar(x, y + t, t, h * 0.5 - t * 1.5, segs[5]); // f |
| 39 | bar(x + t, y + h * 0.5 - t * 0.5, w - 2 * t, t, segs[6]); // g |
| 40 | } |
| 41 | |
| 42 | function paint(ctx, w, h) { |
| 43 | // Cream paper background + vignette. |