Surface

eu.joaocosta.minart.graphics.Surface
trait Surface

A Surface is an object that contains a set of pixels.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait Canvas
class RamSurface
trait SurfaceView
Show all

Members list

Value members

Abstract methods

def height: Int

The surface height.

The surface height.

Attributes

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.

Value parameters

x

pixel x position

y

pixel y position

Attributes

Returns

pixel color

def width: Int

The surface width.

The surface width.

Attributes

Concrete methods

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.

Value parameters

x

pixel x position

y

pixel y position

Attributes

Returns

pixel color

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.

Value parameters

fallback

fallback color

x

pixel x position

y

pixel y position

Attributes

Returns

pixel 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

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

Returns a view over this surface.

Returns a view over this surface.

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

Attributes