Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Pixel

[16:7] extends: FxObj

Wraps FXGL's Pixel data class (defined in com.almasb.fxgl.texture.Images.kt), returned by Texture.pixels(). Each Pixel records its (x, y) coordinate, its JavaFX Color, and the parent Image it was sampled from. Read-only — used for per-pixel scripting on a texture's pixel grid.

Methods

  • Pixel ()

    Empty default constructor; populated by adopt.

  • adopt (object Ajo)

    Wraps an existing Pixel AussomJavaObject.

    • @p Ajo is an AussomJavaObject around a Pixel.
    • @r A new wrapper.
  • getX ()

    Returns the X coordinate.

  • getY ()

    Returns the Y coordinate.

  • getColor ()

    Returns the JavaFX Color AJO at this pixel.

  • getParent ()

    Returns the parent Image AJO.

  • getA ()

    Returns the alpha channel as a 0..1 double.

  • getR ()

    Returns the red channel as a 0..1 double.

  • getG ()

    Returns the green channel as a 0..1 double.

  • getB ()

    Returns the blue channel as a 0..1 double.

  • copyWithColor (object ColorObj)

    Returns a copy of this Pixel with the color replaced. The original is left unchanged.

    • @p ColorObj is a Color wrapper.
    • @r A new Pixel wrapper.