Bitmap

smile.pictures.Bitmap
See theBitmap companion class
object Bitmap

Builds bitmaps. A bitmap of pixels is centered at the origin with its anchor there, in the middle of its pixels, and a bitmap of a picture covers the whole pixels the picture's bounds touch, anchored where the picture is.

Attributes

Companion
class
Source
Element.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Bitmap.type

Members list

Value members

Concrete methods

def apply(width: Int, height: Int, generator: (Int, Int) => Color): Bitmap

A bitmap of width by height pixels whose colors generator gives by column and row.

A bitmap of width by height pixels whose colors generator gives by column and row.

import smile.colors.Color

val plaid = Bitmap(120, 80, (x, y) => Color(x * 2, y * 3, 160))

A bitmap shading from blue to pink and green across its pixels

Attributes

Source
Element.scala
def apply(width: Int, height: Int, colors: Seq[Color]): Bitmap

A bitmap of width by height pixels of colors, row by row from the top.

A bitmap of width by height pixels of colors, row by row from the top.

Attributes

Source
Element.scala
def apply(path: String): Bitmap

A bitmap of the image at the resource path path, which may also be a file path or a URL. In a browser, the image must have been loaded with smile.pictures.Bitmap.load first.

A bitmap of the image at the resource path path, which may also be a file path or a URL. In a browser, the image must have been loaded with smile.pictures.Bitmap.load first.

Attributes

Source
Element.scala
def apply(picture: Element, settings: RenderSettings): Bitmap

A bitmap of picture rendered at once with settings, as toBitmap renders it.

A bitmap of picture rendered at once with settings, as toBitmap renders it.

Attributes

Source
Element.scala

Exports

Defined exports

def fromARGB(width: Int, height: Int, pixels: Array[Int]): Bitmap
Exported from Rasters

A bitmap of packed ARGB pixels in rows from the top. The pixels are copied, so later changes to the array do not affect the bitmap.

A bitmap of packed ARGB pixels in rows from the top. The pixels are copied, so later changes to the array do not affect the bitmap.

Attributes

Throws
IllegalArgumentException

if a dimension is not positive, their product does not fit in an Int, or there are not exactly width * height pixels

Source
Rasters.scala
def generateARGB(width: Int, height: Int, generator: (Int, Int) => Int): Bitmap
Exported from Rasters

A bitmap of packed ARGB pixels that generator gives by column and row, called once per pixel, from left to right in each row, top row first. No Color is made per pixel.

A bitmap of packed ARGB pixels that generator gives by column and row, called once per pixel, from left to right in each row, top row first. No Color is made per pixel.

Attributes

Throws
IllegalArgumentException

if a dimension is not positive or their product does not fit in an Int

Source
Rasters.scala
def load(path: String): Future[Bitmap]
Exported from Rasters

Loads the image at path asynchronously, on every platform. In a browser it is the only way to load an image the first time, because decoding there is asynchronous, and afterwards the synchronous apply serves the same path.

Loads the image at path asynchronously, on every platform. In a browser it is the only way to load an image the first time, because decoding there is asynchronous, and afterwards the synchronous apply serves the same path.

Attributes

Source
Rasters.scala
def of(source: PixelSource): Bitmap
Exported from Rasters

A bitmap of source where source lies, anchored in the middle of its pixels.

A bitmap of source where source lies, anchored in the middle of its pixels.

Attributes

Source
Rasters.scala
def of(picture: Element): Bitmap
Exported from Rasters

A bitmap of picture, rendered only when its pixels are asked for, with the settings of the output that asks. A Direct output renders the picture at its own scale, so it stays sharp. The bitmap covers the whole pixels the picture's bounds touch, and its anchor is where the picture's anchor is.

A bitmap of picture, rendered only when its pixels are asked for, with the settings of the output that asks. A Direct output renders the picture at its own scale, so it stays sharp. The bitmap covers the whole pixels the picture's bounds touch, and its anchor is where the picture's anchor is.

Attributes

Source
Rasters.scala