merge
This commit is contained in:
commit
2524319b4c
|
@ -11,15 +11,26 @@ holding down mouse button 1 or its equivalent.
|
||||||
.PP
|
.PP
|
||||||
A number of keyboard commands are recognized:
|
A number of keyboard commands are recognized:
|
||||||
.TP
|
.TP
|
||||||
|
.B b
|
||||||
|
Set the brush size to an ellipse with a horizontal semiaxis of
|
||||||
|
.I n
|
||||||
|
and a vertical semiaxis of
|
||||||
|
.I n
|
||||||
|
(see
|
||||||
|
.IR graphics (2)).
|
||||||
|
Type a number,
|
||||||
|
.I n,
|
||||||
|
in the pop-up box and hit enter.
|
||||||
|
.TP
|
||||||
.B c
|
.B c
|
||||||
Clear the screen. Any unsaved work will be lost.
|
Clear the screen. Any unsaved work will be lost.
|
||||||
.TP
|
.TP
|
||||||
.B s
|
.B s
|
||||||
Save the current screen as a bitmap image. A pop-up window appears
|
Save the current screen as a bitmap image. A pop-up box appears
|
||||||
suggesting a default filename of
|
suggesting a default filename of
|
||||||
.I out.bit.
|
.I out.bit.
|
||||||
Hit enter to accept the default, or backspace over the suggested name and
|
Hit enter to accept the default, or backspace over the suggested name and
|
||||||
enter an alternative path and filename. If the path is omitted, the file will be
|
type an alternative path and filename. If the path is omitted, a file will be
|
||||||
created in the current directory.
|
created in the current directory.
|
||||||
.TP
|
.TP
|
||||||
.B q
|
.B q
|
||||||
|
@ -31,6 +42,6 @@ Quit.
|
||||||
.IR image (6)
|
.IR image (6)
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
.I Paint
|
.I Paint
|
||||||
offers the bare minimum of drawing functionality.
|
offers a bare minimum of drawing functionality. Popular features such as
|
||||||
.B Undo
|
.B undo
|
||||||
has not been implemented.
|
have not yet been implemented.
|
||||||
|
|
|
@ -40,6 +40,8 @@ main()
|
||||||
Event e;
|
Event e;
|
||||||
Point last;
|
Point last;
|
||||||
int haslast;
|
int haslast;
|
||||||
|
int brushsize = 1;
|
||||||
|
char brush[128];
|
||||||
char file[128];
|
char file[128];
|
||||||
|
|
||||||
haslast = 0;
|
haslast = 0;
|
||||||
|
@ -47,7 +49,6 @@ main()
|
||||||
fprint(2, "paint: initdraw failed: %r\n");
|
fprint(2, "paint: initdraw failed: %r\n");
|
||||||
exits("initdraw");
|
exits("initdraw");
|
||||||
}
|
}
|
||||||
|
|
||||||
einit(Emouse | Ekeyboard);
|
einit(Emouse | Ekeyboard);
|
||||||
draw(screen, screen->r, display->white, 0, ZP);
|
draw(screen, screen->r, display->white, 0, ZP);
|
||||||
flushimage(display, 1);
|
flushimage(display, 1);
|
||||||
|
@ -56,9 +57,9 @@ main()
|
||||||
case Emouse:
|
case Emouse:
|
||||||
if(e.mouse.buttons & 1){
|
if(e.mouse.buttons & 1){
|
||||||
if(haslast)
|
if(haslast)
|
||||||
line(screen, last, e.mouse.xy, Enddisc, Enddisc, 5, display->black, ZP);
|
line(screen, last, e.mouse.xy, Enddisc, Enddisc, brushsize, display->black, ZP);
|
||||||
else
|
else
|
||||||
fillellipse(screen, e.mouse.xy, 5, 5, display->black, ZP);
|
fillellipse(screen, e.mouse.xy, brushsize, brushsize, display->black, ZP);
|
||||||
|
|
||||||
last = e.mouse.xy;
|
last = e.mouse.xy;
|
||||||
haslast = 1;
|
haslast = 1;
|
||||||
|
@ -66,15 +67,20 @@ main()
|
||||||
} else
|
} else
|
||||||
haslast = 0;
|
haslast = 0;
|
||||||
if(e.mouse.buttons & 4){
|
if(e.mouse.buttons & 4){
|
||||||
fillellipse(screen, e.mouse.xy, 5, 5, display->white, ZP);
|
fillellipse(screen, e.mouse.xy, brushsize, brushsize, display->white, ZP);
|
||||||
flushimage(display, 1);
|
flushimage(display, 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Ekeyboard:
|
case Ekeyboard:
|
||||||
if(e.kbdc == 'q')
|
if(e.kbdc == 'b'){
|
||||||
exits(nil);
|
if(eenter("Brush", brush, sizeof(brush), &e.mouse) <= 0)
|
||||||
|
break;
|
||||||
|
brushsize = atoi(brush);
|
||||||
|
}
|
||||||
if(e.kbdc == 'c')
|
if(e.kbdc == 'c')
|
||||||
draw(screen, screen->r, display->white, 0, ZP);
|
draw(screen, screen->r, display->white, 0, ZP);
|
||||||
|
if(e.kbdc == 'q')
|
||||||
|
exits(nil);
|
||||||
if(e.kbdc == 's'){
|
if(e.kbdc == 's'){
|
||||||
snprint(file, sizeof(file), "out.bit");
|
snprint(file, sizeof(file), "out.bit");
|
||||||
if(eenter("Save to", file, sizeof(file), &e.mouse) <= 0)
|
if(eenter("Save to", file, sizeof(file), &e.mouse) <= 0)
|
||||||
|
|
Loading…
Reference in a new issue