LowLevelCanvas

trait LowLevelCanvas extends Canvas with AutoCloseable

A low-level version of a canvas that provides its own canvas manager.

Companion:
object
trait AutoCloseable
trait Canvas
trait Surface
class Object
trait Matchable
class Any

Value members

Concrete methods

def close(): Unit

Destroys the canvas window.

Destroys the canvas window.

Calling any operation on this canvas after calling close without calling init() has an undefined behavior.

def init(settings: Settings): Unit

Creates the canvas window.

Creates the canvas window.

Rendering operations can only be called after calling this.

Returns:

canvas object linked to the created window

Checks if the window is created or if it has been destroyed

Checks if the window is created or if it has been destroyed

Inherited methods

def blit(that: Surface, mask: Option[Color])(x: Int, y: Int, cx: Int, cy: Int, cw: Int, ch: Int): Unit

Draws a surface on top of this surface.

Draws a surface on top of this surface.

Value parameters:
ch

clip height of the source surface

cw

clip width of the source surface

cx

leftmost pixel on the source surface

cy

topmost pixel on the source surface

mask

color to use as a mask (pixels with this color won't be merged)

that

surface to draw

x

leftmost pixel on the destination surface

y

topmost pixel on the destination surface

Inherited from:
MutableSurface
def changeSettings(newSettings: Settings): Unit

Changes the settings applied to this canvas.

Changes the settings applied to this canvas.

Value parameters:
newSettings

new canvas settings

Inherited from:
Canvas
def clear(buffers: Set[Buffer]): Unit

Clears buffers, such as the backbuffer and keyboard inputs.

Clears buffers, such as the backbuffer and keyboard inputs.

Value parameters:
buffers

set of Canvas.Buffers to be cleared

Inherited from:
Canvas
def fill(color: Color): Unit

Fill the surface with a certain color

Fill the surface with a certain color

Value parameters:
color

Color to fill the surface with

Inherited from:
MutableSurface

Gets the current keyboard input.

Gets the current keyboard input.

Returns:

current keyboard input

Inherited from:
Canvas
def getPixel(x: Int, y: Int): Option[Color]

Gets the color from the this surface. This operation can be perfomance intensive, so it might be worthwile to either use getPixels to fetch multiple pixels at the same time or to implement this operation on the application code.

Gets the color from the this surface. This operation can be perfomance intensive, so it might be worthwile to either use getPixels to fetch multiple pixels at the same time or to implement this operation on the application code.

Value parameters:
x

pixel x position

y

pixel y position

Returns:

pixel color

Inherited from:
Surface

Returns the pixels from this surface. This operation can be perfomance intensive, so it might be worthwile to implement this operation on the application code.

Returns the pixels from this surface. This operation can be perfomance intensive, so it might be worthwile to implement this operation on the application code.

Returns:

color matrix

Inherited from:
Surface

Gets the current pointer input.

Gets the current pointer input.

Returns:

current pointer input

Inherited from:
Canvas
def height: Int
Inherited from:
Canvas
def putPixel(x: Int, y: Int, color: Color): Unit

Put a pixel in the surface with a certain color.

Put a pixel in the surface with a certain color.

Value parameters:
color

Color to apply to the pixel

x

pixel x position

y

pixel y position

Inherited from:
MutableSurface
def redraw(): Unit

Flips buffers and redraws the screen.

Flips buffers and redraws the screen.

Inherited from:
Canvas

Copies this surface into a new surface stored in RAM

Copies this surface into a new surface stored in RAM

Inherited from:
Surface

Gets the color from the this surface in an unsafe way.

Gets the color from the this surface in an unsafe way.

This operation is unsafe: reading a out of bounds pixel has undefined behavior. You should only use this if the performance of getPixel and getPixels are not acceptable.

Value parameters:
x

pixel x position

y

pixel y position

Returns:

pixel color

Inherited from:
Surface

Returns a view over this surface.

Returns a view over this surface.

Operations performed on a view are executed in a defered fashion.

Inherited from:
Surface
def width: Int
Inherited from:
Canvas

Deprecated and Inherited methods

@deprecated("Use blit instead")
def blitWithMask(that: Surface, mask: Color)(x: Int, y: Int, cx: Int, cy: Int, cw: Int, ch: Int): Unit

Draws a surface on top of this surface and masks the pixels with a certain color.

Draws a surface on top of this surface and masks the pixels with a certain color.

Value parameters:
ch

clip height of the source surface

cw

clip width of the source surface

cx

leftmost pixel on the source surface

cy

topmost pixel on the source surface

mask

color to usa as a mask

that

surface to draw

x

leftmost pixel on the destination surface

y

topmost pixel on the destination surface

Deprecated
Inherited from:
MutableSurface