zOWBpaint 1.0b

By knoeki on Jul 15, 2009

Image

Simple little picwin-based paint program, made in about 20 minutes while I was bored :>

The code isn't too impressive, especially the pallette drawing routine... couldn't get it to work in another way, though.

Usage:

click and drag to draw.
press b to change brush size
press c to open the colour pallette
press s to save the picture
press q to exit

You can also right-click for a random colour. your current colour will always show up at the top of the screen.

I'll stress this once more: it's REALLY REALLY REALLY simple and FAR from perfect. I just made it as a little joke, not a serious effort to really make a well proper paining program... but it might end up growing into something like that ;_)

alias zOWBpaint {
   window -k0pdf @zOWBpaint -1 -1 $iif($2 != $null, $1 $2, 800 600)
   echo -a zOWBpaint v1.0b
}

menu @zOWBpaint {
   mouse: {
      if (%zp.draw == 1) {
         drawdot -r @zOWBpaint %zp.colour %zp.brush.size $mouse.x $mouse.y
      }
   }
   sclick: {
      set %zp.draw 1
   }
   uclick: {
      set %zp.draw 0
   }
   rclick: {
      set %zp.colour $rgb($rand(0,255),$rand(0,255),$rand(0,255))
      drawrect -rf @zOWBpaint %zp.colour 1 0 0 $window(@zOWBpaint).w 10
   }
   leave: {
      set %zp.draw 0
   }
}

menu @zOWBpaint.colourpicker {
   sclick: {
      set %zp.colour $getdot(@zOWBpaint.colourpicker,$mouse.x,$mouse.y)
      drawrect -rf @zOWBpaint %zp.colour 1 0 0 $window(@zOWBpaint).w 10
   }
}

;key b
on *:KEYDOWN:@zOWBpaint:66: {
   set %zp.brush.size $?="Change brush size to..."
}

;key q
on *:KEYDOWN:@zOWBpaint:81 {
   if ($?!="Exit zOWBpaint?" == $true) {
      window -c @zOWBpaint
   }
}

;key s
on *:KEYDOWN:@zOWBpaint:83: {
   drawsave -b32 @zOWBpaint $?="Save file as..."
}

;key c
on *:KEYDOWN:@zOWBpaint:67: {
   window -k0pdf @zOWBpaint.colourpicker -1 -1 260 210
   var %count 0
   var %y 0
   while (%count <= 255) {
      drawrect -r @zOWBpaint.colourpicker $rgb(%count,0,0) 1 %count %y 5 30
      inc %count
   }
   inc %y 30
   var %count 0
   while (%count <= 255) {
      drawrect -r @zOWBpaint.colourpicker $rgb(0,%count,0) 1 %count %y 5 30
      inc %count
   }
   inc %y 30
   var %count 0
   while (%count <= 255) {
      drawrect -r @zOWBpaint.colourpicker $rgb(0,0,%count) 1 %count %y 5 30
      inc %count
   }
   inc %y 30
   var %count 0
   while (%count <= 255) {
      drawrect -r @zOWBpaint.colourpicker $rgb(%count,%count,0) 1 %count %y 5 30
      inc %count
   }
   inc %y 30
   var %count 0
   while (%count <= 255) {
      drawrect -r @zOWBpaint.colourpicker $rgb(0,%count,%count) 1 %count %y 5 30
      inc %count
   }
   inc %y 30
   var %count 0
   while (%count <= 255) {
      drawrect -r @zOWBpaint.colourpicker $rgb(%count,0,%count) 1 %count %y 5 30
      inc %count
   }
   inc %y 30
   var %count 0
   while (%count <= 255) {
      drawrect -r @zOWBpaint.colourpicker $rgb(%count,%count,%count) 1 %count %y 5 30
      inc %count
   }
}

Comments

Sign in to comment.
zNigel-   -  Jul 15, 2009

Lovely, now i can entertain myself when everyone else is asleep :)

 Respond  
Crazylicious   -  Jul 15, 2009

Nice script

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.