HtmlCanvas

eu.joaocosta.minart.backend.HtmlCanvas
class HtmlCanvas(parentNode: => Node) extends SurfaceBackedCanvas

A low level Canvas implementation that shows the image in an HTML Canvas element.

Attributes

Graph
Supertypes
trait SurfaceBackedCanvas
trait LowLevelCanvas
trait Extended[Settings, ExtendedSettings]
trait LowLevelSubsystem[Settings]
trait AutoCloseable
trait Canvas
trait MutableSurface
trait Surface
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Constructors

def this(settings: Settings)

Concrete methods

def clear(buffers: Set[Buffer]): Unit

Clears buffers, such as the backbuffer and keyboard inputs.

Clears buffers, such as the backbuffer and keyboard inputs.

Attributes

buffers

set of Canvas.Buffers to be cleared

def getKeyboardInput(): KeyboardInput

Gets the current keyboard input.

Gets the current keyboard input.

Attributes

Returns:

current keyboard input

def getPointerInput(): PointerInput

Gets the current pointer input.

Gets the current pointer input.

Attributes

Returns:

current pointer input

def redraw(): Unit

Flips buffers and redraws the screen.

Flips buffers and redraws the screen.

Attributes

Inherited methods

def ++[SettingsB, SubsystemB <: LowLevelSubsystem[SettingsB]](that: SubsystemB): Composite[Settings, SettingsB, LowLevelSubsystem, SubsystemB]

Composes this subsystem with another subsystem

Composes this subsystem with another subsystem

Attributes

Inherited from:
LowLevelSubsystem
override 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.

Attributes

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

Definition Classes
SurfaceBackedCanvas -> MutableSurface
Inherited from:
SurfaceBackedCanvas
def canvasSettings: Settings

The settings applied to this canvas.

The settings applied to this canvas.

Attributes

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

Changes the settings of the subsystem.

Changes the settings of the subsystem.

Attributes

newSettings

new settings to apply

Inherited from:
Extended
def close(): Unit

Destroys the subsystem.

Destroys the subsystem.

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

Attributes

Inherited from:
Extended
def extendedSettings: ExtendedSettings

Attributes

Inherited from:
Extended
override def fill(color: Color): Unit

Fill the whole surface with a certain color.

Fill the whole surface with a certain color.

Attributes

color

Color to fill the surface with

Definition Classes
SurfaceBackedCanvas -> MutableSurface
Inherited from:
SurfaceBackedCanvas
def fillRegion(x: Int, y: Int, w: Int, h: Int, color: Color): Unit

Fill part of the surface with a certain color.

Fill part of the surface with a certain color.

Attributes

color

Color to fill the surface with

h

region height

w

region width

x

leftmost pixel on the destination surface

y

topmost pixel on the destination surface

Inherited from:
SurfaceBackedCanvas
final 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.

Attributes

x

pixel x position

y

pixel y position

Returns:

pixel color

Inherited from:
Surface
final def getPixelOrElse(x: Int, y: Int, fallback: Color): Color

Gets the color from the this surface, falling back to a default color when out of bounds. Similar to getPixel(x, y).getOrElse(fallback), but avoids an allocation.

Gets the color from the this surface, falling back to a default color when out of bounds. Similar to getPixel(x, y).getOrElse(fallback), but avoids an allocation.

Attributes

fallback

fallback color

x

pixel x position

y

pixel y position

Returns:

pixel color

Inherited from:
Surface
override def getPixels(): Vector[Array[Color]]

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.

Attributes

Returns:

color matrix

Definition Classes
SurfaceBackedCanvas -> Surface
Inherited from:
SurfaceBackedCanvas
def height: Int

The surface height.

The surface height.

Attributes

Inherited from:
Canvas
def init(settings: Settings): Extended.this.type

Creates the subsystem.

Creates the subsystem.

Operations can only be called after calling this.

Attributes

settings

settings used to configure the subsystem

Returns:

this subsystem

Inherited from:
Extended

Checks if the subsystem is created or if it has been destroyed.

Checks if the subsystem is created or if it has been destroyed.

Attributes

Inherited from:
Extended
final 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.

Attributes

color

Color to apply to the pixel

x

pixel x position

y

pixel y position

Inherited from:
MutableSurface
def settings: Settings

Returns the current settings.

Returns the current settings.

Attributes

Inherited from:
Extended
final def toRamSurface(): RamSurface

Copies this surface into a new surface stored in RAM.

Copies this surface into a new surface stored in RAM.

Attributes

Inherited from:
Surface
def unsafeGetPixel(x: Int, y: Int): Color

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.

Attributes

x

pixel x position

y

pixel y position

Returns:

pixel color

Inherited from:
SurfaceBackedCanvas
def unsafePutPixel(x: Int, y: Int, color: Color): Unit

Puts a pixel in the surface in an unsafe way.

Puts a pixel in the surface in an unsafe way.

This operation is unsafe: writing a out of bounds pixel has undefined behavior. You should only use this if the performance of putPixel is not acceptable.

Attributes

x

pixel x position

y

pixel y position

Returns:

pixel color

Inherited from:
SurfaceBackedCanvas
def view: SurfaceView

Returns a view over this surface.

Returns a view over this surface.

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

Attributes

Inherited from:
Surface
def width: Int

The surface width.

The surface width.

Attributes

Inherited from:
Canvas

Inherited fields

protected var _extendedSettings: ExtendedSettings

Attributes

Inherited from:
Extended