Class

com.sksamuel.scrimage

AwtImage

Related Doc: package scrimage

Permalink

class AwtImage extends AnyRef

Read only operations on a BufferedImage. You can think of this as a pimped-immutable-BufferedImage. None of the operations in this class will mutate the underlying awt buffer.

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AwtImage
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new AwtImage(awt: BufferedImage)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def argb: Array[Array[Int]]

    Permalink

    Returns the ARGB components for all pixels in this image

    Returns the ARGB components for all pixels in this image

    returns

    an array containing ARGB components in that order.

  5. def argb(x: Int, y: Int): Array[Int]

    Permalink

    Returns the ARGB components for the pixel at the given coordinates

    Returns the ARGB components for the pixel at the given coordinates

    x

    the x coordinate of the pixel component to grab

    y

    the y coordinate of the pixel component to grab

    returns

    an array containing ARGB components in that order.

  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. val awt: BufferedImage

    Permalink
  8. lazy val center: (Int, Int)

    Permalink

    The centre coordinates for the image as an (x, y) tuple.

  9. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. def col(x: Int): Array[Pixel]

    Permalink

    returns

    the pixels for the column identified by the x co-ordinate. 0 indexed.

  11. def color(x: Int, y: Int): RGBColor

    Permalink

    Returns the color at the given coordinates.

    Returns the color at the given coordinates.

    returns

    the RGBColor value at the coords

  12. def colours: Set[RGBColor]

    Permalink

    Returns a set of the distinct colours used in this image.

    Returns a set of the distinct colours used in this image.

    returns

    the set of distinct Colors

  13. def contains(color: Color): Boolean

    Permalink

    Returns true if a pixel with the given color exists

    Returns true if a pixel with the given color exists

    color

    the pixel colour to look for.

    returns

    true if there exists at least one pixel that has the given pixels color

  14. def count(p: (Pixel) ⇒ Boolean): Int

    Permalink

    Counts the number of pixels that are true for the given predicate

    Counts the number of pixels that are true for the given predicate

    p

    a predicate

    returns

    the number of pixels that evaluated true

  15. def count(color: Color): Int

    Permalink

    Counts the number of pixels with the given colour.

    Counts the number of pixels with the given colour.

    color

    the colour to detect.

    returns

    the number of pixels that matched the colour of the given pixel

  16. lazy val count: Int

    Permalink

    Returns the number of pixels in the image.

    Returns the number of pixels in the image.

    returns

    the number of pixels

  17. lazy val dimensions: (Int, Int)

    Permalink

    A tuple of the (width, height)

  18. def empty: AwtImage

    Permalink

    Returns a new AWT BufferedImage with the same dimensions and same AWT type.

    Returns a new AWT BufferedImage with the same dimensions and same AWT type. The data is uninitialized.

  19. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  20. def equals(other: Any): Boolean

    Permalink
    Definition Classes
    AwtImage → AnyRef → Any
  21. def exists(p: (Pixel) ⇒ Boolean): Boolean

    Permalink

    Returns true if the predicate is true for at least one pixel on the image.

    Returns true if the predicate is true for at least one pixel on the image.

    p

    a predicate

    returns

    true if p holds for at least one pixel

  22. def fastScaleAwt(targetWidth: Int, targetHeight: Int): BufferedImage

    Permalink

    Returns a new AWT Image scaled using nearest-neighbour.

    Returns a new AWT Image scaled using nearest-neighbour.

    Attributes
    protected[com.sksamuel.scrimage]
  23. def fastScaleScrimage(targetWidth: Int, targetHeight: Int): BufferedImage

    Permalink
    Attributes
    protected[com.sksamuel.scrimage]
  24. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  25. def forall(f: (Int, Int, Pixel) ⇒ Boolean): Boolean

    Permalink

    Returns true if the predicate is true for all pixels in the image.

    Returns true if the predicate is true for all pixels in the image.

    f

    a predicate function that accepts 3 parameters - the x,y coordinate and the pixel at that coordinate

    returns

    true if f holds for at least one pixel

  26. def foreach(f: (Int, Int, Pixel) ⇒ Unit): Unit

    Permalink

    Executes the given side effecting function on each pixel.

    Executes the given side effecting function on each pixel.

    f

    a function that accepts 3 parameters - the x,y coordinate and the pixel at that coordinate

  27. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  28. def hashCode(): Int

    Permalink
    Definition Classes
    AwtImage → AnyRef → Any
  29. lazy val height: Int

    Permalink
  30. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  31. def iterator: Iterator[Pixel]

    Permalink

    Returns the pixels of the image as an iterator.

    Returns the pixels of the image as an iterator. The iterator is the most efficient way to lazily iterator over the pixels as the pixels will only be fetched from the raster as needed.

    returns

    the iterator

  32. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  33. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  34. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  35. def offset(x: Int, y: Int): Int

    Permalink
  36. def patch(x: Int, y: Int, patchWidth: Int, patchHeight: Int): Array[Pixel]

    Permalink
  37. def patches(patchWidth: Int, patchHeight: Int): IndexedSeq[() ⇒ Array[Pixel]]

    Permalink

    Returns all the patches of a given size in the image, assuming pixel alignment (no subpixel extraction).

    Returns all the patches of a given size in the image, assuming pixel alignment (no subpixel extraction).

    The patches are returned as a sequence of pixel matrices closures

  38. def pixel(p: (Int, Int)): Pixel

    Permalink

    Returns the pixel at the given coordinate.

    Returns the pixel at the given coordinate.

    p

    the pixel as an integer tuple

    returns

    the pixel

  39. def pixel(x: Int, y: Int): Pixel

    Permalink

    Returns the pixel at the given coordinates.

    Returns the pixel at the given coordinates.

    x

    the x coordinate of the pixel to grab

    y

    the y coordinate of the pixel to grab

    returns

    the Pixel at the location

  40. def pixels(x: Int, y: Int, w: Int, h: Int): Array[Pixel]

    Permalink

    Returns a rectangular region within the given boundaries as a single dimensional array of integers.

    Returns a rectangular region within the given boundaries as a single dimensional array of integers.

    Eg, pixels(10, 10, 30, 20) would result in an array of size 600 with the first row of the region in indexes 0,..,29, second row 30,..,59 etc.

    x

    the start x coordinate

    y

    the start y coordinate

    w

    the width of the region

    h

    the height of the region

    returns

    an Array of pixels for the region

  41. def pixels: Array[Pixel]

    Permalink

    Returns all the pixels for the image

    Returns all the pixels for the image

    returns

    an array of pixels for this image

  42. lazy val points: Seq[(Int, Int)]

    Permalink
  43. lazy val radius: Int

    Permalink

    The radius of the image defined as the centre to the corners.

  44. lazy val ratio: Double

    Permalink

    returns

    Returns the aspect ratio for this image.

  45. def rgb: Array[Array[Int]]

    Permalink
  46. def rgb(x: Int, y: Int): Array[Int]

    Permalink
  47. def rotate(angle: Double): BufferedImage

    Permalink

    Returns a new AWT Image rotated with the given angle (in degrees)

    Returns a new AWT Image rotated with the given angle (in degrees)

    Attributes
    protected[com.sksamuel.scrimage]
  48. def row(y: Int): Array[Pixel]

    Permalink

    returns

    the pixels in the row identified by the y coordinate. 0 indexed.

  49. def scale(targetWidth: Int, targetHeight: Int, scale: Scale): BufferedImage

    Permalink
    Attributes
    protected[com.sksamuel.scrimage]
  50. def subpixel(x: Double, y: Double): Int

    Permalink

    Uses linear interpolation to get a sub-pixel.

    Uses linear interpolation to get a sub-pixel.

    Legal values for x and y are in [0, width) and [0, height), respectively.

  51. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  52. def toNewBufferedImage(type: Int = awt.getType): BufferedImage

    Permalink

    Returns a new AWT BufferedImage from this image.

    Returns a new AWT BufferedImage from this image.

    type

    the type of buffered image to create, if not specified then defaults to the current image type

    returns

    a new, non-shared, BufferedImage with the same data as this Image.

  53. def toString(): String

    Permalink
    Definition Classes
    AwtImage → AnyRef → Any
  54. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  55. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  56. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  57. lazy val width: Int

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped