A view over a surface. 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
Members list
Value members
Abstract methods
Returns a plane that clamps this surface when out of bounds
Returns a plane that clamps this surface when out of bounds
Attributes
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
Attributes
Coflatmaps this plane with a SurfaceView => Color function. Effectively, each pixel of the new view is computed from a translated view, which can be used to implement convolutions.
Coflatmaps this plane with a SurfaceView => Color function. Effectively, each pixel of the new view is computed from a translated view, which can be used to implement convolutions.
Attributes
Contramaps the positions from this surface view.
Contramaps the positions from this surface view.
Attributes
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
Maps the colors from this surface view.
Maps the colors from this surface view.
Attributes
Overlays a surface on top of this view.
Overlays a surface on top of this view.
Similar to MutableSurface#blit, but for surface views.
Value parameters
- blendMode
-
blend strategy to use
- that
-
surface to overlay
- x
-
leftmost pixel on the destination plane
- y
-
topmost pixel on the destination plane
Attributes
Returns a plane that repeats this surface forever
Returns a plane that repeats this surface forever
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.
Value parameters
- x
-
pixel x position
- y
-
pixel y position
Attributes
- Returns
-
pixel color
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
Concrete methods
Inverts a surface color.
Inverts a surface color.
Attributes
Forces the surface to be computed and returns a new view. Equivalent to toRamSurface().view
.
Forces the surface to be computed and returns a new view. Equivalent to toRamSurface().view
.
This can be particularly useful to force the computation before a heavy coflatMap (e.g. a convolution with a large kernel) to avoid recomputing the same pixel multiple times.
Attributes
Premultiplies the color channels with the alpha channel.
Premultiplies the color channels with the alpha channel.
If this surface is going to be used multiple times, it is usually recommended to store this as a temporary surface instead of using a surface view.
Attributes
Repeats this surface xTimes on the x axis and yTimes on the yAxis
Repeats this surface xTimes on the x axis and yTimes on the yAxis
Attributes
Scales a surface.
Scales a surface.
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
- Definition Classes
Inherited methods
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
- Inherited from:
- Surface
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
- 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
Copies this surface into a new surface stored in RAM.