public void Parse(CssReader reader, GradientBuilder builder) { var direction = reader.ReadNext().Trim(); if (TryConvertDegreeToAngle(direction, out var degreeToAngle)) { builder.AddLinearGradient(degreeToAngle); } else if (TryConvertNamedDirectionToAngle(direction, out var directionToAngle)) { builder.AddLinearGradient(directionToAngle); } else { builder.AddLinearGradient(0); reader.Rollback(); } }
public void Parse(CssReader reader, GradientBuilder builder) { var repeating = reader.Read().Trim() == CssToken.RepeatingLinearGradient; var direction = reader.ReadNext().Trim(); var angle = 0d; var hasAngle = TryConvertDegreeToAngle(direction, out angle) || TryConvertTurnToAngle(direction, out angle) || TryConvertNamedDirectionToAngle(direction, out angle); if (hasAngle) { builder.AddLinearGradient(angle, repeating); } else { builder.AddLinearGradient(0, repeating); reader.Rollback(); } }
public override void AddGradientTo(GradientBuilder builder) { builder.AddLinearGradient(g => g.Rotate(45)); }
public override void AddGradient(GradientBuilder builder) { builder.AddLinearGradient(45); }