Class Drawing
java.lang.Object
org.openpatch.scratch.drawing.Drawing
What a
DrawingSprite draws with in draw(Drawing): coordinates are the sprite's
own, with (0, 0) at its position and y up; they turn, mirror and grow with the sprite. Only
valid during that call.-
Method Summary
Modifier and TypeMethodDescriptionvoidclip(double x, double y, double width, double height) Draws only inside a rectangle untilnoClip(); a turned sprite clips to the rectangle around the turned one.voidAn image at its own size, centred on a point.voidAn image stretched to a size, centred on a point.intimageHeight(String path) intimageWidth(String path) voidnoClip()Draws everywhere again.voidA filled polygon.voidA filled rectangle centred on a point.
-
Method Details
-
polygon
A filled polygon.- Parameters:
x- x of every cornery- y of every cornercolor- the fill
-
rectangle
A filled rectangle centred on a point.- Parameters:
x- x of its centrey- y of its centrewidth- its widthheight- its heightcolor- the fill
-
image
An image at its own size, centred on a point.- Parameters:
path- an image file or a built-in sprite namex- x of its centrey- y of its centre
-
image
An image stretched to a size, centred on a point.- Parameters:
path- an image file or a built-in sprite namex- x of its centrey- y of its centrewidth- the widthheight- the height
-
imageWidth
- Parameters:
path- an image file or a built-in sprite name- Returns:
- its width in pixels
-
imageHeight
- Parameters:
path- an image file or a built-in sprite name- Returns:
- its height in pixels
-
clip
public void clip(double x, double y, double width, double height) Draws only inside a rectangle untilnoClip(); a turned sprite clips to the rectangle around the turned one.- Parameters:
x- x of its centrey- y of its centrewidth- its widthheight- its height
-
noClip
public void noClip()Draws everywhere again.
-