internal SLFill Clone() { var fill = new SLFill(listThemeColors); fill.Type = Type; fill.SolidColor = SolidColor.Clone(); fill.GradientColor = GradientColor.Clone(); fill.BlipFileName = BlipFileName; fill.BlipRelationshipID = BlipRelationshipID; fill.BlipTile = BlipTile; fill.decBlipLeftOffset = decBlipLeftOffset; fill.decBlipRightOffset = decBlipRightOffset; fill.decBlipTopOffset = decBlipTopOffset; fill.decBlipBottomOffset = decBlipBottomOffset; fill.decBlipOffsetX = decBlipOffsetX; fill.decBlipOffsetY = decBlipOffsetY; fill.decBlipScaleX = decBlipScaleX; fill.decBlipScaleY = decBlipScaleY; fill.BlipAlignment = BlipAlignment; fill.BlipMirrorType = BlipMirrorType; fill.decBlipTransparency = decBlipTransparency; fill.BlipDpi = BlipDpi; fill.BlipRotateWithShape = BlipRotateWithShape; fill.PatternPreset = PatternPreset; fill.PatternForegroundColor = PatternForegroundColor.Clone(); fill.PatternBackgroundColor = PatternBackgroundColor.Clone(); return(fill); }
/// <summary> /// Set a pattern fill with a preset pattern, foreground color and background color. /// </summary> /// <param name="PresetPattern">A preset fill pattern.</param> /// <param name="ForegroundColor">The color to be used for the foreground.</param> /// <param name="BackgroundColor">The color to be used for the background.</param> public void SetPatternFill(A.PresetPatternValues PresetPattern, Color ForegroundColor, Color BackgroundColor) { Type = SLFillType.PatternFill; PatternPreset = PresetPattern; PatternForegroundColor.SetColor(ForegroundColor, 0); PatternBackgroundColor.SetColor(BackgroundColor, 0); }
/// <summary> /// Set a pattern fill with a preset pattern, foreground color and background color. /// </summary> /// <param name="PresetPattern">A preset fill pattern.</param> /// <param name="ForegroundColorTheme">The theme color to be used for the foreground.</param> /// <param name="ForegroundColorTint"> /// The tint applied to the foreground 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="BackgroundColorTheme">The theme color to be used for the background.</param> /// <param name="BackgroundColorTint"> /// The tint applied to the background theme color, ranging from -1.0 to 1.0. Negative /// tints darken the theme color and positive tints lighten the theme color. /// </param> public void SetPatternFill(A.PresetPatternValues PresetPattern, SLThemeColorIndexValues ForegroundColorTheme, double ForegroundColorTint, SLThemeColorIndexValues BackgroundColorTheme, double BackgroundColorTint) { Type = SLFillType.PatternFill; PatternPreset = PresetPattern; PatternForegroundColor.SetColor(ForegroundColorTheme, ForegroundColorTint, 0); PatternBackgroundColor.SetColor(BackgroundColorTheme, BackgroundColorTint, 0); }
/// <summary> /// Set a pattern fill with a preset pattern, foreground color and background color. /// </summary> /// <param name="PresetPattern">A preset fill pattern.</param> /// <param name="ForegroundColorTheme">The theme color to be used for the foreground.</param> /// <param name="BackgroundColor">The color to be used for the background.</param> public void SetPatternFill(A.PresetPatternValues PresetPattern, SLThemeColorIndexValues ForegroundColorTheme, Color BackgroundColor) { Type = SLFillType.PatternFill; PatternPreset = PresetPattern; PatternForegroundColor.SetColor(ForegroundColorTheme, 0, 0); PatternBackgroundColor.SetColor(BackgroundColor, 0); }
internal OpenXmlElement ToFill() { OpenXmlElement oxe = new A.NoFill(); if (Type == SLFillType.NoFill) { return(new A.NoFill()); } if (Type == SLFillType.SolidFill) { var sf = new A.SolidFill(); if (SolidColor.IsRgbColorModelHex) { sf.RgbColorModelHex = SolidColor.ToRgbColorModelHex(); } else { sf.SchemeColor = SolidColor.ToSchemeColor(); } return(sf); } if (Type == SLFillType.GradientFill) { return(GradientColor.ToGradientFill()); } if (Type == SLFillType.BlipFill) { var bf = new A.BlipFill(); if (BlipDpi != null) { bf.Dpi = BlipDpi.Value; } if (BlipRotateWithShape != null) { bf.RotateWithShape = BlipRotateWithShape.Value; } bf.Blip = new A.Blip(); bf.Blip.Embed = BlipRelationshipID; if (BlipTransparency > 0m) { bf.Blip.Append(new A.AlphaModulationFixed { Amount = SLDrawingTool.CalculateAlpha(BlipTransparency) }); } bf.Append(new A.SourceRectangle()); if (BlipTile) { bf.Append(new A.Tile { HorizontalOffset = SLDrawingTool.CalculateCoordinate(BlipOffsetX), VerticalOffset = SLDrawingTool.CalculateCoordinate(BlipOffsetY), HorizontalRatio = SLDrawingTool.CalculatePercentage(BlipScaleX), VerticalRatio = SLDrawingTool.CalculatePercentage(BlipScaleY), Flip = BlipMirrorType, Alignment = BlipAlignment }); } else { bf.Append(new A.Stretch { FillRectangle = new A.FillRectangle { Left = SLDrawingTool.CalculatePercentage(BlipLeftOffset), Top = SLDrawingTool.CalculatePercentage(BlipTopOffset), Right = SLDrawingTool.CalculatePercentage(BlipRightOffset), Bottom = SLDrawingTool.CalculatePercentage(BlipBottomOffset) } }); } return(bf); } if (Type == SLFillType.PatternFill) { var pf = new A.PatternFill(); pf.Preset = A.PresetPatternValues.Trellis; pf.ForegroundColor = new A.ForegroundColor(); if (PatternForegroundColor.IsRgbColorModelHex) { pf.ForegroundColor.RgbColorModelHex = PatternForegroundColor.ToRgbColorModelHex(); } else { pf.ForegroundColor.SchemeColor = PatternForegroundColor.ToSchemeColor(); } pf.BackgroundColor = new A.BackgroundColor(); if (PatternBackgroundColor.IsRgbColorModelHex) { pf.BackgroundColor.RgbColorModelHex = PatternBackgroundColor.ToRgbColorModelHex(); } else { pf.BackgroundColor.SchemeColor = PatternBackgroundColor.ToSchemeColor(); } return(pf); } return(oxe); }