Layer class abstract

Below is Tiled's documentation about how this structure is represented on XML files:

All

  • id: Unique ID of the layer. Each layer that added to a map gets a unique id. Even if a layer is deleted, no layer ever gets the same ID. Can not be changed in Tiled. (since Tiled 1.2)
  • name: The name of the layer. (defaults to “”)
  • x: The x coordinate of the layer in tiles. Defaults to 0 and can not be changed in Tiled.
  • y: The y coordinate of the layer in tiles. Defaults to 0 and can not be changed in Tiled.
  • width: The width of the layer in tiles. Always the same as the map width for fixed-size maps.
  • height: The height of the layer in tiles. Always the same as the map height for fixed-size maps.
  • opacity: The opacity of the layer as a value from 0 to 1. Defaults to 1.
  • visible: Whether the layer is shown (1) or hidden (0). Defaults to 1.
  • tintcolor: A tint color that is multiplied with any tiles drawn by this layer in #AARRGGBB or #RRGGBB format (optional).
  • offsetx: Horizontal offset for this layer in pixels. Defaults to 0. (since 0.14)
  • offsety: Vertical offset for this layer in pixels. Defaults to 0. (since 0.14)
  • parallaxx: Horizontal parallax factor for this layer. Defaults to 1. (since 1.5)
  • parallaxy: Vertical parallax factor for this layer. Defaults to 1. (since 1.5)

Can contain at most one:

Implementers

Constructors

Layer({int? id, required String name, required LayerType type, String? class_, int x = 0, int y = 0, double offsetX = 0, double offsetY = 0, double parallaxX = 1, double parallaxY = 1, int? startX, int? startY, String? tintColorHex, Color? tintColor, double opacity = 1, bool visible = true, CustomProperties properties = CustomProperties.empty})

Properties

class_ String?
The "Class" specified in Tiled, introduced in Tiled 1.9 to support custom types on any object. This is NOT the same as type
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
id int?
Incremental ID - unique across all layers
getter/setter pair
name String
Name assigned to this layer. Always present; might be an empty string.
getter/setter pair
offsetX double
Horizontal layer offset in pixels (default: 0)
getter/setter pair
offsetY double
Vertical layer offset in pixels (default: 0)
getter/setter pair
opacity double
The opacity of the layer as a value from 0 to 1. Defaults to 1.
getter/setter pair
parallaxX double
Horizontal parallax factor for this layer (default: 1). (since Tiled 1.5) See: https://doc.mapeditor.org/en/stable/manual/layers/#parallax-factor
getter/setter pair
parallaxY double
Vertical parallax factor for this layer (default: 1). (since Tiled 1.5) See: https://doc.mapeditor.org/en/stable/manual/layers/#parallax-factor
getter/setter pair
properties CustomProperties
List of Property.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
startX int?
X coordinate where layer content starts (for infinite maps)
getter/setter pair
startY int?
Y coordinate where layer content starts (for infinite maps)
getter/setter pair
tintColor Color?
Color that is multiplied with any graphics drawn by this layer or any child layers (optional).
getter/setter pair
tintColorHex String?
Hex-formatted tint color (#RRGGBB or #AARRGGBB) that is multiplied with any graphics drawn by this layer or any child layers (optional).
getter/setter pair
type LayerType
Each type is associated with a concrete implementation of Layer.
getter/setter pair
visible bool
Whether layer is shown or hidden in editor.
getter/setter pair
x int
Horizontal layer offset in tiles. Always 0.
getter/setter pair
y int
Vertical layer offset in tiles. Always 0.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

parse(Parser parser) Layer
parseLayerData(Parser parser, FileEncoding encoding, Compression? compression) List<int>?
parseLayers(Parser parser) List<Layer>