cgp.runtime.newtypes
Class Window
java.lang.Object
|
+--cgp.runtime.Type
|
+--cgp.runtime.newtypes.Window
- public class Window
- extends Type
Method Summary |
void |
close()
Close a graphics window. |
private boolean |
colorComponentOK(int n)
|
void |
drawImage(StringType path,
NumberType x,
NumberType y)
Draw an image in the CGP graphics window. |
void |
drawLine(NumberType x1,
NumberType y1,
NumberType x2,
NumberType y2)
Draw a line in the CGP graphics window. |
void |
drawText(StringType s,
NumberType x,
NumberType y)
Draw a string in the CGP graphics window. |
void |
lineTo(NumberType x,
NumberType y)
Turtle graphics. |
void |
moveTo(NumberType x,
NumberType y)
Turtle graphics. |
void |
open(StringType title,
NumberType l,
NumberType t,
NumberType w,
NumberType h)
Open a graphics window. |
private void |
setColor(int[] rgb)
Set the colour in the CGP graphics window. |
void |
setColor(ListType rgb)
Set the colour in the CGP graphics window. |
java.lang.String |
toString()
|
void |
turn(NumberType degrees)
Turtle graphics. |
void |
walk(NumberType steps)
Turtle graphics. |
Methods inherited from class cgp.runtime.Type |
addOp,
andOp,
divideOp,
eqOp,
geOp,
getAttr,
getKBStack,
getNthOp,
getScopeStack,
getType,
gtOp,
invokeMemberFunc,
isOp,
leOp,
ltOp,
modulusOp,
multiplyOp,
negateOp,
neOp,
notOp,
operationError,
orOp,
setAttr,
setKBStack,
setNthOp,
setScopeStack,
setType,
subtractOp |
Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
wait,
wait,
wait |
f
private GCPFrame f
Window
public Window()
toString
public java.lang.String toString()
- Overrides:
- toString in class java.lang.Object
open
public void open(StringType title,
NumberType l,
NumberType t,
NumberType w,
NumberType h)
- Open a graphics window.
close
public void close()
- Close a graphics window.
colorComponentOK
private boolean colorComponentOK(int n)
setColor
public void setColor(ListType rgb)
- Set the colour in the CGP graphics window.
setColor
private void setColor(int[] rgb)
- Set the colour in the CGP graphics window.
Internal method.
drawLine
public void drawLine(NumberType x1,
NumberType y1,
NumberType x2,
NumberType y2)
- Draw a line in the CGP graphics window.
drawText
public void drawText(StringType s,
NumberType x,
NumberType y)
- Draw a string in the CGP graphics window.
drawImage
public void drawImage(StringType path,
NumberType x,
NumberType y)
- Draw an image in the CGP graphics window.
moveTo
public void moveTo(NumberType x,
NumberType y)
- Turtle graphics.
Move to the specified location in the CGP graphics window.
lineTo
public void lineTo(NumberType x,
NumberType y)
- Turtle graphics.
Draw a line to the specified location in the CGP graphics window.
turn
public void turn(NumberType degrees)
- Turtle graphics.
Turn the turtle by the specified number of degrees (left = negative).
walk
public void walk(NumberType steps)
- Turtle graphics.
Walk the turtle in the current direction specfiied by turn().
If a negative value is specified, the turtle will move in reverse.