private Collection <int> GetIndexes(ExifParts part, ExifTag[] tags) { if (!EnumHelper.HasFlag(_allowedParts, part)) { return(new Collection <int>()); } Collection <int> result = new Collection <int>(); for (int i = 0; i < _values.Count; i++) { ExifValue value = _values[i]; if (!value.HasValue) { continue; } int index = Array.IndexOf(tags, value.Tag); if (index > -1) { result.Add(i); } } return(result); }
private void Initialize(NativeMagickGeometry instance, GeometryFlags flags) { Throw.IfTrue(nameof(flags), flags == GeometryFlags.NoValue, "Invalid geometry specified."); Initialize(instance); IsPercentage = EnumHelper.HasFlag(flags, GeometryFlags.PercentValue); IgnoreAspectRatio = EnumHelper.HasFlag(flags, GeometryFlags.IgnoreAspectRatio); FillArea = EnumHelper.HasFlag(flags, GeometryFlags.FillArea); Greater = EnumHelper.HasFlag(flags, GeometryFlags.Greater); Less = EnumHelper.HasFlag(flags, GeometryFlags.Less); LimitPixels = EnumHelper.HasFlag(flags, GeometryFlags.LimitPixels); }
/// <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); } } }
private static void SetLogEvents() { string eventFlags = null; if (EnumHelper.HasFlag(_logEvents, LogEvents.Detailed)) { eventFlags = "All"; } else if (EnumHelper.HasFlag(_logEvents, LogEvents.All)) { eventFlags = "All,Trace"; } else { eventFlags = EnumHelper.ConvertFlags(_logEvents); } NativeMagickNET.SetLogEvents(eventFlags); }
/// <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], CultureInfo.InvariantCulture); Height = int.Parse(ratio[1], CultureInfo.InvariantCulture); } }
private static void SetLogEvents() { string eventFlags = null; if (EnumHelper.HasFlag(_LogEvents, LogEvents.All)) { if (EnumHelper.HasFlag(_LogEvents, LogEvents.Trace)) { eventFlags = "All,Trace"; } else { eventFlags = "All"; } } else { eventFlags = EnumHelper.ConvertFlags(_LogEvents); } Wrapper.MagickNET.SetLogEvents(eventFlags); }
private Collection <IExifValue> GetPartValues(Collection <IExifValue> values, ExifParts part) { var result = new Collection <IExifValue>(); if (!EnumHelper.HasFlag(_allowedParts, part)) { return(result); } foreach (var value in values) { if (!HasValue(value)) { continue; } if (ExifTags.GetPart(value.Tag) == part) { result.Add(value); } } return(result); }