PixelWindow

introprog.PixelWindow
See thePixelWindow companion object
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. Y-coordinates are increasing downwards.

Value parameters

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

Attributes

Constructor

Create a new window for pixel-based drawing.

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

Members list

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.

Attributes

Source
PixelWindow.scala
def clear(): Unit

Clear all pixels using the background class parameter.

Clear all pixels using the background class parameter.

Attributes

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.

Attributes

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.

Attributes

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

Draw img at (x, y) unscaled.

Draw img at (x, y) unscaled.

Attributes

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.

Attributes

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`.

Attributes

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.

Attributes

Source
PixelWindow.scala

Return image of PixelWindow.

Return image of PixelWindow.

Attributes

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).

Attributes

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.

Attributes

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.

Attributes

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.

Attributes

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

Attributes

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.

Attributes

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.

Attributes

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.

Attributes

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.

Attributes

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

Set window position on screen

Set window position on screen

Attributes

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

Set the PixelWindow frame title.

Set the PixelWindow frame title.

Attributes

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.

Attributes

Source
PixelWindow.scala

Concrete fields

val background: Color

Attributes

Source
PixelWindow.scala
val foreground: Color

Attributes

Source
PixelWindow.scala
val height: Int

Attributes

Source
PixelWindow.scala
val title: String

Attributes

Source
PixelWindow.scala
val width: Int

Attributes

Source
PixelWindow.scala