SurfaceView

final case class SurfaceView(plane: Plane, width: Int, height: Int) extends Surface

A view over a surface, stored as a plane limited by a width and height. Allows lazy operations to be applied over a surface.

This can have a performance impact. However, a new RAM surface with the operations already applied can be constructed using toRamSurface

Companion:
object
trait Serializable
trait Product
trait Equals
trait Surface
class Object
trait Matchable
class Any

Value members

Concrete methods

def clip(cx: Int, cy: Int, cw: Int, ch: Int): SurfaceView

Clips this view to a chosen rectangle

Clips this view to a chosen rectangle

Value parameters:
ch

clip height

cw

clip width

cx

leftmost pixel on the surface

cy

topmost pixel on the surface

def contramap(f: (Int, Int) => (Int, Int)): Plane

Contramaps the positions from this surface view.

Contramaps the positions from this surface view.

def flatMap(f: Color => (Int, Int) => Color): SurfaceView

Flatmaps the inner plane of this surface view

Flatmaps the inner plane of this surface view

Flips a surface horizontally.

Flips a surface horizontally.

Flips an surface vertically.

Flips an surface vertically.

Inverts a surface color.

Inverts a surface color.

Maps the colors from this surface view.

Maps the colors from this surface view.

Transposes a surface.

Transposes a surface.

override def view: SurfaceView
Definition Classes
def zipWith(that: Surface, f: (Color, Color) => Color): SurfaceView

Combines this view with a surface by combining their colors with the given function.

Combines this view with a surface by combining their colors with the given function.

def zipWith(that: Plane, f: (Color, Color) => Color): SurfaceView

Combines this view with a plane by combining their colors with the given function.

Combines this view with a plane by combining their colors with the given function.

Inherited methods

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
Inherited from:
Product

Copies this surface into a new surface stored in RAM

Copies this surface into a new surface stored in RAM

Inherited from:
Surface