Artemis.Profiles.Layers.Types.Keyboard.KeyboardType.Draw C# (CSharp) Method

Draw() public method

public Draw ( LayerModel layer, System.Windows.Media.DrawingContext c ) : void
layer LayerModel
c System.Windows.Media.DrawingContext
return void
        public void Draw(LayerModel layer, DrawingContext c)
        {
            // If an animation is present, let it handle the drawing
            if (layer.LayerAnimation != null && !(layer.LayerAnimation is NoneAnimation))
            {
                layer.LayerAnimation.Draw(layer.Properties, layer.AppliedProperties, c);
                return;
            }

            // Otherwise draw the rectangle with its layer.AppliedProperties dimensions and brush
            var rect = layer.Properties.Contain
                ? new Rect(layer.AppliedProperties.X*4,
                    layer.AppliedProperties.Y*4,
                    layer.AppliedProperties.Width*4,
                    layer.AppliedProperties.Height*4)
                : new Rect(layer.Properties.X*4,
                    layer.Properties.Y*4,
                    layer.Properties.Width*4,
                    layer.Properties.Height*4);

            var clip = new Rect(layer.AppliedProperties.X*4, layer.AppliedProperties.Y*4,
                layer.AppliedProperties.Width*4, layer.AppliedProperties.Height*4);


            c.PushClip(new RectangleGeometry(clip));
            c.DrawRectangle(layer.AppliedProperties.Brush, null, rect);
            c.Pop();
        }