/// <summary> /// Constructor /// </summary> public Circle() { Name = "Circle"; Layout = new CircleLayout(); Segments = 20; this.Radius = 10; this.Width = 5; this.Color = Color.White; }
/// <summary> /// Clones the layout /// </summary> /// <returns></returns> public override object Clone() { CircleLayout layout = new CircleLayout(); layout.SetFrom(this); layout.Radius = this.Radius; layout.Width = this.Width; layout.Color = this.Color; return(layout); }
/// <summary> /// Applies the provided keyframe to the control, /// overriding all needed properties /// </summary> /// <param name="frame"></param> public override void ApplyKeyFrame(KeyFrame startFrame, KeyFrame endFrame, float factor) { base.ApplyKeyFrame(startFrame, endFrame, factor); CircleLayout startLayout = startFrame != null ? startFrame.Layout as CircleLayout : null; CircleLayout endLayout = endFrame != null ? endFrame.Layout as CircleLayout : null; if (startLayout == null && endLayout == null) { return; } int r, g, b, a; uint width, radius; if (endLayout == null) { r = startLayout.Color.R; g = startLayout.Color.G; b = startLayout.Color.B; a = startLayout.Color.A; width = startLayout.Width; radius = startLayout.Radius; } else { r = (int)((float)startLayout.Color.R * (1.0f - factor) + (float)endLayout.Color.R * factor); g = (int)((float)startLayout.Color.G * (1.0f - factor) + (float)endLayout.Color.G * factor); b = (int)((float)startLayout.Color.B * (1.0f - factor) + (float)endLayout.Color.B * factor); a = (int)((float)startLayout.Color.A * (1.0f - factor) + (float)endLayout.Color.A * factor); width = (uint)((float)startLayout.Width * (1.0f - factor) + (float)endLayout.Width * factor); radius = (uint)((float)startLayout.Radius * (1.0f - factor) + (float)endLayout.Radius * factor); } this.Radius = radius; this.Width = width; this.Color = Color.FromArgb(a, r, g, b); }
/// <summary> /// Clones the layout /// </summary> /// <returns></returns> public override object Clone() { CircleLayout layout = new CircleLayout(); layout.SetFrom(this); layout.Radius = this.Radius; layout.Width = this.Width; layout.Color = this.Color; return layout; }