private void Configure() { _joinType = LineJoinType.Round; _startCap = LineCap.Round; _endCap = LineCap.Round; _decorations = new CopyList<ILineDecoration>(); }
private void Configure() { _joinType = LineJoinType.Round; _startCap = LineCap.Round; _endCap = LineCap.Round; _decorations = new CopyList <ILineDecoration>(); }
private void RadBevelCheckedChanged(object sender, EventArgs e) { if (radBevel.Checked && _joinType != LineJoinType.Bevel) { _joinType = LineJoinType.Bevel; OnValueChanged(); } }
/// <summary> /// Sets the type of line joints /// </summary> /// <param name="join">Type of the joint</param> public void SetJoinType(LineJoinType join) { if ((int)JoinType != (int)join) { JoinType = (JoinType)join; HasChanged = true; } }
private void RadMiterCheckedChanged(object sender, EventArgs e) { if (radMiter.Checked && _joinType != LineJoinType.Mitre) { _joinType = LineJoinType.Mitre; OnValueChanged(); } }
private void RadRoundCheckedChanged(object sender, EventArgs e) { if (radRound.Checked && _joinType != LineJoinType.Round) { _joinType = LineJoinType.Round; OnValueChanged(); } }
private ShapeStroke(string name, AnimatableFloatValue offset, IList <AnimatableFloatValue> lineDashPattern, AnimatableColorValue color, AnimatableIntegerValue opacity, AnimatableFloatValue width, LineCapType capType, LineJoinType joinType) { Name = name; DashOffset = offset; LineDashPattern = lineDashPattern; Color = color; Opacity = opacity; Width = width; CapType = capType; JoinType = joinType; }
public ShapeStroke(string name, AnimatableFloatValue offset, List <AnimatableFloatValue> lineDashPattern, AnimatableColorValue color, AnimatableIntegerValue opacity, AnimatableFloatValue width, LineCapType capType, LineJoinType joinType, float miterLimit, bool hidden) { Name = name; DashOffset = offset; LineDashPattern = lineDashPattern; Color = color; Opacity = opacity; Width = width; CapType = capType; JoinType = joinType; MiterLimit = miterLimit; IsHidden = hidden; }
internal static PenLineJoin LineJoinTypeToPaintLineJoin(LineJoinType lineJoinType) { switch (lineJoinType) { case LineJoinType.Bevel: return(PenLineJoin.Bevel); case LineJoinType.Miter: return(PenLineJoin.Miter); case LineJoinType.Round: default: return(PenLineJoin.Round); } }
public LinearGradientStroke( string name, string matchName, Animatable <double> opacityPercent, Animatable <double> strokeWidth, LineCapType capType, LineJoinType joinType, double miterLimit) : base(name, matchName) { OpacityPercent = opacityPercent; StrokeWidth = strokeWidth; CapType = capType; JoinType = joinType; MiterLimit = miterLimit; }
/// <summary> /// Handles the randomization of the cartographic properties of this stroke. /// </summary> /// <param name="generator">The random class that generates the random numbers.</param> protected override void OnRandomize(Random generator) { base.OnRandomize(generator); DashStyle = DashStyle.Custom; _dashCap = generator.NextEnum <DashCap>(); _startCap = generator.NextEnum <LineCap>(); _endCap = generator.NextEnum <LineCap>(); _dashButtons = generator.NextBoolArray(1, 20); _compoundButtons = generator.NextBoolArray(1, 5); _offset = generator.NextFloat(10); _joinType = generator.NextEnum <LineJoinType>(); int len = generator.Next(0, 1); if (len > 0) { _decorations.Clear(); LineDecoration ld = new(); ld.Randomize(generator); _decorations.Add(ld); } }
public SolidColorStroke( string name, string matchName, Animatable <double> dashOffset, IEnumerable <double> dashPattern, Animatable <Color> color, Animatable <double> opacityPercent, Animatable <double> thickness, LineCapType capType, LineJoinType joinType, double miterLimit) : base(name, matchName) { DashOffset = dashOffset; _dashPattern = dashPattern.ToArray(); Color = color; OpacityPercent = opacityPercent; Thickness = thickness; CapType = capType; JoinType = joinType; MiterLimit = miterLimit; }
public void Polyline(string behaviorName, LineCapType lineCap, LineJoinType lineJoin) { var random = new Random(); _mockBehaviorResolver .Setup(resolver => resolver.GetBehaviorHandler(behaviorName)) .Returns(() => { return(new DrawContentBehavior(_sciterWindow, (element, prms) => { if (prms.DrawEvent != DrawEvent.Content) { return false; } using (var graphics = SciterGraphics.Create(prms.Handle)) { for (var i = 0; i < byte.MaxValue; i++) { graphics.SaveState() .Translate(prms.Area.Left, prms.Area.Top) .SetLineColor( (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue)) .SetLineCap(lineCap) .SetLineJoin(lineJoin) .SetLineWidth(random.Next(2, 10)) .DrawPolyline(() => { var result = new List <PolylinePoint>(); for (var j = 0; j < random.Next(3, 12); j++) { result.Add(PolylinePoint.Create( random.Next(byte.MinValue, prms.Area.Width), random.Next(byte.MinValue, prms.Area.Height))); } return result; }) .RestoreState(); } } element?.Window?.Close(); return true; })); }); _ = new TestableSciterHost(_sciterWindow) .SetBehaviorResolver(_mockBehaviorResolver.Object); _sciterWindow.Show(); var backgroundColor = random.Next(byte.MinValue, 80); _sciterWindow.RootElement.AppendElement("body", elm => elm) .SetStyleValue("background", $"rgb({backgroundColor}, {backgroundColor}, {backgroundColor})") .SetStyleValue("behavior", behaviorName); SciterPlatform.RunMessageLoop(); //Assert.NotNull(_sciterGraphics); }
private void radMiter_CheckedChanged(object sender, EventArgs e) { if (radMiter.Checked && _joinType != LineJoinType.Mitre) { _joinType = LineJoinType.Mitre; OnValueChanged(); } }
private void radRound_CheckedChanged(object sender, EventArgs e) { if (radRound.Checked && _joinType != LineJoinType.Round) { _joinType = LineJoinType.Round; OnValueChanged(); } }
private void radBevel_CheckedChanged(object sender, EventArgs e) { if (radBevel.Checked && _joinType != LineJoinType.Bevel) { _joinType = LineJoinType.Bevel; OnValueChanged(); } }
/// <summary> /// Handles the randomization of the cartographic properties of this stroke. /// </summary> /// <param name="generator">The random class that generates the random numbers</param> protected override void OnRandomize(Random generator) { base.OnRandomize(generator); DashStyle = DashStyle.Custom; _dashCap = generator.NextEnum<DashCap>(); _startCap = generator.NextEnum<LineCap>(); _endCap = generator.NextEnum<LineCap>(); _dashButtons = generator.NextBoolArray(1, 20); _compoundButtons = generator.NextBoolArray(1, 5); _offset = generator.NextFloat(10); _joinType = generator.NextEnum<LineJoinType>(); int len = generator.Next(0, 1); if (len > 0) { _decorations.Clear(); LineDecoration ld = new LineDecoration(); ld.Randomize(generator); _decorations.Add(ld); } }
public static bool TrySetLineJoin(this SciterGraphics graphics, LineJoinType joinType) { return(graphics?.TrySetLineJoinInternal(joinType: joinType) == true); }
public void DrawLine_with_lineCap_and_lineJoin(string behaviorName, LineCapType lineCap, LineJoinType lineJoin) { var random = new Random(); _mockBehaviorResolver.Setup(resolver => resolver.GetBehaviorHandler(behaviorName)) .Returns(() => { return(new DrawContentBehavior(_sciterWindow, (element, args) => { if (args.DrawEvent != DrawEvent.Content) { return false; } using (var graphics = SciterGraphics.Create(args.Handle)) { for (var i = 0; i < byte.MaxValue; i++) { graphics.SaveState() .Translate(args.Area.Left, args.Area.Top) .SetLineColor( (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue)) .SetFillColor( (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue)) .SetLineWidth(random.Next(2, 10)) .SetLineCap(lineCap) .SetLineJoin(lineJoin) .DrawLine(random.Next(byte.MinValue, args.Area.Width), random.Next(byte.MinValue, args.Area.Height), random.Next(byte.MinValue, args.Area.Width), random.Next(byte.MinValue, args.Area.Height)) .SetLineGradientLinear( 0f, 0f, args.Area.Width / 2f, args.Area.Height, SciterColorStop.Create(0f, (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue)), SciterColorStop.Create(.5f, (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue)), SciterColorStop.Create(1f, (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue))) .DrawLine(random.Next(byte.MinValue, args.Area.Width), random.Next(byte.MinValue, args.Area.Height), random.Next(byte.MinValue, args.Area.Width), random.Next(byte.MinValue, args.Area.Height)) .RestoreState(); } } element?.Window?.Close(); return true; })); }); _ = new TestableSciterHost(_sciterWindow) .SetBehaviorResolver(_mockBehaviorResolver.Object); _sciterWindow.Show(); _sciterWindow.RootElement.AppendElement("body", elm => elm) .SetStyleValue("background", $"rgb({random.Next(byte.MinValue, byte.MaxValue)}, {random.Next(byte.MinValue, byte.MaxValue)}, {random.Next(byte.MinValue, byte.MaxValue)})") .SetStyleValue("behavior", behaviorName); SciterPlatform.RunMessageLoop(); //Assert.NotNull(_sciterGraphics); }
public static SciterGraphics SetLineJoin(this SciterGraphics graphics, LineJoinType joinType) { graphics?.SetLineJoinInternal(joinType: joinType); return(graphics); }