Class Layer
Represents a layer in a Profile
public sealed class Layer : RenderProfileElement, IBreakableModel, IDisposable, IPluginFeatureDependent
- Inheritance
-
Layer
- Implements
- Inherited Members
- Extension Methods
Constructors
Layer(Profile, ProfileElement, LayerEntity, bool)
Creates a new instance of the Layer class based on the provided layer entity
public Layer(Profile profile, ProfileElement parent, LayerEntity layerEntity, bool loadNodeScript = false)
Parameters
profile
ProfileThe profile the layer belongs to
parent
ProfileElementThe parent of the layer
layerEntity
LayerEntityThe entity of the layer
loadNodeScript
boolA 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
public Layer(ProfileElement parent, string name)
Parameters
parent
ProfileElementThe parent of the layer
name
stringThe name of the layer
Properties
Adapter
Gets the layer adapter that can be used to adapt this layer to a different set of devices
public LayerAdapter Adapter { get; }
Property Value
General
Gets the general properties of the layer
public LayerGeneralProperties General { get; }
Property Value
LayerBrush
The brush that will fill the LayerShape.
public BaseLayerBrush? LayerBrush { get; }
Property Value
LayerEntity
Gets the layer entity this layer uses for persistent storage
public LayerEntity LayerEntity { get; }
Property Value
- LayerEntity
LayerShape
Defines the shape that is rendered by the LayerBrush.
public LayerShape? LayerShape { get; set; }
Property Value
Leds
A collection of all the LEDs this layer is assigned to.
public ReadOnlyCollection<ArtemisLed> Leds { get; }
Property Value
ShouldBeEnabled
Gets a boolean indicating whether this render element and its layers/brushes should be enabled
public override bool ShouldBeEnabled { get; }
Property Value
Transform
Gets the transform properties of the layer
public LayerTransformProperties Transform { get; }
Property Value
Methods
AddLed(ArtemisLed)
Adds a new ArtemisLed to the layer and updates the render properties.
public void AddLed(ArtemisLed led)
Parameters
led
ArtemisLedThe LED to add
AddLeds(IEnumerable<ArtemisLed>)
Adds a collection of new ArtemisLeds to the layer and updates the render properties.
public void AddLeds(IEnumerable<ArtemisLed> leds)
Parameters
leds
IEnumerable<ArtemisLed>The LEDs to add
ChangeLayerBrush(BaseLayerBrush)
Changes the current layer brush to the provided layer brush and activates it
public void ChangeLayerBrush(BaseLayerBrush layerBrush)
Parameters
layerBrush
BaseLayerBrush
ClearLeds()
Removes all ArtemisLeds from the layer and updates the render properties.
public void ClearLeds()
CreateRenderCopy(int)
Creates a copy of this layer and renders it alongside this layer for as long as its timeline lasts.
public void CreateRenderCopy(int max)
Parameters
max
intThe total maximum of render copies to keep
Disable()
Enables the render element and its brushes and effects
public override void Disable()
Dispose(bool)
Disposes the profile element
protected override void Dispose(bool disposing)
Parameters
disposing
bool
Enable()
Disables the render element and its brushes and effects
public override void Enable()
GetAllLayerProperties()
Creates a list of all layer properties present on this render element
public override List<ILayerProperty> GetAllLayerProperties()
Returns
- List<ILayerProperty>
A list of all layer properties present on this render element
GetBrokenHierarchy()
Returns a list containing all broken models, including self and any children
public override IEnumerable<IBreakableModel> GetBrokenHierarchy()
Returns
GetFeatureDependencies()
Gets the plugin features this class depends on, may contain the same plugin feature twice if depending on it in multiple ways.
public override IEnumerable<PluginFeature> GetFeatureDependencies()
Returns
- IEnumerable<PluginFeature>
A List<T> of PluginFeature this class depends on.
GetTransformMatrix(bool, bool, bool, bool, SKRect?)
Creates a transformation matrix that applies the current transformation settings
public SKMatrix GetTransformMatrix(bool zeroBased, bool includeTranslation, bool includeScale, bool includeRotation, SKRect? customBounds = null)
Parameters
zeroBased
boolIf true, treats the layer as if it is located at 0,0 instead of its actual position on the surface
includeTranslation
boolWhether translation should be included
includeScale
boolWhether the scale should be included
includeRotation
boolWhether the rotation should be included
customBounds
SKRect?Optional custom bounds to base the anchor on
Returns
- 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
public override void OverrideTimelineAndApply(TimeSpan position)
Parameters
position
TimeSpanThe position to set the timeline to
RemoveLed(ArtemisLed)
Removes a ArtemisLed from the layer and updates the render properties.
public void RemoveLed(ArtemisLed led)
Parameters
led
ArtemisLedThe LED to remove
Render(SKCanvas, SKPointI, ProfileElement?)
Renders the element
public override void Render(SKCanvas canvas, SKPointI basePosition, ProfileElement? editorFocus)
Parameters
canvas
SKCanvasThe canvas to render upon.
basePosition
SKPointIThe base position to use to translate relative positions to absolute positions.
editorFocus
ProfileElementAn optional element to focus on while rendering (other elements will not render).
Reset()
Resets the internal state of the element
public override void Reset()
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Update(double)
Updates the element
public override void Update(double deltaTime)
Parameters
deltaTime
double
Events
LayerBrushUpdated
Occurs when the layer brush of this layer has been updated
public event EventHandler? LayerBrushUpdated
Event Type
RenderPropertiesUpdated
Occurs when a property affecting the rendering properties of this layer has been updated
public event EventHandler? RenderPropertiesUpdated