PixelWindow

class PixelWindow(val width: Int, val height: Int, val title: String, val background: Color, val foreground: Color)

A window with a canvas for pixel-based drawing.

Value Params
background

the color used when clearing pixels

foreground

the foreground color, default color in drawing operations

height

number of vertical pixels

title

the title of the window

width

the number of horizontal pixels

Constructor

Create a new window for pixel-based drawing.

Companion
object
Source
PixelWindow.scala
class Object
trait Matchable
class Any

Value members

Concrete methods

def awaitEvent(timeoutInMillis: Long): Unit

Wait for next event until timeoutInMillis milliseconds.

Wait for next event until timeoutInMillis milliseconds.

If time is out, lastEventType is Undefined.

Source
PixelWindow.scala
def clear(): Unit

Clear all pixels using the background class parameter.

Clear all pixels using the background class parameter.

Source
PixelWindow.scala
def clearPixel(x: Int, y: Int): Unit

Clear the pixel at (x, y) using the background class parameter.

Clear the pixel at (x, y) using the background class parameter.

If (x, y) is outside of window bounds then an IllegalArgumentException is thrown.

Source
PixelWindow.scala
def drawImage(img: Image, x: Int, y: Int, width: Int, height: Int, angle: Double): Unit

Draw img at (x, y) scaled to (width, height) and rotated (angle) radians clockwise.

Draw img at (x, y) scaled to (width, height) and rotated (angle) radians clockwise.

If angle is 0 then no rotation is applied.

Source
PixelWindow.scala
def drawImage(img: Image, x: Int, y: Int): Unit

Draw img at (x, y) unscaled.

Draw img at (x, y) unscaled.

Source
PixelWindow.scala
def drawMatrix(matrix: Array[Array[Color]], x: Int, y: Int): Unit

Draw matrix at (x, y) unscaled.

Draw matrix at (x, y) unscaled.

Source
PixelWindow.scala
def drawText(text: String, x: Int, y: Int, color: Color, size: Int, style: Int, fontName: String): Unit

Draw text at (x, y) using color, size, style andfontName`.

Draw text at (x, y) using color, size, style andfontName`.

Source
PixelWindow.scala
def fill(x: Int, y: Int, width: Int, height: Int, color: Color): Unit

Fill a rectangle with upper left corner at (x, y) using color.

Fill a rectangle with upper left corner at (x, y) using color.

Source
PixelWindow.scala

Return image of PixelWindow.

Return image of PixelWindow.

Source
PixelWindow.scala
def getImage(x: Int, y: Int, width: Int, height: Int): Image

Return image of PixelWindow section defined by top left corner (x, y) and (width, height).

Return image of PixelWindow section defined by top left corner (x, y) and (width, height).

Source
PixelWindow.scala
def getPixel(x: Int, y: Int): Color

Return the color of the pixel at (x, y).

Return the color of the pixel at (x, y).

If (x, y) is outside of window bounds then an IllegalArgumentException is thrown.

Source
PixelWindow.scala
def hide(): Unit

Hide the window. Has no effect if the window is already hidden.

Hide the window. Has no effect if the window is already hidden.

Source
PixelWindow.scala
def isInside(x: Int, y: Int): Boolean

Return true if (x, y) is inside windows borders else false.

Return true if (x, y) is inside windows borders else false.

Source
PixelWindow.scala
def lastEventType: Int

The event type of the latest event in the event queue.

The event type of the latest event in the event queue.

Returns Event.Undefined if no event has occurred. See also introprog.PixelWindow.awaitEvent

Source
PixelWindow.scala
def lastKey: String

A string representing the last key pressed.

A string representing the last key pressed.

Returns an empty string if no key event has occurred.

Source
PixelWindow.scala
def lastMousePos: (Int, Int)

A pair of integers with the coordinates of the last mouse event.

A pair of integers with the coordinates of the last mouse event.

Returns (-1, -1) if no mouse event has occurred.

Source
PixelWindow.scala
def line(x1: Int, y1: Int, x2: Int, y2: Int, color: Color, lineWidth: Int): Unit

Draw a line from (x1, y1) to (x2, y2) using color and lineWidth.

Draw a line from (x1, y1) to (x2, y2) using color and lineWidth.

Source
PixelWindow.scala
def setPixel(x: Int, y: Int, color: Color): Unit

Set the color of the pixel at (x, y).

Set the color of the pixel at (x, y).

If (x, y) is outside of window bounds then an IllegalArgumentException is thrown.

Source
PixelWindow.scala
def setPosition(x: Int, y: Int): Unit

Set window position on screen

Set window position on screen

Source
PixelWindow.scala
def setTitle(title: String): Unit

Set the PixelWindow frame title.

Set the PixelWindow frame title.

Source
PixelWindow.scala
def show(): Unit

Show the window. Has no effect if the window is already visible.

Show the window. Has no effect if the window is already visible.

Source
PixelWindow.scala

Concrete fields

val background: Color
val foreground: Color
val height: Int
val title: String
val width: Int