protected static Boolean TryGetQuantity(String token, IStyleVariableAccessor variableAccessor, out QuantifiedDouble quantity) { if (token.IndexOf("var", StringComparison.OrdinalIgnoreCase) == 0) { token = FunctionBuilder.GetValue <String>(token, variableAccessor); } return(QuantifiedDouble.TryParse(token, out quantity)); }
public TranslateTransform(QuantifiedDouble x, QuantifiedDouble y) { X = x; Y = y; IsIdentity = X.IsZero() && Y.IsZero(); Value = IsIdentity ? TransformationMatrix.Identity : new TransformationMatrix(1, 0, 0, 1, x, y); }
public BoxShadowLayer(QuantifiedDouble offsetX, QuantifiedDouble offsetY, QuantifiedDouble blurRadius, QuantifiedDouble spreadRadius, IBrush color, Boolean isInset) { OffsetX = offsetX; OffsetY = offsetY; BlurRadius = blurRadius; SpreadRadius = spreadRadius; Color = color; IsInset = isInset; }
private Object?GetPropertyValue(PropertyInfo prop, String strValue) { var useType = Nullable.GetUnderlyingType(prop.PropertyType) ?? prop.PropertyType; if (useType == typeof(QuantifiedDouble)) { return(QuantifiedDouble.Parse(strValue)); } var valueConverter = _converterProvider.GetDefaultConverter(useType); var propVal = valueConverter != null ? valueConverter.Convert(strValue) : _attributeValueScanner.GetValue(strValue, useType, false); return(propVal); }
public ISvgImage Parse(SvgDocument doc) { var path = doc.Path?.D ?? throw new NullReferenceException(); var width = doc.Width; var height = doc.Height; if (doc.Style is { } strStyle) { var styleTokens = strStyle.Split(';'); foreach (var token in styleTokens) { var kvp = token.Split(':'); if (kvp.Length != 2) { continue; } switch (kvp[0]) { case nameof(width): if (QuantifiedDouble.TryParse(kvp[1], out var qWidth)) { //todo: non-px value width = Convert.ToInt32(qWidth); } break; case nameof(height): if (QuantifiedDouble.TryParse(kvp[1], out var qHeight)) { //todo: non-px value height = Convert.ToInt32(qHeight); } break; } } } return(Parse(width, height, path)); }
public TranslateTransform(QuantifiedDouble x) : this(x, QuantifiedDouble.Zero) { }