public void LoadFrom(string text) { SVGPreserveAspectRatio eAlign = SVGPreserveAspectRatio.none; bool bDefer = false; bool bSlice = false; string[] sParts = text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); int nAlignIndex = 0; if (sParts[0].Equals("defer")) { bDefer = true; nAlignIndex++; if (sParts.Length < 2) { return; } } eAlign = (SVGPreserveAspectRatio)Enum.Parse(typeof(SVGPreserveAspectRatio), sParts[nAlignIndex]); nAlignIndex++; if (sParts.Length > nAlignIndex) { switch (sParts[nAlignIndex]) { case "meet": break; case "slice": bSlice = true; break; default: return; } } Align = eAlign; Slice = bSlice; Defer = bDefer; }
public AspectRatio(SVGPreserveAspectRatio align, bool slice) { Align = align; Slice = slice; Defer = false; }
public AspectRatio(SVGPreserveAspectRatio align) : this(align, false) { }