SurfaceView

eu.joaocosta.minart.graphics.SurfaceView
See theSurfaceView companion object
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

Attributes

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

Members list

Concise view

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

Attributes

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.

Attributes

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

Flatmaps the inner plane of this surface view

Flatmaps the inner plane of this surface view

Attributes

Flips a surface horizontally.

Flips a surface horizontally.

Attributes

Flips a surface vertically.

Flips a surface vertically.

Attributes

Inverts a surface color.

Inverts a surface color.

Attributes

Maps the colors from this surface view.

Maps the colors from this surface view.

Attributes

Scales a surface.

Scales a surface.

Attributes

Scales a surface.

Scales a surface.

Attributes

Transposes a surface.

Transposes a surface.

Attributes

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

override 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

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.

Attributes

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.

Attributes

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.

Attributes

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.

Attributes

Returns:

color matrix

Inherited from:
Surface

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product

Copies this surface into a new surface stored in RAM.

Copies this surface into a new surface stored in RAM.

Attributes

Inherited from:
Surface