Class Layer
Represents a layer in a Profile
Inherited Members
Namespace: Artemis.Core
Assembly: Artemis.Core.dll
Syntax
public sealed class Layer : RenderProfileElement, IBreakableModel, IDisposable
Constructors
Layer(Profile, ProfileElement, LayerEntity, bool)
Creates a new instance of the Layer class based on the provided layer entity
Declaration
public Layer(Profile profile, ProfileElement parent, LayerEntity layerEntity, bool loadNodeScript = false)
Parameters
Type | Name | Description |
---|---|---|
Profile | profile | The profile the layer belongs to |
ProfileElement | parent | The parent of the layer |
LayerEntity | layerEntity | The entity of the layer |
bool | loadNodeScript | A boolean indicating whether or not to attempt to load the node script straight away |
Layer(ProfileElement, string)
Creates a new instance of the Layer class and adds itself to the child collection of the provided
parent
Declaration
public Layer(ProfileElement parent, string name)
Parameters
Type | Name | Description |
---|---|---|
ProfileElement | parent | The parent of the layer |
string | name | The name of the layer |
Properties
Adapter
Gets the layer adapter that can be used to adapt this layer to a different set of devices
Declaration
public LayerAdapter Adapter { get; }
Property Value
Type | Description |
---|---|
LayerAdapter |
General
Gets the general properties of the layer
Declaration
[PropertyGroupDescription(Identifier = "General", Name = "General", Description = "A collection of general properties")]
public LayerGeneralProperties General { get; }
Property Value
Type | Description |
---|---|
LayerGeneralProperties |
LayerBrush
The brush that will fill the LayerShape.
Declaration
public BaseLayerBrush? LayerBrush { get; }
Property Value
Type | Description |
---|---|
BaseLayerBrush |
LayerEntity
Gets the layer entity this layer uses for persistent storage
Declaration
public LayerEntity LayerEntity { get; }
Property Value
Type | Description |
---|---|
LayerEntity |
LayerShape
Defines the shape that is rendered by the LayerBrush.
Declaration
public LayerShape? LayerShape { get; set; }
Property Value
Type | Description |
---|---|
LayerShape |
Leds
A collection of all the LEDs this layer is assigned to.
Declaration
public ReadOnlyCollection<ArtemisLed> Leds { get; }
Property Value
Type | Description |
---|---|
ReadOnlyCollection<ArtemisLed> |
ShouldBeEnabled
Gets a boolean indicating whether this render element and its layers/brushes should be enabled
Declaration
public override bool ShouldBeEnabled { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
Transform
Gets the transform properties of the layer
Declaration
[PropertyGroupDescription(Identifier = "Transform", Name = "Transform", Description = "A collection of transformation properties")]
public LayerTransformProperties Transform { get; }
Property Value
Type | Description |
---|---|
LayerTransformProperties |
Methods
AddLed(ArtemisLed)
Adds a new ArtemisLed to the layer and updates the render properties.
Declaration
public void AddLed(ArtemisLed led)
Parameters
Type | Name | Description |
---|---|---|
ArtemisLed | led | The LED to add |
AddLeds(IEnumerable<ArtemisLed>)
Adds a collection of new ArtemisLeds to the layer and updates the render properties.
Declaration
public void AddLeds(IEnumerable<ArtemisLed> leds)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<ArtemisLed> | leds | The LEDs to add |
ChangeLayerBrush(BaseLayerBrush)
Changes the current layer brush to the provided layer brush and activates it
Declaration
public void ChangeLayerBrush(BaseLayerBrush layerBrush)
Parameters
Type | Name | Description |
---|---|---|
BaseLayerBrush | layerBrush |
ClearLeds()
Removes all ArtemisLeds from the layer and updates the render properties.
Declaration
public void ClearLeds()
CreateRenderCopy(int)
Creates a copy of this layer and renders it alongside this layer for as long as its timeline lasts.
Declaration
public void CreateRenderCopy(int max)
Parameters
Type | Name | Description |
---|---|---|
int | max | The total maximum of render copies to keep |
Disable()
Enables the render element and its brushes and effects
Declaration
public override void Disable()
Overrides
Dispose(bool)
Disposes the profile element
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing |
Overrides
Enable()
Disables the render element and its brushes and effects
Declaration
public override void Enable()
Overrides
GetAllLayerProperties()
Creates a list of all layer properties present on this render element
Declaration
public override List<ILayerProperty> GetAllLayerProperties()
Returns
Type | Description |
---|---|
List<ILayerProperty> | A list of all layer properties present on this render element |
Overrides
GetBrokenHierarchy()
Returns a list containing all broken models, including self and any children
Declaration
public override IEnumerable<IBreakableModel> GetBrokenHierarchy()
Returns
Type | Description |
---|---|
IEnumerable<IBreakableModel> |
Overrides
GetTransformMatrix(bool, bool, bool, bool, SKRect?)
Creates a transformation matrix that applies the current transformation settings
Declaration
public SKMatrix GetTransformMatrix(bool zeroBased, bool includeTranslation, bool includeScale, bool includeRotation, SKRect? customBounds = null)
Parameters
Type | Name | Description |
---|---|---|
bool | zeroBased | If true, treats the layer as if it is located at 0,0 instead of its actual position on the surface |
bool | includeTranslation | Whether translation should be included |
bool | includeScale | Whether the scale should be included |
bool | includeRotation | Whether the rotation should be included |
SKRect? | customBounds | Optional custom bounds to base the anchor on |
Returns
Type | Description |
---|---|
SKMatrix | The transformation matrix containing the current transformation settings |
OverrideTimelineAndApply(TimeSpan)
Overrides the main timeline to the specified time and clears any extra time lines
Declaration
public override void OverrideTimelineAndApply(TimeSpan position)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | position | The position to set the timeline to |
Overrides
RemoveLed(ArtemisLed)
Removes a ArtemisLed from the layer and updates the render properties.
Declaration
public void RemoveLed(ArtemisLed led)
Parameters
Type | Name | Description |
---|---|---|
ArtemisLed | led | The LED to remove |
Render(SKCanvas, SKPointI, ProfileElement?)
Renders the element
Declaration
public override void Render(SKCanvas canvas, SKPointI basePosition, ProfileElement? editorFocus)
Parameters
Type | Name | Description |
---|---|---|
SKCanvas | canvas | The canvas to render upon. |
SKPointI | basePosition | The base position to use to translate relative positions to absolute positions. |
ProfileElement | editorFocus | An optional element to focus on while rendering (other elements will not render). |
Overrides
Reset()
Resets the internal state of the element
Declaration
public override void Reset()
Overrides
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string |
Overrides
Update(double)
Updates the element
Declaration
public override void Update(double deltaTime)
Parameters
Type | Name | Description |
---|---|---|
double | deltaTime |
Overrides
Events
LayerBrushUpdated
Occurs when the layer brush of this layer has been updated
Declaration
public event EventHandler? LayerBrushUpdated
Event Type
Type | Description |
---|---|
EventHandler |
RenderPropertiesUpdated
Occurs when a property affecting the rendering properties of this layer has been updated
Declaration
public event EventHandler? RenderPropertiesUpdated
Event Type
Type | Description |
---|---|
EventHandler |