// TODO overload setting of inner and outer shadow functions here internal A.InnerShadow ToInnerShadow() { var ishad = new A.InnerShadow(); if (InnerShadowColor.IsRgbColorModelHex) { ishad.RgbColorModelHex = InnerShadowColor.ToRgbColorModelHex(); } else { ishad.SchemeColor = InnerShadowColor.ToSchemeColor(); } if (InnerShadowBlurRadius != 0) { ishad.BlurRadius = SLDrawingTool.CalculatePositiveCoordinate(InnerShadowBlurRadius); } if (InnerShadowDistance != 0) { ishad.Distance = SLDrawingTool.CalculatePositiveCoordinate(InnerShadowDistance); } if (InnerShadowDirection != 0) { ishad.Direction = SLDrawingTool.CalculatePositiveFixedAngle(InnerShadowDirection); } return(ishad); }
/// <summary> /// Set the shadow color. /// </summary> /// <param name="Color">The theme color used.</param> /// <param name="Tint"> /// The tint applied to the theme color, ranging from -1.0 to 1.0. Negative tints darken the theme color /// and positive tints lighten the theme color. /// </param> /// <param name="Transparency">Transparency of the color ranging from 0% to 100%. Accurate to 1/1000 of a percent.</param> public void SetShadowColor(SLThemeColorIndexValues Color, double Tint, decimal Transparency) { if (IsInnerShadow != null) { if (IsInnerShadow.Value) { InnerShadowColor.SetColor(Color, Tint, Transparency); } else { OuterShadowColor.SetColor(Color, Tint, Transparency); } } }
/// <summary> /// Set the shadow color. /// </summary> /// <param name="Color">The color to be used.</param> /// <param name="Transparency">Transparency of the color ranging from 0% to 100%. Accurate to 1/1000 of a percent.</param> public void SetShadowColor(Color Color, decimal Transparency) { if (IsInnerShadow != null) { if (IsInnerShadow.Value) { InnerShadowColor.SetColor(Color, Transparency); } else { OuterShadowColor.SetColor(Color, Transparency); } } }
internal SLShadowEffect Clone() { var se = new SLShadowEffect(listThemeColors); se.IsInnerShadow = IsInnerShadow; se.InnerShadowColor = InnerShadowColor.Clone(); se.InnerShadowBlurRadius = InnerShadowBlurRadius; se.InnerShadowDistance = InnerShadowDistance; se.InnerShadowDirection = InnerShadowDirection; se.OuterShadowColor = OuterShadowColor.Clone(); se.OuterShadowBlurRadius = OuterShadowBlurRadius; se.OuterShadowDistance = OuterShadowDistance; se.OuterShadowDirection = OuterShadowDirection; se.OuterShadowHorizontalRatio = OuterShadowHorizontalRatio; se.OuterShadowVerticalRatio = OuterShadowVerticalRatio; se.OuterShadowHorizontalSkew = OuterShadowHorizontalSkew; se.OuterShadowVerticalSkew = OuterShadowVerticalSkew; se.OuterShadowAlignment = OuterShadowAlignment; se.OuterShadowRotateWithShape = OuterShadowRotateWithShape; return(se); }
/// <summary> /// Set a shadow using a preset. /// </summary> /// <param name="Preset">The preset to be used.</param> public void SetPreset(SLShadowPresetValues Preset) { var clr = Color.FromArgb(0, 0, 0); switch (Preset) { case SLShadowPresetValues.None: SetAllNull(); break; case SLShadowPresetValues.OuterDiagonalBottomRight: IsInnerShadow = false; OuterShadowColor.SetColor(clr, 60); OuterShadowHorizontalRatio = 100; OuterShadowVerticalRatio = 100; OuterShadowHorizontalSkew = 0; OuterShadowVerticalSkew = 0; OuterShadowBlurRadius = 4; OuterShadowDirection = 45; OuterShadowDistance = 3; OuterShadowAlignment = A.RectangleAlignmentValues.TopLeft; OuterShadowRotateWithShape = false; break; case SLShadowPresetValues.OuterBottom: IsInnerShadow = false; OuterShadowColor.SetColor(clr, 60); OuterShadowHorizontalRatio = 100; OuterShadowVerticalRatio = 100; OuterShadowHorizontalSkew = 0; OuterShadowVerticalSkew = 0; OuterShadowBlurRadius = 4; OuterShadowDirection = 90; OuterShadowDistance = 3; OuterShadowAlignment = A.RectangleAlignmentValues.Top; OuterShadowRotateWithShape = false; break; case SLShadowPresetValues.OuterDiagonalBottomLeft: IsInnerShadow = false; OuterShadowColor.SetColor(clr, 60); OuterShadowHorizontalRatio = 100; OuterShadowVerticalRatio = 100; OuterShadowHorizontalSkew = 0; OuterShadowVerticalSkew = 0; OuterShadowBlurRadius = 4; OuterShadowDirection = 135; OuterShadowDistance = 3; OuterShadowAlignment = A.RectangleAlignmentValues.TopRight; OuterShadowRotateWithShape = false; break; case SLShadowPresetValues.OuterRight: IsInnerShadow = false; OuterShadowColor.SetColor(clr, 60); OuterShadowHorizontalRatio = 100; OuterShadowVerticalRatio = 100; OuterShadowHorizontalSkew = 0; OuterShadowVerticalSkew = 0; OuterShadowBlurRadius = 4; OuterShadowDirection = 0; OuterShadowDistance = 3; OuterShadowAlignment = A.RectangleAlignmentValues.Left; OuterShadowRotateWithShape = false; break; case SLShadowPresetValues.OuterCenter: IsInnerShadow = false; OuterShadowColor.SetColor(clr, 60); OuterShadowHorizontalRatio = 102; OuterShadowVerticalRatio = 102; OuterShadowHorizontalSkew = 0; OuterShadowVerticalSkew = 0; OuterShadowBlurRadius = 5; OuterShadowDirection = 0; OuterShadowDistance = 0; OuterShadowAlignment = A.RectangleAlignmentValues.Center; OuterShadowRotateWithShape = false; break; case SLShadowPresetValues.OuterLeft: IsInnerShadow = false; OuterShadowColor.SetColor(clr, 60); OuterShadowHorizontalRatio = 100; OuterShadowVerticalRatio = 100; OuterShadowHorizontalSkew = 0; OuterShadowVerticalSkew = 0; OuterShadowBlurRadius = 4; OuterShadowDirection = 180; OuterShadowDistance = 3; OuterShadowAlignment = A.RectangleAlignmentValues.Right; OuterShadowRotateWithShape = false; break; case SLShadowPresetValues.OuterDiagonalTopRight: IsInnerShadow = false; OuterShadowColor.SetColor(clr, 60); OuterShadowHorizontalRatio = 100; OuterShadowVerticalRatio = 100; OuterShadowHorizontalSkew = 0; OuterShadowVerticalSkew = 0; OuterShadowBlurRadius = 4; OuterShadowDirection = 315; OuterShadowDistance = 3; OuterShadowAlignment = A.RectangleAlignmentValues.BottomLeft; OuterShadowRotateWithShape = false; break; case SLShadowPresetValues.OuterTop: IsInnerShadow = false; OuterShadowColor.SetColor(clr, 60); OuterShadowHorizontalRatio = 100; OuterShadowVerticalRatio = 100; OuterShadowHorizontalSkew = 0; OuterShadowVerticalSkew = 0; OuterShadowBlurRadius = 4; OuterShadowDirection = 270; OuterShadowDistance = 3; OuterShadowAlignment = A.RectangleAlignmentValues.Bottom; OuterShadowRotateWithShape = false; break; case SLShadowPresetValues.OuterDiagonalTopLeft: IsInnerShadow = false; OuterShadowColor.SetColor(clr, 60); OuterShadowHorizontalRatio = 100; OuterShadowVerticalRatio = 100; OuterShadowHorizontalSkew = 0; OuterShadowVerticalSkew = 0; OuterShadowBlurRadius = 4; OuterShadowDirection = 225; OuterShadowDistance = 3; OuterShadowAlignment = A.RectangleAlignmentValues.BottomRight; OuterShadowRotateWithShape = false; break; case SLShadowPresetValues.InnerDiagonalTopLeft: IsInnerShadow = true; InnerShadowColor.SetColor(clr, 50); InnerShadowBlurRadius = 5; InnerShadowDirection = 225; InnerShadowDistance = 4; break; case SLShadowPresetValues.InnerTop: IsInnerShadow = true; InnerShadowColor.SetColor(clr, 50); InnerShadowBlurRadius = 5; InnerShadowDirection = 270; InnerShadowDistance = 4; break; case SLShadowPresetValues.InnerDiagonalTopRight: IsInnerShadow = true; InnerShadowColor.SetColor(clr, 50); InnerShadowBlurRadius = 5; InnerShadowDirection = 315; InnerShadowDistance = 4; break; case SLShadowPresetValues.InnerLeft: IsInnerShadow = true; InnerShadowColor.SetColor(clr, 50); InnerShadowBlurRadius = 5; InnerShadowDirection = 180; InnerShadowDistance = 4; break; case SLShadowPresetValues.InnerCenter: IsInnerShadow = true; InnerShadowColor.SetColor(clr, 0); InnerShadowBlurRadius = 9; InnerShadowDirection = 0; InnerShadowDistance = 0; break; case SLShadowPresetValues.InnerRight: IsInnerShadow = true; InnerShadowColor.SetColor(clr, 50); InnerShadowBlurRadius = 5; InnerShadowDirection = 0; InnerShadowDistance = 4; break; case SLShadowPresetValues.InnerDiagonalBottomLeft: IsInnerShadow = true; InnerShadowColor.SetColor(clr, 50); InnerShadowBlurRadius = 5; InnerShadowDirection = 135; InnerShadowDistance = 4; break; case SLShadowPresetValues.InnerBottom: IsInnerShadow = true; InnerShadowColor.SetColor(clr, 50); InnerShadowBlurRadius = 5; InnerShadowDirection = 90; InnerShadowDistance = 4; break; case SLShadowPresetValues.InnerDiagonalBottomRight: IsInnerShadow = true; InnerShadowColor.SetColor(clr, 50); InnerShadowBlurRadius = 5; InnerShadowDirection = 45; InnerShadowDistance = 4; break; case SLShadowPresetValues.PerspectiveDiagonalUpperLeft: IsInnerShadow = false; OuterShadowColor.SetColor(clr, 80); OuterShadowHorizontalRatio = 100; OuterShadowVerticalRatio = 23; OuterShadowHorizontalSkew = 20; OuterShadowVerticalSkew = 0; OuterShadowBlurRadius = 6; OuterShadowDirection = 225; OuterShadowDistance = 0; OuterShadowAlignment = A.RectangleAlignmentValues.BottomRight; OuterShadowRotateWithShape = false; break; case SLShadowPresetValues.PerspectiveDiagonalUpperRight: IsInnerShadow = false; OuterShadowColor.SetColor(clr, 80); OuterShadowHorizontalRatio = 100; OuterShadowVerticalRatio = 23; OuterShadowHorizontalSkew = -20; OuterShadowVerticalSkew = 0; OuterShadowBlurRadius = 6; OuterShadowDirection = 315; OuterShadowDistance = 0; OuterShadowAlignment = A.RectangleAlignmentValues.BottomLeft; OuterShadowRotateWithShape = false; break; case SLShadowPresetValues.PerspectiveBelow: IsInnerShadow = false; OuterShadowColor.SetColor(clr, 85); OuterShadowHorizontalRatio = 90; OuterShadowVerticalRatio = 100; OuterShadowHorizontalSkew = 0; OuterShadowVerticalSkew = -0.3166667m; OuterShadowBlurRadius = 12; OuterShadowDirection = 90; OuterShadowDistance = 25; OuterShadowAlignment = A.RectangleAlignmentValues.Bottom; OuterShadowRotateWithShape = false; break; case SLShadowPresetValues.PerspectiveDiagonalLowerLeft: IsInnerShadow = false; OuterShadowColor.SetColor(clr, 80); OuterShadowHorizontalRatio = 100; OuterShadowVerticalRatio = -23; OuterShadowHorizontalSkew = 13.34m; OuterShadowVerticalSkew = 0; OuterShadowBlurRadius = 6; OuterShadowDirection = 135; OuterShadowDistance = 1; OuterShadowAlignment = A.RectangleAlignmentValues.BottomRight; OuterShadowRotateWithShape = false; break; case SLShadowPresetValues.PerspectiveDiagonalLowerRight: IsInnerShadow = false; OuterShadowColor.SetColor(clr, 80); OuterShadowHorizontalRatio = 100; OuterShadowVerticalRatio = -23; OuterShadowHorizontalSkew = -13.34m; OuterShadowVerticalSkew = 0; OuterShadowBlurRadius = 6; OuterShadowDirection = 45; OuterShadowDistance = 1; OuterShadowAlignment = A.RectangleAlignmentValues.BottomLeft; OuterShadowRotateWithShape = false; break; } }