All pastes #210861 Raw Edit

Someone

public text v1 · immutable
#210861 ·published 2006-10-20 01:51 UTC
rendered paste body
alias F9 window -apk0 @paint | set %size 10 | /set %color $rgb(0,0,0)
alias /drawcurvy { drawdot -r @paint %color %size $mouse.x $mouse.y }
menu @paint {
  leave:{
    if (%lineon) { unset $v1 }
    if (%circleon) { unset $v1 }
    if (%roundedon) { unset $v1 }
    if (%texton) { unset $v1 }
    if (%squareon) { unset $v1 }
    .timermycurvyline off
  }
  sclick:{
    set %leftclick $mouse.x $mouse.y
    if (%eyedropperon) { set %color $getdot(@paint,$mouse.x,$mouse.y) | halt }
    if (%lineon) { halt }
    if (%circleon) { halt }
    if (%roundedon) { halt }
    if (%texton) { halt }
    if (%squareon) { halt }
    else { .timermycurvyline -m 0 -5 drawcurvy }
  }
  uclick:{
    if (%eyedropperon) { unset %eyedropperon | halt } 
    if (%lineon) { drawline -r @paint %color %size %leftclick $mouse.x $mouse.y | unset %lineon | halt }
    if (%texton) { drawtext -r @paint %color %leftclick $?="What text?" | unset %texton | halt }
    if (%squareon) {
      if ($gettok(%leftclick,1,32) < $mouse.x) { var %width = $calc($mouse.x - $gettok(%leftclick,1,32)) }
      else { var %width = $+(-,$calc($gettok(%leftclick,1,32) - $mouse.x)) }
      if ($gettok(%leftclick,2,32) < $mouse.y) { var %height = $calc($mouse.y - $gettok(%leftclick,2,32)) }
      else { var %height = $+(-,$calc($gettok(%leftclick,2,32) - $mouse.y)) }
      drawrect -rf @paint %color %size %leftclick %width %height
      unset %squareon
      halt 
    }
    if (%circleon) {
      if ($gettok(%leftclick,1,32) < $mouse.x) { var %width = $calc($mouse.x - $gettok(%leftclick,1,32)) }
      else { var %width = $+(-,$calc($gettok(%leftclick,1,32) - $mouse.x)) }
      if ($gettok(%leftclick,2,32) < $mouse.y) { var %height = $calc($mouse.y - $gettok(%leftclick,2,32)) }
      else { var %height = $+(-,$calc($gettok(%leftclick,2,32) - $mouse.y)) }
      drawrect -ref @paint %color %size %leftclick %width %height
      unset %circleon
      halt 
    }
    if (%roundedon) {
      if ($gettok(%leftclick,1,32) < $mouse.x) { var %width = $calc($mouse.x - $gettok(%leftclick,1,32)) }
      else { var %width = $+(-,$calc($gettok(%leftclick,1,32) - $mouse.x)) }
      if ($gettok(%leftclick,2,32) < $mouse.y) { var %height = $calc($mouse.y - $gettok(%leftclick,2,32)) }
      else { var %height = $+(-,$calc($gettok(%leftclick,2,32) - $mouse.y)) }
      drawrect -rdf @paint %color %size %leftclick %width %height
      unset %roundedon
      halt 
    }
    if (%leftclick == $mouse.x $mouse.y) {
      drawdot -r @paint %color %size %leftclick
      .timermycurvyline off
    }
    else { .timermycurvyline off | unset %leftclick }
  }
  .Picture Window Usage Options
  .New:{
    window -c @paint
    window -apk0 @paint
  }
  .colors
  ..Erase(White):/set %color $rgb(255,255,255)
  ..red:/set %color $rgb(255,0,0)
  ..pink:/set %color $rgb(255,105,180)
  ..Deep Pink:/set %color $rgb(255,20,147)
  ..Purple:/set %color $rgb(160,32,240)
  ..Dark Blue:/set %color $rgb(25,25,112)
  ..Sky Blue:/set %color $rgb(0,191,255)
  ..Black:/set %color $rgb(0,0,0)
  ..Gray:/set %color $rgb(190,190,190)
  ..Light Green:/set %color $rgb(124,252,0)
  ..Brown:/set %color $rgb(139,69,19)
  ..Gold:/set %color $rgb(255,215,0)
  ..Yellow:/set %color $rgb(255,255,0)
  ..Orange:/set %color $rgb(255,140,0)
  ..Green:/set %color $rgb(0,255,0)
  ..Blue:/set %color $rgb(0,0,255)
  .Dot Size
  ..20:/set %size 20
  ..15:/set %size 15
  ..10:/set %size 10
  ..5:/set %size 5
  ..Custom Size:{
    var %hmm $?="What size dot?"
    if (%hmm) { set %size %hmm }
    else { set %size 10 }
  }
  .Tools
  ..EyeDropper:/set %eyedropperon on
  ..Square:/set %squareon on
  ..text:/set %texton on
  ..Circle:/set %Circleon on
  ..Rounded Rectangle:/set %roundedon on
  ..Line:/set %lineon on
}