#!/bin/bash # RADIUS=50 RADIUS_SQUARED=$RADIUS*$RADIUS xPos=( 0 10 20 30 40 50 ) sub=0 ELEMENTS=6 while [ $sub -lt $ELEMENTS ]; do declare -a xSquared[$sub]=${xPos[$sub]}*${xPos[$sub]} let sub=$sub+1 done sub=0 while [ $sub -lt $ELEMENTS ]; do declare -a ySquared[$sub]=`echo "$RADIUS_SQUARED-${xSquared[$sub]}" | bc -l` let sub=$sub+1 done sub=0 while [ $sub -lt $ELEMENTS ]; do declare -a yPos[$sub]=`echo "sqrt (${ySquared[$sub]})" | bc -l` let sub=$sub+1 done . /home/bh011695/Downloads/xpaint.sh #Draws the side - Just a straight line 200 pixels long x=660 y=600 xwit -root -warp $x $y xte 'mousedown 1' while [ $y -ge 400 ]; do xwit -root -warp $x $y let y=$y-1 done xte 'mouseup 1' xwit -root -warp 660 400 xte 'mousedown 1' #Draws the top right curve for the head. xSub=1 ySub=1 while [ $xSub -lt $ELEMENTS ]; do xwit -root -rwarp -${xPos[$xSub]} -${yPos[$ySub]} let xSub=$xSub+1 let ySub=$ySub+1 done #Draws a filler line to connect to the two curves the create the head. #I using the same array for this that I used for the circle. When drawing #the legs at the end, I saw that the legs were just a bit longer than what #curve allowed. This just creates a line ten pixels long to fill in that gap. x=510 y=237 while [ $x -gt 500 ]; do xwit -root -warp $x $y let x=$x-1 done #Draws the top left - This makes the second curve for the top of the head. xSub=5 ySub=5 while [ $xSub -gt 0 ]; do xwit -root -rwarp -${xPos[$xSub]} ${yPos[$ySub]} let xSub=$xSub-1 let ySub=$ySub-1 done xte 'mouseup 1' #Draws the left side of the body, again, 200 pixels long. x=350 y=400 xwit -root -warp $x $y xte 'mousedown 1' while [ $y -le 600 ]; do xwit root -warp $x $y let y=$y+1 done #This is where it starts drawing the legs using a bunch of triangles. #Each leg is 50 pixels long and 104 from point to point. #draws first leg x=350 y=600 while [ $y -ge 550 ]; do xwit -root -warp $x $y let x=$x+1 let y=$y-1 done #draws second leg while [ $y -le 600 ]; do xwit -root -warp $x $y let x=$x+1 let y=$y+1 done while [ $y -ge 550 ]; do xwit -root -warp $x $y let x=$x+1 let y=$y-1 done #draws second leg while [ $y -le 600 ]; do xwit -root -warp $x $y let x=$x+1 let y=$y+1 done while [ $y -ge 550 ]; do xwit -root -warp $x $y let x=$x+1 let y=$y-1 done #draws second leg while [ $y -le 600 ]; do xwit -root -warp $x $y let x=$x+1 let y=$y+1 done xte 'mouseup 1' #Selects fill tool xwit -root -warp 65 400 xte 'mousedown 1' sleep 0.5s; xte 'mouseup 1' #Fills the background xwit -root -warp 300 300 xte 'mousedown 1' sleep 0.5s; xte 'mouseup 1' #Selects the color blue sleep 2s xwit -root -warp 268 72 xte 'mousedown 1' sleep 0.5s; xte 'mouseup 1' #Fills the body of the ghost xwit -root -warp 500 500 xte 'mousedown 1' sleep 0.5s; xte 'mouseup 1' #Selects the color white xwit -root -warp 165 60 xte 'mousedown 1' sleep 0.5s; xte 'mouseup 1' #Selects the pencil tool xwit -root -warp 30 90 xte 'mousedown 1' sleep 0.5s; xte 'mouseup 1' #Draws the eyes of the ghost. It draws both eyes starting #from the inside and going outside, coming back around. The #length of each side of the eye is 35 pixels. #This draws the first eye. x=475 y=400 xwit -root -warp $x $y xte 'mousedown 1' while [ $x -ge 435 ]; do xwit -root -warp $x $y let x=$x-1 done while [ $y -ge 360 ]; do xwit -root -warp $x $y let y=$y-1 done while [ $x -le 475 ]; do xwit -root -warp $x $y let x=$x+1 done while [ $y -le 400 ]; do xwit -root -warp $x $y let y=$y+1 done xte 'mouseup 1' #This draws the second eye. x=535 y=400 xwit -root -warp $x $y xte 'mousedown 1' while [ $x -le 575 ]; do xwit -root -warp $x $y let x=$x+1 done while [ $y -ge 360 ]; do xwit -root -warp $x $y let y=$y-1 done while [ $x -ge 535 ]; do xwit -root -warp $x $y let x=$x-1 done while [ $y -le 400 ]; do xwit -root -warp $x $y let y=$y+1 done xte 'mouseup 1' #Selects the fill tool. xwit -root -warp 65 400 xte 'mousedown 1' sleep 0.5s; xte 'mouseup 1' #Fills the left eye xwit -root -warp 455 380 xte 'mousedown 1' sleep 0.5s; xte 'mouseup 1' #Fills the right eye. xwit -root -warp 555 380 xte 'mousedown 1' sleep 0.5s; xte 'mouseup 1' #Right clicks on the brush tool. xwit -root -warp 20 125 xte 'mousedown 3' sleep 0.5s; xte 'mouseup 3' xwit -root -warp 20 200 xte 'mousedown 1' sleep 0.5s; xte 'mouseup 1' sleep 2s #Grabs the id of the brush tool window brushWinID=`xwit -print -all | grep 'Brush' | sed -e 's/:.*//g'` #Moves the brush tool window xwit -id $brushWinID -move 1 440 #Selects the square brush xwit -root -warp 25 555 xte 'mousedown 1' sleep 0.5s; xte 'mouseup 1' sleep 1s xwit -root -warp 25 600 xte 'mousedown 1' sleep 0.5s; xte 'mouseup 1' #Clicks the select brush button. xwit -root -warp 30 205 xte 'mousedown 1' sleep 0.5s; xte 'mouseup 1' xwit -root -warp 20 125 xte 'mousedown 1' sleep 1s; xte 'mouseup 1' #Draws the mouth. The far left and far right sides of the mouth #are just a single click of the mouse with no movement, 15 pixels square. #The mouse position is the very center pixel of the square. The rectanglular #parts of the mouth are 45 pixels wide and 15 long. Whatever the width of the #rectangle, subtract 15. This accounts for the width of brush cursor. #paint brush cursor. xwit -root -warp 390 500 xte 'mousedown 1' sleep 0.5s; xte 'mouseup 1' xwit -root -warp 405 485 xte 'mousedown 1' xwit -root -warp 435 485 xte 'mouseup 1' xwit -root -warp 450 500 xte 'mousedown 1' xwit -root -warp 480 500 xte 'mouseup 1' xwit -root -warp 495 485 xte 'mousedown 1' xwit -root -warp 525 485 xte 'mouseup 1' xwit -root -warp 540 500 xte 'mousedown 1' xwit -root -warp 570 500 xte 'mouseup 1' xwit -root -warp 585 485 xte 'mousedown 1' xwit -root -warp 605 485 xte 'mouseup 1' xwit -root -warp 620 500 xte 'mousedown 1' sleep 0.5s; xte 'mouseup 1' xwit -root -warp 1 1