private NativeMagickGeometry CreateNativeInstance() { NativeMagickGeometry instance = new NativeMagickGeometry(); instance.Initialize(ToString()); return instance; }
/// <summary> /// Initializes a new instance of the <see cref="MagickGeometry"/> class using the specified geometry. /// </summary> /// <param name="value">Geometry specifications in the form: <width>x<height> /// {+-}<xoffset>{+-}<yoffset> (where width, height, xoffset, and yoffset are numbers)</param> public MagickGeometry(string value) { Throw.IfNullOrEmpty(nameof(value), value); using (NativeMagickGeometry instance = new NativeMagickGeometry()) { GeometryFlags flags = instance.Initialize(value); Initialize(instance, flags); } }
/// <summary> /// Initializes a new instance of the <see cref="MagickGeometry"/> class using the specified geometry. /// </summary> /// <param name="value">Geometry specifications in the form: <width>x<height> /// {+-}<xoffset>{+-}<yoffset> (where width, height, xoffset, and yoffset are numbers)</param> public MagickGeometry(string value) { Throw.IfNullOrEmpty(nameof(value), value); using (var instance = new NativeMagickGeometry()) { var flags = instance.Initialize(value); if (!EnumHelper.HasFlag(flags, GeometryFlags.AspectRatio)) { Initialize(instance, flags); } else { InitializeFromAspectRation(instance, value); } } }
/// <summary> /// Initializes a new instance of the <see cref="MagickGeometry"/> class using the specified geometry. /// </summary> /// <param name="value">Geometry specifications in the form: <width>x<height> /// {+-}<xoffset>{+-}<yoffset> (where width, height, xoffset, and yoffset are numbers)</param> public MagickGeometry(string value) { Throw.IfNullOrEmpty(nameof(value), value); using (var instance = new NativeMagickGeometry()) { var flags = instance.Initialize(value); if (!EnumHelper.HasFlag(flags, GeometryFlags.AspectRatio)) { Initialize(instance, flags); return; } AspectRatio = true; var ratio = value.Split(':'); Width = int.Parse(ratio[0]); Height = int.Parse(ratio[1]); } }