shithub: dpaint

Download patch

ref: 9888c41500795460f093264af1adf42edfb928a7
parent: 2d128742992e395e0c2bfcb87a0f76e865fbcf34
author: Clay Ayers <thedaemon@thedaemon.space>
date: Sun Mar 3 15:43:13 EST 2024

e

--- a/dpaint.c
+++ b/dpaint.c
@@ -6,7 +6,7 @@
 
 char *filename;
 int zoom = 1;
-int brush = 1;
+int brush = 0;
 Point spos;		/* position on screen */
 Point cpos;		/* position on canvas */
 Image *canvas;
@@ -17,7 +17,7 @@
 Rectangle penr;		/* pen size rect on screen */
 
 enum {
-	NBRUSH = 10+1,
+	NBRUSH = 9+1,
 };
 
 int nundo = 0;
@@ -532,7 +532,7 @@
 		r.max.x = penr.min.x + (i+1)*Dx(penr) / NBRUSH;
 		rr = r;
 		if(i == brush)
-			rr.min.y += Dy(r)/3;
+			rr.min.y += Dy(r)/2;
 		if(i == NBRUSH-1){
 			/* last is special brush for fill draw */
 			draw(screen, rr, ink, nil, ZP);
@@ -549,7 +549,7 @@
 		r.max.x = palr.min.x + i*Dx(palr) / nelem(pal);
 		rr = r;
 		if(ink == pal[i-1])
-			rr.min.y += Dy(r)/3;
+			rr.min.y += Dy(r)/2;
 		draw(screen, rr, pal[i-1], nil, ZP);
 		gendrawdiff(screen, r, rr, back, ZP, nil, ZP, SoverD);
 		r.min.x = r.max.x;
@@ -792,9 +792,13 @@
 				brush = NBRUSH-1;
 				drawpal();
 				break;
-			case '0': case '1': case '2': case '3': case '4':
+			case '0':
+				brush = NBRUSH-1;
+				drawpal();
+				break;
+			case '1': case '2': case '3': case '4':
 			case '5': case '6': case '7': case '8': case '9':
-				brush = e.kbdc - '0';
+				brush = e.kbdc - '1';
 				drawpal();
 				break;
 			default: