Decompiled source of HSVPlugin v2.3.0
HSVPlugin.dll
Decompiled 4 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using Bounce.Singletons; using Bounce.Unmanaged; using Newtonsoft.Json; using RadialUI; using TMPro; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("HSVPlugin")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HSVPlugin")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("HSVPlugin")] [assembly: ComVisible(false)] [assembly: Guid("c303405d-e66c-4316-9cdb-4e3ca15c6360")] [assembly: AssemblyFileVersion("2.3.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("2.3.0.0")] namespace LordAshes; [BepInPlugin("org.lordashes.plugins.hsv", "HSV Plug-In", "2.3.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class HSVPlugin : BaseUnityPlugin { public static class Utility { public static void PostOnMainPage(MemberInfo plugin) { SceneManager.sceneLoaded += delegate(Scene scene, LoadSceneMode mode) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown try { if (((Scene)(ref scene)).name == "UI") { TextMeshProUGUI uITextByName = GetUITextByName("BETA"); if (Object.op_Implicit((Object)(object)uITextByName)) { ((TMP_Text)uITextByName).text = "INJECTED BUILD - unstable mods"; } } else { TextMeshProUGUI uITextByName2 = GetUITextByName("TextMeshPro Text"); if (Object.op_Implicit((Object)(object)uITextByName2)) { BepInPlugin val = (BepInPlugin)Attribute.GetCustomAttribute(plugin, typeof(BepInPlugin)); if (((TMP_Text)uITextByName2).text.EndsWith("</size>")) { ((TMP_Text)uITextByName2).text = ((TMP_Text)uITextByName2).text + "\n\nMods Currently Installed:\n"; } TextMeshProUGUI val2 = uITextByName2; ((TMP_Text)val2).text = ((TMP_Text)val2).text + "\nLord Ashes' " + val.Name + " - " + val.Version; } } } catch (Exception ex) { Debug.Log((object)ex); } }; } public static bool isBoardLoaded() { return SimpleSingletonBehaviour<CameraController>.HasInstance && SingletonStateMBehaviour<BoardSessionManager, State<BoardSessionManager>>.HasInstance && !BoardSessionManager.IsLoading; } public static string GetCreatureName(string name) { if (name.Contains("<")) { name = name.Substring(0, name.IndexOf("<")); } return name; } private static TextMeshProUGUI GetUITextByName(string name) { TextMeshProUGUI[] array = Object.FindObjectsOfType<TextMeshProUGUI>(); for (int i = 0; i < array.Length; i++) { if (((Object)array[i]).name == name) { return array[i]; } } return null; } public static GameObject GetAssetLoader(CreatureGuid cid) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) try { CreatureBoardAsset val = null; CreaturePresenter.TryGetAsset(cid, ref val); if ((Object)(object)val != (Object)null) { Transform match = null; Traverse(((Component)val).transform, "AssetLoader", 0, 10, ref match); if ((Object)(object)match != (Object)null) { Debug.Log((object)("Proximity Roller Plugin: Asset Loader '" + ((Object)match.GetChild(0)).name + "' Found")); return ((Component)match.GetChild(0)).gameObject; } Debug.LogWarning((object)"Proximity Roller Plugin: Could Not Find Asset Loader"); return null; } return null; } catch { return null; } } public static void Traverse(Transform root, string seek, int depth, int depthMax, ref Transform match) { try { if ((Object)(object)match != (Object)null) { return; } if (((Object)root).name == seek) { match = root; return; } foreach (Transform item in ExtensionMethods.Children(root)) { if (depth < depthMax) { Traverse(item, seek, depth + 1, depthMax, ref match); } } } catch { } } } public enum MenuItemLocation { MainMenu, GMMenu } public const string Name = "HSV Plug-In"; public const string Guid = "org.lordashes.plugins.hsv"; public const string Version = "2.3.0.0"; public bool menuOpen = false; public int applying = 0; public Dictionary<string, Texture2D> originalTextures = new Dictionary<string, Texture2D>(); public string data = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase.ToString().Replace("file:///", "")); private float h = 100f; private float s = 100f; private float v = 100f; private static BaseUnityPlugin self; private static KeyboardShortcut manualTrigger; private static Queue<object[]> transformations = new Queue<object[]>(); private static int transformationsInProgress = 0; private static int maxtTransfromationsInProgress = 0; private void Awake() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Expected O, but got Unknown //IL_00ee: Expected O, but got Unknown //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) LoggingPlugin.SetLogLevel(((BaseUnityPlugin)this).Config.Bind<DiagnosticLevel>("Settings", "Diagnostic Level", (DiagnosticLevel)3, (ConfigDescription)null).Value); string? assemblyQualifiedName = ((object)this).GetType().AssemblyQualifiedName; DiagnosticLevel logLevel = LoggingPlugin.GetLogLevel(); Debug.Log((object)(assemblyQualifiedName + ": Active. (Diagnostic Mode = " + ((object)(DiagnosticLevel)(ref logLevel)).ToString() + ")")); self = (BaseUnityPlugin)(object)this; if (((BaseUnityPlugin)this).Config.Bind<MenuItemLocation>("Settings", "HSV Menu Location", MenuItemLocation.GMMenu, (ConfigDescription)null).Value == MenuItemLocation.GMMenu) { RadialUIPlugin.AddCustomButtonGMSubmenu("org.hollofox.plugins.RadialUIPlugin.HSL", new ItemArgs { Action = HSVMenu, CloseMenuOnActivate = true, FadeName = true, Icon = Image.LoadSprite("Paintbrush.png", (CacheType)999), Title = "HSV" }, (Func<NGuid, NGuid, bool>)((NGuid a, NGuid b) => true)); } else { RadialUIPlugin.AddCustomButtonOnCharacter("org.hollofox.plugins.RadialUIPlugin.HSL", new ItemArgs { Action = HSVMenu, CloseMenuOnActivate = true, FadeName = true, Icon = Image.LoadSprite("Paintbrush.png", (CacheType)999), Title = "HSV" }, (Func<NGuid, NGuid, bool>)((NGuid a, NGuid b) => true)); } manualTrigger = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keyboard", "Manual Trigger To Apply HSV Transfromations", new KeyboardShortcut((KeyCode)104, (KeyCode[])(object)new KeyCode[1] { (KeyCode)305 }), (ConfigDescription)null).Value; maxtTransfromationsInProgress = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Maximum Simultaneous Transformations", 5, (ConfigDescription)null).Value; AssetDataPlugin.Subscribe("org.lordashes.plugins.hsv".ToString(), (Action<DatumChange>)AssetDataTransformationRequest, (Func<DatumChange, bool>)Checker.CheckSourceAsCreature); Utility.PostOnMainPage(((object)this).GetType()); } private void OnGUI() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) if (!menuOpen) { return; } GUIStyle val = new GUIStyle(); val.alignment = (TextAnchor)5; val.fontSize = 16; val.fontStyle = (FontStyle)1; val.normal.textColor = Color.white; GUIStyle val2 = new GUIStyle(); val2.alignment = (TextAnchor)3; val2.fontSize = 16; val2.fontStyle = (FontStyle)1; val2.normal.textColor = Color.white; GUI.Label(new Rect(855f, 500f, 100f, 30f), "Hue:", val); GUI.Label(new Rect(965f, 500f, 30f, 30f), h.ToString("0.0") + "%", val2); h = GUI.HorizontalSlider(new Rect(1020f, 510f, 300f, 30f), h, 0f, 200f); GUI.Label(new Rect(855f, 540f, 100f, 30f), "Saturation:", val); GUI.Label(new Rect(965f, 540f, 30f, 30f), s.ToString("0.0") + "%", val2); s = GUI.HorizontalSlider(new Rect(1020f, 550f, 300f, 30f), s, 0f, 200f); GUI.Label(new Rect(855f, 580f, 100f, 30f), "Value:", val); GUI.Label(new Rect(965f, 580f, 30f, 30f), v.ToString("0.0") + "%", val2); v = GUI.HorizontalSlider(new Rect(1020f, 590f, 300f, 30f), v, 0f, 200f); if (GUI.Button(new Rect(1135f, 640f, 20f, 20f), "^")) { h = 100f; s = 100f; v = 100f; } if (applying == 0) { if (GUI.Button(new Rect(895f, 620f, 60f, 30f), "Apply")) { applying = 1; } if (GUI.Button(new Rect(965f, 620f, 60f, 30f), "Exit")) { menuOpen = false; GameInputEnabled(setting: true); } return; } applying++; GUI.Label(new Rect(945f, 620f, 60f, 30f), "Applying...", val); if (applying == 10) { applying++; NGuid lastRadialTargetCreature = RadialUIPlugin.GetLastRadialTargetCreature(); AssetDataPlugin.SetInfo(((object)(NGuid)(ref lastRadialTargetCreature)).ToString(), "org.lordashes.plugins.hsv", h + "," + s + "," + v, false); } } private void Update() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) if (Utility.isBoardLoaded() && ((KeyboardShortcut)(ref manualTrigger)).IsUp()) { SystemMessage.DisplayInfoText("Applying HSV Transfromations", 2.5f, 0f); LoggingPlugin.LogInfo("Manual HSV Application Triggered"); foreach (CreatureBoardAsset item in (IEnumerable<CreatureBoardAsset>)CreaturePresenter.GetTempReadOnlyViewOfAllCreatureAssets()) { CreatureGuid creatureId = item.CreatureId; LoggingPlugin.LogDebug("Refreshing HSV On " + ((object)(CreatureGuid)(ref creatureId)).ToString() + "."); ((MonoBehaviour)this).StartCoroutine("RefreshHSV", (object)new object[1] { item.CreatureId }); } } if (transformationsInProgress < maxtTransfromationsInProgress && transformations.Count > 0) { LoggingPlugin.LogTrace("Dequeing Next Transformation"); object[] array = transformations.Dequeue(); ((MonoBehaviour)this).StartCoroutine("ProcessChange", (object)array); } } private void HSVMenu(MapMenuItem arg1, object arg2) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) CreatureBoardAsset val = default(CreatureBoardAsset); CreaturePresenter.TryGetAsset(new CreatureGuid(RadialUIPlugin.GetLastRadialTargetCreature()), ref val); if ((Object)(object)val != (Object)null) { string[] array = new string[3] { "100.0", "100.0", "100.0" }; try { CreatureGuid creatureId = val.CreatureId; array = AssetDataPlugin.ReadInfo(((object)(CreatureGuid)(ref creatureId)).ToString(), "org.lordashes.plugins.hsv").Split(new char[1] { ',' }); } catch { } h = float.Parse(array[0]); s = float.Parse(array[1]); v = float.Parse(array[2]); menuOpen = true; GameInputEnabled(setting: false); } } private void AssetDataTransformationRequest(DatumChange change) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Invalid comparison between Unknown and I4 string[] obj = new string[7] { "Processing ", change.source.ToString(), " -> ", change.value?.ToString(), " (", null, null }; ChangeAction action = change.action; obj[5] = ((object)(ChangeAction)(ref action)).ToString(); obj[6] = ")"; LoggingPlugin.LogDebug(string.Concat(obj)); string[] array = change.value.ToString().Split(new char[1] { ',' }); float num = (((int)change.action == 2) ? ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Delay HSV Application On New Asset", 1f, (ConfigDescription)null).Value : 0.1f); ((MonoBehaviour)this).StartCoroutine("DelayTransformationQueuing", (object)new object[5] { change.source, float.Parse(array[0]), float.Parse(array[1]), float.Parse(array[2]), num }); } private IEnumerator DelayTransformationQueuing(object[] inputs) { yield return (object)new WaitForSeconds((float)inputs[4]); LoggingPlugin.LogTrace("Enqueing Transformation."); transformations.Enqueue(inputs); } private IEnumerator ProcessChange(object[] inputs) { LoggingPlugin.LogDebug("Processing HSV Transformation " + JsonConvert.SerializeObject((object)inputs)); transformationsInProgress++; yield return (object)new WaitForSeconds(0.1f); CreatureGuid cid = new CreatureGuid(inputs[0].ToString()); float dh = (float)inputs[1]; float ds = (float)inputs[2]; float dv = (float)inputs[3]; CreatureBoardAsset asset = default(CreatureBoardAsset); CreaturePresenter.TryGetAsset(cid, ref asset); string phase = ""; if ((Object)(object)asset != (Object)null) { GameObject go = null; try { LoggingPlugin.LogTrace("Processing HSV Transformation For " + Utility.GetCreatureName(asset.Name) + " (H" + dh + ":S" + ds + ":V" + dv + ")"); phase = "Get Mini Reference"; go = Utility.GetAssetLoader(asset.CreatureId); phase = "Get Mini Render Reference"; Renderer[] renderers = go.GetComponentsInChildren<Renderer>(); LoggingPlugin.LogTrace("Found " + renderers.Length + " Renderers"); Renderer[] componentsInChildren = go.GetComponentsInChildren<Renderer>(); CreatureGuid creatureId; foreach (Renderer rend2 in componentsInChildren) { if (rend2.materials != null) { phase = "Get Render " + ((Object)rend2).name + " Reference (Materials Count = " + rend2.materials.Length + ")"; for (int j = 0; j < rend2.materials.Length; j++) { if (!originalTextures.ContainsKey(((object)(CreatureGuid)(ref cid)).ToString() + ".M" + j)) { if ((Object)(object)rend2.materials[j] != (Object)null && (Object)(object)rend2.materials[j].mainTexture != (Object)null) { if (((Object)rend2.materials[j].mainTexture).name == null) { ((Object)rend2.materials[j].mainTexture).name = "No-Name"; } LoggingPlugin.LogTrace("Registering Original Texture " + (j + 1) + " of " + rend2.materials.Length + " '" + ((Object)rend2.materials[j].mainTexture).name + "'."); phase = "Get Mini Original Texture Reference"; originalTextures.Add(((object)(CreatureGuid)(ref cid)).ToString() + ".M" + j, (Texture2D)rend2.materials[j].mainTexture); } else { LoggingPlugin.LogTrace("Registering Null Texture " + (j + 1) + "."); originalTextures.Add(((object)(CreatureGuid)(ref cid)).ToString() + ".M" + j, null); } } LoggingPlugin.LogTrace("Processing Texture " + (j + 1)); Texture2D tex = originalTextures[((object)(CreatureGuid)(ref cid)).ToString() + ".M" + j]; if ((Object)(object)tex != (Object)null) { phase = "Populate Texture Object"; LoggingPlugin.LogTrace("Processing Texture '" + ((Object)tex).name + "' (Is Readable: " + ((Texture)tex).isReadable + ")"); Texture2D alt; if (!((Texture)tex).isReadable) { phase = "Extract Non-Readable Texture"; RenderTexture tmp = RenderTexture.GetTemporary(((Texture)tex).width, ((Texture)tex).height, 0, (RenderTextureFormat)7, (RenderTextureReadWrite)1); Graphics.Blit((Texture)(object)tex, tmp); RenderTexture previous = RenderTexture.active; RenderTexture.active = tmp; alt = new Texture2D(((Texture)tex).width, ((Texture)tex).height); alt.ReadPixels(new Rect(0f, 0f, (float)((Texture)tmp).width, (float)((Texture)tmp).height), 0, 0); alt.Apply(); RenderTexture.active = previous; RenderTexture.ReleaseTemporary(tmp); } else { phase = "Extract Readable Texture"; alt = new Texture2D(((Texture)tex).width, ((Texture)tex).height, (TextureFormat)3, false); Color[] c = tex.GetPixels(0, 0, ((Texture)tex).width - 1, ((Texture)tex).height - 1); phase = "Copy Texture To New Texture Object"; alt.SetPixels(0, 0, ((Texture)tex).width - 1, ((Texture)tex).height - 1, c); } byte[] bytes = ImageConversion.EncodeToPNG(alt); phase = "Write Uncompressed Texture Object"; string text = data; creatureId = asset.CreatureId; File.WriteAllBytes(text + "/CustomData/Images/" + ((object)(CreatureGuid)(ref creatureId)).ToString() + ".png", bytes); Debug.Log((object)"Applying Transformation."); phase = "Apply Transformation To Texture Object"; Process process = new Process(); Process process2 = process; ProcessStartInfo processStartInfo = new ProcessStartInfo { FileName = data + "/ImageAdjust.exe", WorkingDirectory = data }; ProcessStartInfo processStartInfo2 = processStartInfo; string[] obj = new string[10] { "\"", data, "/CustomData/Images/", null, null, null, null, null, null, null }; creatureId = asset.CreatureId; obj[3] = ((object)(CreatureGuid)(ref creatureId)).ToString(); obj[4] = ".png\" "; obj[5] = dh.ToString(); obj[6] = " "; obj[7] = ds.ToString(); obj[8] = " "; obj[9] = dv.ToString(); processStartInfo2.Arguments = string.Concat(obj); processStartInfo.CreateNoWindow = true; processStartInfo.RedirectStandardOutput = true; processStartInfo.UseShellExecute = false; process2.StartInfo = processStartInfo; Process transformation = process; transformation.Start(); string output = transformation.StandardOutput.ReadToEnd(); transformation.WaitForExit(); LoggingPlugin.LogTrace("ImageAdjust Output = " + output); phase = "Apply New Texture"; LoggingPlugin.LogTrace("Loading Transformation."); Material obj2 = rend2.materials[j]; HSVPlugin hSVPlugin = this; string text2 = data; creatureId = asset.CreatureId; obj2.mainTexture = (Texture)(object)hSVPlugin.LoadTexture(text2 + "/CustomData/Images/" + ((object)(CreatureGuid)(ref creatureId)).ToString() + ".png"); } } } else { LoggingPlugin.LogWarning("Renderer " + ((Object)rend2).name + " Has No Textures"); } } SkinnedMeshRenderer[] componentsInChildren2 = go.GetComponentsInChildren<SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer rend in componentsInChildren2) { if (((Renderer)rend).sharedMaterials != null) { phase = "Get Render " + ((Object)rend).name + " Reference (Shared Materials Count = " + ((Renderer)rend).sharedMaterials.Length + ")"; for (int i = 0; i < ((Renderer)rend).sharedMaterials.Length; i++) { if (!originalTextures.ContainsKey(((object)(CreatureGuid)(ref cid)).ToString() + ".SM" + i)) { if ((Object)(object)((Renderer)rend).sharedMaterials[i] != (Object)null && (Object)(object)((Renderer)rend).sharedMaterials[i].mainTexture != (Object)null) { if (((Object)((Renderer)rend).sharedMaterials[i].mainTexture).name == null) { ((Object)((Renderer)rend).sharedMaterials[i].mainTexture).name = "No-Name"; } LoggingPlugin.LogTrace("Registering Original Texture " + (i + 1) + " of " + ((Renderer)rend).sharedMaterials.Length + " '" + ((Object)((Renderer)rend).sharedMaterials[i].mainTexture).name + "'."); phase = "Get Mini Original Texture Reference"; originalTextures.Add(((object)(CreatureGuid)(ref cid)).ToString() + ".SM" + i, (Texture2D)((Renderer)rend).sharedMaterials[i].mainTexture); } else { LoggingPlugin.LogTrace("Registering Null Texture " + (i + 1) + "."); originalTextures.Add(((object)(CreatureGuid)(ref cid)).ToString() + ".SM" + i, null); } } LoggingPlugin.LogTrace("Processing Texture " + (i + 1) + "."); Texture2D tex2 = originalTextures[((object)(CreatureGuid)(ref cid)).ToString() + ".SM" + i]; if ((Object)(object)tex2 != (Object)null) { phase = "Populate Texture Object"; LoggingPlugin.LogTrace("Processing Texture '" + ((Object)tex2).name + "' (Is Readable: " + ((Texture)tex2).isReadable + ")"); Texture2D alt2; if (!((Texture)tex2).isReadable) { phase = "Extract Non-Readable Texture"; RenderTexture tmp2 = RenderTexture.GetTemporary(((Texture)tex2).width, ((Texture)tex2).height, 0, (RenderTextureFormat)7, (RenderTextureReadWrite)1); Graphics.Blit((Texture)(object)tex2, tmp2); RenderTexture previous2 = RenderTexture.active; RenderTexture.active = tmp2; alt2 = new Texture2D(((Texture)tex2).width, ((Texture)tex2).height); alt2.ReadPixels(new Rect(0f, 0f, (float)((Texture)tmp2).width, (float)((Texture)tmp2).height), 0, 0); alt2.Apply(); RenderTexture.active = previous2; RenderTexture.ReleaseTemporary(tmp2); } else { phase = "Extract Readable Texture"; alt2 = new Texture2D(((Texture)tex2).width, ((Texture)tex2).height, (TextureFormat)3, false); Color[] c2 = tex2.GetPixels(0, 0, ((Texture)tex2).width - 1, ((Texture)tex2).height - 1); phase = "Copy Texture To New Texture Object"; alt2.SetPixels(0, 0, ((Texture)tex2).width - 1, ((Texture)tex2).height - 1, c2); } byte[] bytes2 = ImageConversion.EncodeToPNG(alt2); phase = "Write Uncompressed Texture Object"; string text3 = data; creatureId = asset.CreatureId; File.WriteAllBytes(text3 + "/CustomData/Images/" + ((object)(CreatureGuid)(ref creatureId)).ToString() + ".png", bytes2); LoggingPlugin.LogTrace("Applying Transformation."); phase = "Apply Transformation To Texture Object"; Process process = new Process(); Process process3 = process; ProcessStartInfo processStartInfo = new ProcessStartInfo { FileName = data + "/ImageAdjust.exe", WorkingDirectory = data }; ProcessStartInfo processStartInfo3 = processStartInfo; string[] obj3 = new string[10] { "\"", data, "/CustomData/Images/", null, null, null, null, null, null, null }; creatureId = asset.CreatureId; obj3[3] = ((object)(CreatureGuid)(ref creatureId)).ToString(); obj3[4] = ".png\" "; obj3[5] = dh.ToString(); obj3[6] = " "; obj3[7] = ds.ToString(); obj3[8] = " "; obj3[9] = dv.ToString(); processStartInfo3.Arguments = string.Concat(obj3); processStartInfo.CreateNoWindow = true; processStartInfo.RedirectStandardOutput = true; processStartInfo.UseShellExecute = false; process3.StartInfo = processStartInfo; Process transformation2 = process; transformation2.Start(); string output2 = transformation2.StandardOutput.ReadToEnd(); transformation2.WaitForExit(); LoggingPlugin.LogTrace("ImageAdjust Output = " + output2); phase = "Apply New Texture"; LoggingPlugin.LogTrace("Loading Transformation."); Material obj4 = ((Renderer)rend).sharedMaterials[i]; HSVPlugin hSVPlugin2 = this; string text4 = data; creatureId = asset.CreatureId; obj4.mainTexture = (Texture)(object)hSVPlugin2.LoadTexture(text4 + "/CustomData/Images/" + ((object)(CreatureGuid)(ref creatureId)).ToString() + ".png"); } } } else { LoggingPlugin.LogWarning("Renderer " + ((Object)rend).name + " Has No Textures"); } } } catch (Exception ex) { Exception x = ex; SystemMessage.DisplayInfoText(Utility.GetCreatureName(asset.Name) + ":\r\nAsset Texture Not Readable.\r\nThe Asset Is Not Compatible With HSV Plugin.\r\nEnsure Texture Is Set To Read/Write.", 2.5f, 0f); LoggingPlugin.LogWarning("Exception Processing Asset (" + Utility.GetCreatureName(asset.Name) + ") Texture At Phase '" + phase + "'"); Debug.LogException(x); if ((Object)(object)go != (Object)null) { LoggingPlugin.LogTrace("Enumerating Components:"); Component[] componentsInChildren3 = go.GetComponentsInChildren<Component>(); foreach (Component comp in componentsInChildren3) { Debug.Log((object)("Asset " + Utility.GetCreatureName(asset.Name) + " Has Component " + ((Object)comp).name + " (" + ((object)comp).GetType()?.ToString() + ")")); } } else { Debug.Log((object)"Asset Is Null"); } } } applying = 0; transformationsInProgress--; } private Texture2D LoadTexture(string source) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1); ImageConversion.LoadImage(val, File.ReadAllBytes(source)); return val; } private void GameInputEnabled(bool setting) { //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown if (setting) { LoggingPlugin.LogTrace("Enabling Game Input"); (from m in typeof(GameInput).GetMethods() where m.Name == "Enable" select m).ElementAt(0).Invoke((object?)(GameInput)(from f in typeof(ControllerManager).GetRuntimeFields() where f.Name == "_gameInput" select f).ToArray()[0].GetValue(null), new object[0]); } else { LoggingPlugin.LogTrace("Disabling Game Input"); (from m in typeof(GameInput).GetMethods() where m.Name == "Disable" select m).ElementAt(0).Invoke((object?)(GameInput)(from f in typeof(ControllerManager).GetRuntimeFields() where f.Name == "_gameInput" select f).ToArray()[0].GetValue(null), new object[0]); } } }
plugins/Magick.NET.Core.dll
Decompiled 4 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using System.Text; using System.Xml; using System.Xml.XPath; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: ComVisible(false)] [assembly: CLSCompliant(false)] [assembly: AssemblyCompany("Dirk Lemstra")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright 2013-2021 Dirk Lemstra")] [assembly: AssemblyFileVersion("8.5.0")] [assembly: AssemblyInformationalVersion("8.5.0+94caf0f2fcdec9152671e40bd1e359f82d5d8fe6")] [assembly: AssemblyProduct("Magick.NET.Core")] [assembly: AssemblyTitle("Magick.NET.Core")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, UnmanagedCode = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("8.5.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class IsReadOnlyAttribute : Attribute { } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] internal sealed class NotNullAttribute : Attribute { } } namespace ImageMagick { public interface IMagickColor<TQuantumType> : IEquatable<IMagickColor<TQuantumType>>, IComparable<IMagickColor<TQuantumType>> where TQuantumType : struct { TQuantumType A { get; set; } TQuantumType B { get; set; } TQuantumType G { get; set; } bool IsCmyk { get; } TQuantumType K { get; set; } TQuantumType R { get; set; } bool FuzzyEquals(IMagickColor<TQuantumType> other, Percentage fuzz); void SetFromBytes(byte red, byte green, byte blue, byte alpha); byte[] ToByteArray(); string ToHexString(); string ToShortString(); new string ToString(); } public interface IDefine { MagickFormat Format { get; } string Name { get; } string Value { get; } } public interface IDefines { IEnumerable<IDefine> Defines { get; } } public interface IReadDefines : IDefines { } public interface IWriteDefines : IDefines { MagickFormat Format { get; } } [GeneratedCode("Magick.NET.FileGenerator", "")] public interface IDrawables<TQuantumType> : IEnumerable<IDrawable>, IEnumerable where TQuantumType : struct { IDrawables<TQuantumType> Affine(double scaleX, double scaleY, double shearX, double shearY, double translateX, double translateY); IDrawables<TQuantumType> Alpha(double x, double y, PaintMethod paintMethod); IDrawables<TQuantumType> Arc(double startX, double startY, double endX, double endY, double startDegrees, double endDegrees); IDrawables<TQuantumType> Bezier(params PointD[] coordinates); IDrawables<TQuantumType> Bezier(IEnumerable<PointD> coordinates); IDrawables<TQuantumType> BorderColor(IMagickColor<TQuantumType> color); IDrawables<TQuantumType> Circle(double originX, double originY, double perimeterX, double perimeterY); IDrawables<TQuantumType> ClipPath(string clipPath); IDrawables<TQuantumType> ClipRule(FillRule fillRule); IDrawables<TQuantumType> ClipUnits(ClipPathUnit units); IDrawables<TQuantumType> Color(double x, double y, PaintMethod paintMethod); IDrawables<TQuantumType> Composite(IMagickGeometry offset, IMagickImage<TQuantumType> image); IDrawables<TQuantumType> Composite(double x, double y, IMagickImage<TQuantumType> image); IDrawables<TQuantumType> Composite(IMagickGeometry offset, CompositeOperator compose, IMagickImage<TQuantumType> image); IDrawables<TQuantumType> Composite(double x, double y, CompositeOperator compose, IMagickImage<TQuantumType> image); IDrawables<TQuantumType> Density(double density); IDrawables<TQuantumType> Density(PointD pointDensity); IDrawables<TQuantumType> Ellipse(double originX, double originY, double radiusX, double radiusY, double startDegrees, double endDegrees); IDrawables<TQuantumType> FillColor(IMagickColor<TQuantumType> color); IDrawables<TQuantumType> FillOpacity(Percentage opacity); IDrawables<TQuantumType> FillPatternUrl(string url); IDrawables<TQuantumType> FillRule(FillRule fillRule); IDrawables<TQuantumType> Font(string family); IDrawables<TQuantumType> Font(string family, FontStyleType style, FontWeight weight, FontStretch stretch); IDrawables<TQuantumType> FontPointSize(double pointSize); IDrawables<TQuantumType> Gravity(Gravity gravity); IDrawables<TQuantumType> Line(double startX, double startY, double endX, double endY); IDrawables<TQuantumType> Path(params IPath[] paths); IDrawables<TQuantumType> Path(IEnumerable<IPath> paths); IDrawables<TQuantumType> Point(double x, double y); IDrawables<TQuantumType> Polygon(params PointD[] coordinates); IDrawables<TQuantumType> Polygon(IEnumerable<PointD> coordinates); IDrawables<TQuantumType> Polyline(params PointD[] coordinates); IDrawables<TQuantumType> Polyline(IEnumerable<PointD> coordinates); IDrawables<TQuantumType> PopClipPath(); IDrawables<TQuantumType> PopGraphicContext(); IDrawables<TQuantumType> PopPattern(); IDrawables<TQuantumType> PushClipPath(string clipPath); IDrawables<TQuantumType> PushGraphicContext(); IDrawables<TQuantumType> PushPattern(string id, double x, double y, double width, double height); IDrawables<TQuantumType> Rectangle(double upperLeftX, double upperLeftY, double lowerRightX, double lowerRightY); IDrawables<TQuantumType> Rotation(double angle); IDrawables<TQuantumType> RoundRectangle(double upperLeftX, double upperLeftY, double lowerRightX, double lowerRightY, double cornerWidth, double cornerHeight); IDrawables<TQuantumType> Scaling(double x, double y); IDrawables<TQuantumType> SkewX(double angle); IDrawables<TQuantumType> SkewY(double angle); IDrawables<TQuantumType> StrokeAntialias(bool isEnabled); IDrawables<TQuantumType> StrokeColor(IMagickColor<TQuantumType> color); IDrawables<TQuantumType> StrokeDashArray(params double[] dash); IDrawables<TQuantumType> StrokeDashOffset(double offset); IDrawables<TQuantumType> StrokeLineCap(LineCap lineCap); IDrawables<TQuantumType> StrokeLineJoin(LineJoin lineJoin); IDrawables<TQuantumType> StrokeMiterLimit(int miterlimit); IDrawables<TQuantumType> StrokeOpacity(Percentage opacity); IDrawables<TQuantumType> StrokePatternUrl(string url); IDrawables<TQuantumType> StrokeWidth(double width); IDrawables<TQuantumType> Text(double x, double y, string value); IDrawables<TQuantumType> TextAlignment(TextAlignment alignment); IDrawables<TQuantumType> TextAntialias(bool isEnabled); IDrawables<TQuantumType> TextDecoration(TextDecoration decoration); IDrawables<TQuantumType> TextDirection(TextDirection direction); IDrawables<TQuantumType> TextEncoding(Encoding encoding); IDrawables<TQuantumType> TextInterlineSpacing(double spacing); IDrawables<TQuantumType> TextInterwordSpacing(double spacing); IDrawables<TQuantumType> TextKerning(double kerning); IDrawables<TQuantumType> TextUnderColor(IMagickColor<TQuantumType> color); IDrawables<TQuantumType> Translation(double x, double y); IDrawables<TQuantumType> Viewbox(double upperLeftX, double upperLeftY, double lowerRightX, double lowerRightY); IDrawables<TQuantumType> Draw(IMagickImage<TQuantumType> image); ITypeMetric? FontTypeMetrics(string text); ITypeMetric? FontTypeMetrics(string text, bool ignoreNewlines); IPaths<TQuantumType> Paths(); } public interface IDrawable { } public interface IDrawableAffine { double ScaleX { get; set; } double ScaleY { get; set; } double ShearX { get; set; } double ShearY { get; set; } double TranslateX { get; set; } double TranslateY { get; set; } void Reset(); void TransformOrigin(double translateX, double translateY); void TransformRotation(double angle); void TransformScale(double scaleX, double scaleY); void TransformSkewX(double skewX); void TransformSkewY(double skewY); } public sealed class PathArc { public double RadiusX { get; set; } public double RadiusY { get; set; } public double RotationX { get; set; } public bool UseLargeArc { get; set; } public bool UseSweep { get; set; } public double X { get; set; } public double Y { get; set; } public PathArc() { } public PathArc(double x, double y, double radiusX, double radiusY, double rotationX, bool useLargeArc, bool useSweep) { X = x; Y = y; RadiusX = radiusX; RadiusY = radiusY; RotationX = rotationX; UseLargeArc = useLargeArc; UseSweep = useSweep; } } [GeneratedCode("Magick.NET.FileGenerator", "")] public interface IPaths<TQuantumType> : IEnumerable<IPath>, IEnumerable where TQuantumType : struct { IPaths<TQuantumType> ArcAbs(params PathArc[] coordinates); IPaths<TQuantumType> ArcAbs(IEnumerable<PathArc> coordinates); IPaths<TQuantumType> ArcRel(params PathArc[] coordinates); IPaths<TQuantumType> ArcRel(IEnumerable<PathArc> coordinates); IPaths<TQuantumType> Close(); IPaths<TQuantumType> CurveToAbs(PointD controlPointStart, PointD controlPointEnd, PointD end); IPaths<TQuantumType> CurveToAbs(double x1, double y1, double x2, double y2, double x, double y); IPaths<TQuantumType> CurveToRel(PointD controlPointStart, PointD controlPointEnd, PointD end); IPaths<TQuantumType> CurveToRel(double x1, double y1, double x2, double y2, double x, double y); IPaths<TQuantumType> LineToAbs(params PointD[] coordinates); IPaths<TQuantumType> LineToAbs(IEnumerable<PointD> coordinates); IPaths<TQuantumType> LineToAbs(double x, double y); IPaths<TQuantumType> LineToHorizontalAbs(double x); IPaths<TQuantumType> LineToHorizontalRel(double x); IPaths<TQuantumType> LineToRel(params PointD[] coordinates); IPaths<TQuantumType> LineToRel(IEnumerable<PointD> coordinates); IPaths<TQuantumType> LineToRel(double x, double y); IPaths<TQuantumType> LineToVerticalAbs(double y); IPaths<TQuantumType> LineToVerticalRel(double y); IPaths<TQuantumType> MoveToAbs(PointD coordinate); IPaths<TQuantumType> MoveToAbs(double x, double y); IPaths<TQuantumType> MoveToRel(PointD coordinate); IPaths<TQuantumType> MoveToRel(double x, double y); IPaths<TQuantumType> QuadraticCurveToAbs(PointD controlPoint, PointD end); IPaths<TQuantumType> QuadraticCurveToAbs(double x1, double y1, double x, double y); IPaths<TQuantumType> QuadraticCurveToRel(PointD controlPoint, PointD end); IPaths<TQuantumType> QuadraticCurveToRel(double x1, double y1, double x, double y); IPaths<TQuantumType> SmoothCurveToAbs(PointD controlPoint, PointD end); IPaths<TQuantumType> SmoothCurveToAbs(double x2, double y2, double x, double y); IPaths<TQuantumType> SmoothCurveToRel(PointD controlPoint, PointD end); IPaths<TQuantumType> SmoothCurveToRel(double x2, double y2, double x, double y); IPaths<TQuantumType> SmoothQuadraticCurveToAbs(PointD end); IPaths<TQuantumType> SmoothQuadraticCurveToAbs(double x, double y); IPaths<TQuantumType> SmoothQuadraticCurveToRel(PointD end); IPaths<TQuantumType> SmoothQuadraticCurveToRel(double x, double y); IDrawables<TQuantumType> Drawables(); } public interface IPath { } public enum AlphaOption { Undefined, Activate, Associate, Background, Copy, Deactivate, Discrete, Disassociate, Extract, Off, On, Opaque, Remove, Set, Shape, Transparent } public enum AutoThresholdMethod { Undefined, Kapur, OTSU, Triangle } [Flags] public enum Channels { None = 0, Red = 1, Gray = 1, Cyan = 1, Green = 2, Magenta = 2, Blue = 4, Yellow = 4, Black = 8, Alpha = 0x10, Opacity = 0x10, Index = 0x20, Composite = 0x1F, All = 0x7FFFFFF, TrueAlpha = 0x100, RGB = 7, CMYK = 0xF, Grays = 0x400, Sync = 0x20000, Default = 0x7FFFFFF } public enum ClassType { Undefined, Direct, Pseudo } public enum ClipPathUnit { Undefined, UserSpace, UserSpaceOnUse, ObjectBoundingBox } public enum ColorSpace { Undefined, CMY, CMYK, Gray, HCL, HCLp, HSB, HSI, HSL, HSV, HWB, Lab, LCH, LCHab, LCHuv, Log, LMS, Luv, OHTA, Rec601YCbCr, Rec709YCbCr, RGB, scRGB, sRGB, Transparent, XyY, XYZ, YCbCr, YCC, YDbDr, YIQ, YPbPr, YUV, LinearGray, Jzazbz } public enum ColorTransformMode { HighRes, Quantum } public enum ColorType { Undefined, Bilevel, Grayscale, GrayscaleAlpha, Palette, PaletteAlpha, TrueColor, TrueColorAlpha, ColorSeparation, ColorSeparationAlpha, Optimize, PaletteBilevelAlpha } public enum ComplexOperator { Undefined, Add, Conjugate, Divide, MagnitudePhase, Multiply, RealImaginary, Subtract } public enum CompositeOperator { Undefined, Alpha, Atop, Blend, Blur, Bumpmap, ChangeMask, Clear, ColorBurn, ColorDodge, Colorize, CopyBlack, CopyBlue, Copy, CopyCyan, CopyGreen, CopyMagenta, CopyAlpha, CopyRed, CopyYellow, Darken, DarkenIntensity, Difference, Displace, Dissolve, Distort, DivideDst, DivideSrc, DstAtop, Dst, DstIn, DstOut, DstOver, Exclusion, HardLight, HardMix, Hue, In, Intensity, Lighten, LightenIntensity, LinearBurn, LinearDodge, LinearLight, Luminize, Mathematics, MinusDst, MinusSrc, Modulate, ModulusAdd, ModulusSubtract, Multiply, No, Out, Over, Overlay, PegtopLight, PinLight, Plus, Replace, Saturate, Screen, SoftLight, SrcAtop, Src, SrcIn, SrcOut, SrcOver, Threshold, VividLight, Xor, Stereo, Freeze, Interpolate, Negate, Reflect, SoftBurn, SoftDodge, Stamp, RMSE } public enum CompressionMethod { Undefined, B44A, B44, BZip, DXT1, DXT3, DXT5, Fax, Group4, JBIG1, JBIG2, JPEG2000, JPEG, LosslessJPEG, LZMA, LZW, NoCompression, Piz, Pxr24, RLE, Zip, ZipS, Zstd, WebP, DWAA, DWAB, BC7 } public enum DensityUnit { Undefined, PixelsPerInch, PixelsPerCentimeter } public enum DistortMethod { Undefined, Affine, AffineProjection, ScaleRotateTranslate, Perspective, PerspectiveProjection, BilinearForward, BilinearReverse, Polynomial, Arc, Polar, DePolar, Cylinder2Plane, Plane2Cylinder, Barrel, BarrelInverse, Shepards, Resize, Sentinel, RigidAffine } public enum DitherMethod { Undefined, No, Riemersma, FloydSteinberg } public enum Endian { Undefined, LSB, MSB } public enum ErrorMetric { Undefined, Absolute, Fuzz, MeanAbsolute, MeanErrorPerPixel, MeanSquared, NormalizedCrossCorrelation, PeakAbsolute, PeakSignalToNoiseRatio, PerceptualHash, RootMeanSquared, StructuralSimilarity, StructuralDissimilarity } public enum EvaluateFunction { Undefined, Arcsin, Arctan, Polynomial, Sinusoid } public enum EvaluateOperator { Undefined, Abs, Add, AddModulus, And, Cosine, Divide, Exponential, GaussianNoise, ImpulseNoise, LaplacianNoise, LeftShift, Log, Max, Mean, Median, Min, MultiplicativeNoise, Multiply, Or, PoissonNoise, Pow, RightShift, RootMeanSquare, Set, Sine, Subtract, Sum, ThresholdBlack, Threshold, ThresholdWhite, UniformNoise, Xor, InverseLog } public enum FillRule { Undefined, EvenOdd, Nonzero } public enum FilterType { Undefined, Point, Box, Triangle, Hermite, Hann, Hamming, Blackman, Gaussian, Quadratic, Cubic, Catrom, Mitchell, Jinc, Sinc, SincFast, Kaiser, Welch, Parzen, Bohman, Bartlett, Lagrange, Lanczos, LanczosSharp, Lanczos2, Lanczos2Sharp, Robidoux, RobidouxSharp, Cosine, Spline, LanczosRadius, CubicSpline } public enum FontStretch { Undefined, Normal, UltraCondensed, ExtraCondensed, Condensed, SemiCondensed, SemiExpanded, Expanded, ExtraExpanded, UltraExpanded, Any } public enum FontStyleType { Undefined, Normal, Italic, Oblique, Any, Bold } public enum FontWeight { Undefined = 0, Thin = 100, ExtraLight = 200, UltraLight = 200, Light = 300, Normal = 400, Regular = 400, Medium = 500, DemiBold = 600, SemiBold = 600, Bold = 700, ExtraBold = 800, UltraBold = 800, Heavy = 900, Black = 900 } public enum GifDisposeMethod { Undefined, None, Background, Previous } public enum Gravity { Undefined = 0, Forget = 0, Northwest = 1, North = 2, Northeast = 3, West = 4, Center = 5, East = 6, Southwest = 7, South = 8, Southeast = 9 } public enum Interlace { Undefined, NoInterlace, Line, Plane, Partition, Gif, Jpeg, Png } public enum Kernel { Undefined, Unity, Gaussian, DoG, LoG, Blur, Comet, Binomial, Laplacian, Sobel, FreiChen, Roberts, Prewitt, Compass, Kirsch, Diamond, Square, Rectangle, Octagon, Disk, Plus, Cross, Ring, Peaks, Edges, Corners, Diagonals, LineEnds, LineJunctions, Ridges, ConvexHull, ThinSE, Skeleton, Chebyshev, Manhattan, Octagonal, Euclidean, UserDefined } public enum LineCap { Undefined, Butt, Round, Square } public enum LineJoin { Undefined, Miter, Round, Bevel } [Flags] public enum LogEvents { None = 0, Accelerate = 1, Annotate = 2, Blob = 4, Cache = 8, Coder = 0x10, Configure = 0x20, Deprecate = 0x40, Draw = 0x80, Exception = 0x100, Image = 0x200, Locale = 0x400, Module = 0x800, Pixel = 0x1000, Policy = 0x2000, Resource = 0x4000, Trace = 0x8000, Transform = 0x10000, User = 0x20000, Wand = 0x40000, Detailed = 0x7FFF7FFF, All = int.MaxValue } public enum MagickFormat { Unknown, ThreeFr, ThreeG2, ThreeGp, A, Aai, Ai, APng, Art, Arw, Ashlar, Avi, Avif, Avs, B, Bgr, Bgra, Bgro, Bmp, Bmp2, Bmp3, Brf, C, Cal, Cals, Canvas, Caption, Cin, Cip, Clip, Clipboard, Cmyk, Cmyka, Cr2, Cr3, Crw, Cube, Cur, Cut, Data, Dcm, Dcr, Dcraw, Dcx, Dds, Dfont, Dib, Dng, Dpx, Dxt1, Dxt5, Emf, Epdf, Epi, Eps, Eps2, Eps3, Epsf, Epsi, Ept, Ept2, Ept3, Erf, Exr, Farbfeld, Fax, Ff, File, Fits, Fl32, Flif, Flv, Fractal, Ftp, Fts, G, G3, G4, Gif, Gif87, Gradient, Gray, Graya, Group4, Hald, Hdr, Heic, Heif, Histogram, Hrz, Htm, Html, Http, Https, Icb, Ico, Icon, Iiq, Info, Inline, Ipl, Isobrl, Isobrl6, J2c, J2k, Jng, Jnx, Jp2, Jpc, Jpe, Jpeg, Jpg, Jpm, Jps, Jpt, Json, Jxl, K, K25, Kdc, Label, M, M2v, M4v, Mac, Map, Mask, Mat, Matte, Mef, Miff, Mkv, Mng, Mono, Mov, Mp4, Mpc, Mpeg, Mpg, Mrw, Msl, Msvg, Mtv, Mvg, Nef, Nrw, Null, O, Ora, Orf, Otb, Otf, Pal, Palm, Pam, Pango, Pattern, Pbm, Pcd, Pcds, Pcl, Pct, Pcx, Pdb, Pdf, Pdfa, Pef, Pes, Pfa, Pfb, Pfm, Pgm, Phm, Pgx, Picon, Pict, Pix, Pjpeg, Plasma, Png, Png00, Png24, Png32, Png48, Png64, Png8, Pnm, Pocketmod, Ppm, Ps, Ps2, Ps3, Psb, Psd, Ptif, Pwp, R, RadialGradient, Raf, Ras, Raw, Rgb, Rgb565, Rgba, Rgbo, Rgf, Rla, Rle, Rmf, Rsvg, Rw2, Scr, Screenshot, Sct, Sfw, Sgi, Shtml, Six, Sixel, SparseColor, Sr2, Srf, Stegano, Sun, Svg, Svgz, Text, Tga, Thumbnail, Tif, Tiff, Tiff64, Tile, Tim, Tm2, Ttc, Ttf, Txt, Ubrl, Ubrl6, Uil, Uyvy, Vda, Vicar, Vid, WebM, Viff, Vips, Vst, WebP, Wbmp, Wmf, Wmv, Wpg, X3f, Xbm, Xc, Xcf, Xpm, Xps, Xv, Y, Yaml, Ycbcr, Ycbcra, Yuv } public enum MorphologyMethod { Undefined, Convolve, Correlate, Erode, Dilate, ErodeIntensity, DilateIntensity, IterativeDistance, Open, Close, OpenIntensity, CloseIntensity, Smooth, EdgeIn, EdgeOut, Edge, TopHat, BottomHat, HitAndMiss, Thinning, Thicken, Distance, Voronoi } public enum NoiseType { Undefined, Uniform, Gaussian, MultiplicativeGaussian, Impulse, Laplacian, Poisson, Random } public enum OpenCLDeviceType { Undefined, Cpu, Gpu } public enum OrientationType { Undefined, TopLeft, TopRight, BottomRight, BottomLeft, LeftTop, RightTop, RightBottom, LeftBotom } public enum PaintMethod { Undefined, Point, Replace, Floodfill, FillToBorder, Reset } public enum PixelChannel { Red = 0, Cyan = 0, Gray = 0, Green = 1, Magenta = 1, Blue = 2, Yellow = 2, Black = 3, Alpha = 4, Index = 5, Composite = 64 } public enum PixelIntensityMethod { Undefined, Average, Brightness, Lightness, MS, Rec601Luma, Rec601Luminance, Rec709Luma, Rec709Luminance, RMS } public enum PixelInterpolateMethod { Undefined, Average, Average9, Average16, Background, Bilinear, Blend, Catrom, Integer, Mesh, Nearest, Spline } public enum PixelMapping { RGB, BGR, RGBA, ABGR, CMYK } public enum RenderingIntent { Undefined, Saturation, Perceptual, Absolute, Relative } public enum SparseColorMethod { Undefined = 0, Barycentric = 1, Bilinear = 7, Polynomial = 8, Shepards = 16, Voronoi = 18, Inverse = 19, Manhattan = 20 } public enum StatisticType { Undefined, Gradient, Maximum, Mean, Median, Minimum, Mode, Nonpeak, RootMeanSquare, StandardDeviation } public enum StorageType { Undefined, Char, Double, Float, Int32, Int64, Quantum, Short } public enum TextAlignment { Undefined, Left, Center, Right } public enum TextDecoration { Undefined, None, Underline, Overline, LineThrough } public enum TextDirection { Undefined, RightToLeft, LeftToRight } public enum VirtualPixelMethod { Undefined, Background, Dither, Edge, Mirror, Random, Tile, Transparent, Mask, Black, Gray, White, HorizontalTile, VerticalTile, HorizontalTileEdge, VerticalTileEdge, CheckerTile } public sealed class LogEventArgs : EventArgs { public LogEvents EventType { get; } public string? Message { get; } public LogEventArgs(LogEvents eventType, string? message) { EventType = eventType; Message = message; } } public sealed class ProgressEventArgs : EventArgs { public string? Origin { get; } public Percentage Progress { get; } public bool Cancel { get; set; } public ProgressEventArgs(string? origin, int offset, int extent) { Origin = origin; Progress = new Percentage((double)(offset + 1) / (double)extent * 100.0); } } public sealed class WarningEventArgs : EventArgs { public string Message => Exception.Message; public MagickWarningException Exception { get; } public WarningEventArgs(MagickWarningException exception) { Exception = exception; } } public sealed class MagickBlobErrorException : MagickErrorException { public MagickBlobErrorException(string message) : base(message) { } } public sealed class MagickCacheErrorException : MagickErrorException { public MagickCacheErrorException(string message) : base(message) { } } public sealed class MagickCoderErrorException : MagickErrorException { public MagickCoderErrorException(string message) : base(message) { } } public sealed class MagickConfigureErrorException : MagickErrorException { public MagickConfigureErrorException(string message) : base(message) { } } public sealed class MagickCorruptImageErrorException : MagickErrorException { public MagickCorruptImageErrorException(string message) : base(message) { } } public sealed class MagickDelegateErrorException : MagickErrorException { public MagickDelegateErrorException(string message) : base(message) { } } public sealed class MagickDrawErrorException : MagickErrorException { public MagickDrawErrorException(string message) : base(message) { } } public class MagickErrorException : MagickException { public MagickErrorException(string message) : base(message) { } } public sealed class MagickFileOpenErrorException : MagickErrorException { public MagickFileOpenErrorException(string message) : base(message) { } } public sealed class MagickImageErrorException : MagickErrorException { public MagickImageErrorException(string message) : base(message) { } } public sealed class MagickMissingDelegateErrorException : MagickErrorException { public MagickMissingDelegateErrorException(string message) : base(message) { } } public sealed class MagickModuleErrorException : MagickErrorException { public MagickModuleErrorException(string message) : base(message) { } } public sealed class MagickOptionErrorException : MagickErrorException { public MagickOptionErrorException(string message) : base(message) { } } public sealed class MagickPolicyErrorException : MagickErrorException { public MagickPolicyErrorException(string message) : base(message) { } } public sealed class MagickRegistryErrorException : MagickErrorException { public MagickRegistryErrorException(string message) : base(message) { } } public sealed class MagickResourceLimitErrorException : MagickErrorException { public MagickResourceLimitErrorException(string message) : base(message) { } } public sealed class MagickStreamErrorException : MagickErrorException { public MagickStreamErrorException(string message) : base(message) { } } public sealed class MagickTypeErrorException : MagickErrorException { public MagickTypeErrorException(string message) : base(message) { } } public abstract class MagickException : Exception { private List<MagickException>? _relatedExceptions; public IEnumerable<MagickException> RelatedExceptions { get { if (_relatedExceptions == null) { return new MagickException[0]; } return _relatedExceptions; } } public MagickException(string message) : base(message) { } public void SetRelatedException(List<MagickException> relatedExceptions) { _relatedExceptions = relatedExceptions; } } public sealed class MagickBlobWarningException : MagickWarningException { public MagickBlobWarningException(string message) : base(message) { } } public sealed class MagickCacheWarningException : MagickWarningException { public MagickCacheWarningException(string message) : base(message) { } } public sealed class MagickCoderWarningException : MagickWarningException { public MagickCoderWarningException(string message) : base(message) { } } public sealed class MagickConfigureWarningException : MagickWarningException { public MagickConfigureWarningException(string message) : base(message) { } } public sealed class MagickCorruptImageWarningException : MagickWarningException { public MagickCorruptImageWarningException(string message) : base(message) { } } public sealed class MagickDelegateWarningException : MagickWarningException { public MagickDelegateWarningException(string message) : base(message) { } } public sealed class MagickDrawWarningException : MagickWarningException { public MagickDrawWarningException(string message) : base(message) { } } public sealed class MagickFileOpenWarningException : MagickWarningException { public MagickFileOpenWarningException(string message) : base(message) { } } public sealed class MagickImageWarningException : MagickWarningException { public MagickImageWarningException(string message) : base(message) { } } public sealed class MagickMissingDelegateWarningException : MagickWarningException { public MagickMissingDelegateWarningException(string message) : base(message) { } } public sealed class MagickModuleWarningException : MagickWarningException { public MagickModuleWarningException(string message) : base(message) { } } public sealed class MagickOptionWarningException : MagickWarningException { public MagickOptionWarningException(string message) : base(message) { } } public sealed class MagickPolicyWarningException : MagickErrorException { public MagickPolicyWarningException(string message) : base(message) { } } public sealed class MagickRegistryWarningException : MagickWarningException { public MagickRegistryWarningException(string message) : base(message) { } } public sealed class MagickResourceLimitWarningException : MagickWarningException { public MagickResourceLimitWarningException(string message) : base(message) { } } public sealed class MagickStreamWarningException : MagickWarningException { public MagickStreamWarningException(string message) : base(message) { } } public sealed class MagickTypeWarningException : MagickWarningException { public MagickTypeWarningException(string message) : base(message) { } } public class MagickWarningException : MagickException { public MagickWarningException(string message) : base(message) { } } public interface IDrawablesFactory<TQuantumType> where TQuantumType : struct { IDrawables<TQuantumType> Create(); } public interface IMagickColorFactory<TQuantumType> where TQuantumType : struct { IMagickColor<TQuantumType> Create(); IMagickColor<TQuantumType> Create(IMagickColor<TQuantumType> color); IMagickColor<TQuantumType> Create(TQuantumType red, TQuantumType green, TQuantumType blue); IMagickColor<TQuantumType> Create(TQuantumType red, TQuantumType green, TQuantumType blue, TQuantumType alpha); IMagickColor<TQuantumType> Create(TQuantumType cyan, TQuantumType magenta, TQuantumType yellow, TQuantumType black, TQuantumType alpha); IMagickColor<TQuantumType> Create(string color); } public interface IMagickFactory { IMagickGeometryFactory Geometry { get; } IMagickImageInfoFactory ImageInfo { get; } IMatrixFactory Matrix { get; } } public interface IMagickFactory<TQuantumType> : IMagickFactory where TQuantumType : struct { IMagickColorFactory<TQuantumType> Color { get; } IDrawablesFactory<TQuantumType> Drawables { get; } IMagickImageFactory<TQuantumType> Image { get; } IMagickImageCollectionFactory<TQuantumType> ImageCollection { get; } IQuantumInfo<TQuantumType> QuantumInfo { get; } ISettingsFactory<TQuantumType> Settings { get; } } public interface IMagickGeometryFactory { IMagickGeometry Create(); IMagickGeometry Create(int widthAndHeight); IMagickGeometry Create(int width, int height); IMagickGeometry Create(int x, int y, int width, int height); IMagickGeometry Create(Percentage percentageWidth, Percentage percentageHeight); IMagickGeometry Create(int x, int y, Percentage percentageWidth, Percentage percentageHeight); IMagickGeometry Create(string value); IMagickGeometry CreateFromPageSize(string pageSize); } public interface IMagickImageCollectionFactory<TQuantumType> where TQuantumType : struct { IMagickImageCollection<TQuantumType> Create(); IMagickImageCollection<TQuantumType> Create(byte[] data); IMagickImageCollection<TQuantumType> Create(byte[] data, int offset, int count); IMagickImageCollection<TQuantumType> Create(byte[] data, int offset, int count, IMagickReadSettings<TQuantumType> readSettings); IMagickImageCollection<TQuantumType> Create(byte[] data, IMagickReadSettings<TQuantumType> readSettings); IMagickImageCollection<TQuantumType> Create(FileInfo file); IMagickImageCollection<TQuantumType> Create(FileInfo file, IMagickReadSettings<TQuantumType> readSettings); IMagickImageCollection<TQuantumType> Create(IEnumerable<IMagickImage<TQuantumType>> images); IMagickImageCollection<TQuantumType> Create(Stream stream); IMagickImageCollection<TQuantumType> Create(Stream stream, IMagickReadSettings<TQuantumType> readSettings); IMagickImageCollection<TQuantumType> Create(string fileName); IMagickImageCollection<TQuantumType> Create(string fileName, IMagickReadSettings<TQuantumType> readSettings); } public interface IMagickImageFactory<TQuantumType> where TQuantumType : struct { IMagickImage<TQuantumType> Create(); IMagickImage<TQuantumType> Create(byte[] data); IMagickImage<TQuantumType> Create(byte[] data, int offset, int count); IMagickImage<TQuantumType> Create(byte[] data, int offset, int count, IMagickReadSettings<TQuantumType> readSettings); IMagickImage<TQuantumType> Create(byte[] data, int offset, int count, IPixelReadSettings<TQuantumType> settings); IMagickImage<TQuantumType> Create(byte[] data, IMagickReadSettings<TQuantumType> readSettings); IMagickImage<TQuantumType> Create(byte[] data, IPixelReadSettings<TQuantumType> settings); IMagickImage<TQuantumType> Create(FileInfo file); IMagickImage<TQuantumType> Create(FileInfo file, IMagickReadSettings<TQuantumType> readSettings); IMagickImage<TQuantumType> Create(FileInfo file, IPixelReadSettings<TQuantumType> settings); IMagickImage<TQuantumType> Create(IMagickColor<TQuantumType> color, int width, int height); IMagickImage<TQuantumType> Create(Stream stream); IMagickImage<TQuantumType> Create(Stream stream, IMagickReadSettings<TQuantumType> readSettings); IMagickImage<TQuantumType> Create(Stream stream, IPixelReadSettings<TQuantumType> settings); IMagickImage<TQuantumType> Create(string fileName); IMagickImage<TQuantumType> Create(string fileName, int width, int height); IMagickImage<TQuantumType> Create(string fileName, IMagickReadSettings<TQuantumType> readSettings); IMagickImage<TQuantumType> Create(string fileName, IPixelReadSettings<TQuantumType> settings); } public interface IMagickImageInfoFactory { IMagickImageInfo Create(); IMagickImageInfo Create(byte[] data); IMagickImageInfo Create(byte[] data, int offset, int count); IMagickImageInfo Create(FileInfo file); IMagickImageInfo Create(Stream stream); IMagickImageInfo Create(string fileName); } public interface IMatrixFactory { IMagickColorMatrix CreateColorMatrix(int order); IMagickColorMatrix CreateColorMatrix(int order, params double[] values); IConvolveMatrix CreateConvolveMatrix(int order); IConvolveMatrix CreateConvolveMatrix(int order, params double[] values); } public interface ISettingsFactory<TQuantumType> where TQuantumType : struct { ICompareSettings<TQuantumType> CreateCompareSettings(); IComplexSettings CreateComplexSettings(); IConnectedComponentsSettings CreateConnectedComponentsSettings(); IDeskewSettings CreateDeskewSettings(); IDistortSettings CreateDistortSettings(); IKmeansSettings CreateKmeansSettings(); IMagickReadSettings<TQuantumType> CreateMagickReadSettings(); IMontageSettings<TQuantumType> CreateMontageSettings(); IMorphologySettings CreateMorphologySettings(); IPixelReadSettings<TQuantumType> CreatePixelReadSettings(); IQuantizeSettings CreateQuantizeSettings(); } internal static class XmlHelper { public static XmlReaderSettings CreateReaderSettings() { return new XmlReaderSettings { XmlResolver = null }; } public static XmlDocument CreateDocument() { return new XmlDocument { XmlResolver = null }; } public static XmlElement CreateElement(XmlNode node, string name) { XmlElement xmlElement = (((object)node.GetType() == typeof(XmlDocument)) ? ((XmlDocument)node) : node.OwnerDocument).CreateElement(name); node.AppendChild(xmlElement); return xmlElement; } public static void SetAttribute<TType>(XmlElement element, string name, TType value) { XmlAttribute xmlAttribute = ((!element.HasAttribute(name)) ? element.Attributes.Append(element.OwnerDocument.CreateAttribute(name)) : element.Attributes[name]); if ((object)typeof(TType) == typeof(string)) { xmlAttribute.Value = (string)(object)value; } else { xmlAttribute.Value = (string)Convert.ChangeType(value, typeof(string), CultureInfo.InvariantCulture); } } } internal static class ByteConverter { public static int ToUInt(byte[] data, ref int offset) { if (offset + 4 > data.Length) { return 0; } int num = (int)(((data[offset++] << 24) | (data[offset++] << 16) | (data[offset++] << 8) | data[offset++]) & 0xFFFFFFFFu); if (num >= 0) { return num; } return 0; } public static short ToShort(byte[] data, ref int offset) { if (offset + 2 > data.Length) { return 0; } return (short)((short)((short)(data[offset++] << 8) | data[offset++]) & 0xFFFF); } } public interface IMagickFormatInfo : IEquatable<IMagickFormatInfo> { bool CanReadMultithreaded { get; } bool CanWriteMultithreaded { get; } string? Description { get; } MagickFormat Format { get; } bool IsMultiFrame { get; } bool IsReadable { get; } bool IsWritable { get; } string? MimeType { get; } MagickFormat ModuleFormat { get; } new string ToString(); bool Unregister(); } public interface IMagickImage : IDisposable { int AnimationDelay { get; set; } int AnimationIterations { get; set; } int AnimationTicksPerSecond { get; set; } IEnumerable<string> ArtifactNames { get; } IEnumerable<string> AttributeNames { get; } int BaseHeight { get; } int BaseWidth { get; } bool BlackPointCompensation { get; set; } IMagickGeometry? BoundingBox { get; } int ChannelCount { get; } IEnumerable<PixelChannel> Channels { get; } IPrimaryInfo? ChromaBluePrimary { get; set; } IPrimaryInfo? ChromaGreenPrimary { get; set; } IPrimaryInfo? ChromaRedPrimary { get; set; } IPrimaryInfo? ChromaWhitePoint { get; set; } ClassType ClassType { get; set; } Percentage ColorFuzz { get; set; } int ColormapSize { get; set; } ColorSpace ColorSpace { get; set; } ColorType ColorType { get; set; } string? Comment { get; set; } CompositeOperator Compose { get; set; } CompressionMethod Compression { get; } Density Density { get; set; } int Depth { get; set; } IMagickGeometry? EncodingGeometry { get; } Endian Endian { get; set; } string? FileName { get; } FilterType FilterType { get; set; } MagickFormat Format { get; set; } IMagickFormatInfo? FormatInfo { get; } double Gamma { get; } GifDisposeMethod GifDisposeMethod { get; set; } bool HasClippingPath { get; } bool HasAlpha { get; set; } int Height { get; } Interlace Interlace { get; set; } PixelInterpolateMethod Interpolate { get; set; } bool IsDisposed { get; } bool IsOpaque { get; } string? Label { get; set; } OrientationType Orientation { get; set; } IMagickGeometry Page { get; set; } IEnumerable<string> ProfileNames { get; } int Quality { get; set; } RenderingIntent RenderingIntent { get; set; } string Signature { get; } int TotalColors { get; } VirtualPixelMethod VirtualPixelMethod { get; set; } int Width { get; } event EventHandler<ProgressEventArgs> Progress; event EventHandler<WarningEventArgs> Warning; void AdaptiveBlur(); void AdaptiveBlur(double radius); void AdaptiveBlur(double radius, double sigma); void AdaptiveResize(int width, int height); void AdaptiveResize(IMagickGeometry geometry); void AdaptiveSharpen(); void AdaptiveSharpen(Channels channels); void AdaptiveSharpen(double radius, double sigma); void AdaptiveSharpen(double radius, double sigma, Channels channels); void AdaptiveThreshold(int width, int height); void AdaptiveThreshold(int width, int height, Channels channels); void AdaptiveThreshold(int width, int height, double bias); void AdaptiveThreshold(int width, int height, double bias, Channels channels); void AdaptiveThreshold(int width, int height, Percentage biasPercentage); void AdaptiveThreshold(int width, int height, Percentage biasPercentage, Channels channels); void AddNoise(NoiseType noiseType); void AddNoise(NoiseType noiseType, Channels channels); void AddNoise(NoiseType noiseType, double attenuate); void AddNoise(NoiseType noiseType, double attenuate, Channels channels); void AffineTransform(IDrawableAffine affineMatrix); void Alpha(AlphaOption value); void Annotate(string text, IMagickGeometry boundingArea); void Annotate(string text, IMagickGeometry boundingArea, Gravity gravity); void Annotate(string text, IMagickGeometry boundingArea, Gravity gravity, double angle); void Annotate(string text, Gravity gravity); void AutoGamma(); void AutoGamma(Channels channels); void AutoLevel(); void AutoLevel(Channels channels); void AutoOrient(); void AutoThreshold(AutoThresholdMethod method); void BilateralBlur(int width, int height); void BilateralBlur(int width, int height, double intensitySigma, double spatialSigma); void BlackThreshold(Percentage threshold); void BlackThreshold(Percentage threshold, Channels channels); void BlueShift(); void BlueShift(double factor); int BitDepth(); int BitDepth(Channels channels); void BitDepth(Channels channels, int value); void BitDepth(int value); void Blur(); void Blur(Channels channels); void Blur(double radius, double sigma); void Blur(double radius, double sigma, Channels channels); void Border(int size); void Border(int width, int height); void BrightnessContrast(Percentage brightness, Percentage contrast); void BrightnessContrast(Percentage brightness, Percentage contrast, Channels channels); void CannyEdge(); void CannyEdge(double radius, double sigma, Percentage lower, Percentage upper); void Charcoal(); void Charcoal(double radius, double sigma); void Chop(IMagickGeometry geometry); void ChopHorizontal(int offset, int width); void ChopVertical(int offset, int height); void Clahe(Percentage xTiles, Percentage yTiles, int numberBins, double clipLimit); void Clahe(int xTiles, int yTiles, int numberBins, double clipLimit); void Clamp(); void Clamp(Channels channels); void Clip(); void Clip(string pathName, bool inside); void Clut(IMagickImage image); void Clut(IMagickImage image, PixelInterpolateMethod method); void Clut(IMagickImage image, PixelInterpolateMethod method, Channels channels); void ColorDecisionList(string fileName); void ColorMatrix(IMagickColorMatrix matrix); IMagickErrorInfo Compare(IMagickImage image); double Compare(IMagickImage image, ErrorMetric metric); double Compare(IMagickImage image, ErrorMetric metric, Channels channels); double Compare(IMagickImage image, ErrorMetric metric, IMagickImage difference); double Compare(IMagickImage image, ErrorMetric metric, IMagickImage difference, Channels channels); void Composite(IMagickImage image); void Composite(IMagickImage image, Channels channels); void Composite(IMagickImage image, CompositeOperator compose); void Composite(IMagickImage image, CompositeOperator compose, Channels channels); void Composite(IMagickImage image, CompositeOperator compose, string? args); void Composite(IMagickImage image, CompositeOperator compose, string? args, Channels channels); void Composite(IMagickImage image, int x, int y); void Composite(IMagickImage image, int x, int y, Channels channels); void Composite(IMagickImage image, int x, int y, CompositeOperator compose); void Composite(IMagickImage image, int x, int y, CompositeOperator compose, Channels channels); void Composite(IMagickImage image, int x, int y, CompositeOperator compose, string? args); void Composite(IMagickImage image, int x, int y, CompositeOperator compose, string? args, Channels channels); void Composite(IMagickImage image, PointD offset); void Composite(IMagickImage image, PointD offset, Channels channels); void Composite(IMagickImage image, PointD offset, CompositeOperator compose); void Composite(IMagickImage image, PointD offset, CompositeOperator compose, Channels channels); void Composite(IMagickImage image, PointD offset, CompositeOperator compose, string? args); void Composite(IMagickImage image, PointD offset, CompositeOperator compose, string? args, Channels channels); void Composite(IMagickImage image, Gravity gravity); void Composite(IMagickImage image, Gravity gravity, Channels channels); void Composite(IMagickImage image, Gravity gravity, CompositeOperator compose); void Composite(IMagickImage image, Gravity gravity, CompositeOperator compose, Channels channels); void Composite(IMagickImage image, Gravity gravity, CompositeOperator compose, string? args); void Composite(IMagickImage image, Gravity gravity, CompositeOperator compose, string? args, Channels channels); void Composite(IMagickImage image, Gravity gravity, int x, int y); void Composite(IMagickImage image, Gravity gravity, int x, int y, Channels channels); void Composite(IMagickImage image, Gravity gravity, int x, int y, CompositeOperator compose); void Composite(IMagickImage image, Gravity gravity, int x, int y, CompositeOperator compose, Channels channels); void Composite(IMagickImage image, Gravity gravity, int x, int y, CompositeOperator compose, string? args); void Composite(IMagickImage image, Gravity gravity, int x, int y, CompositeOperator compose, string? args, Channels channels); void Composite(IMagickImage image, Gravity gravity, PointD offset); void Composite(IMagickImage image, Gravity gravity, PointD offset, Channels channels); void Composite(IMagickImage image, Gravity gravity, PointD offset, CompositeOperator compose); void Composite(IMagickImage image, Gravity gravity, PointD offset, CompositeOperator compose, Channels channels); void Composite(IMagickImage image, Gravity gravity, PointD offset, CompositeOperator compose, string? args); void Composite(IMagickImage image, Gravity gravity, PointD offset, CompositeOperator compose, string? args, Channels channels); void Contrast(); void Contrast(bool enhance); void ContrastStretch(Percentage blackPoint); void ContrastStretch(Percentage blackPoint, Percentage whitePoint); void ContrastStretch(Percentage blackPoint, Percentage whitePoint, Channels channels); IEnumerable<PointD> ConvexHull(); void Convolve(IConvolveMatrix convolveMatrix); void CopyPixels(IMagickImage source); void CopyPixels(IMagickImage source, Channels channels); void CopyPixels(IMagickImage source, IMagickGeometry geometry); void CopyPixels(IMagickImage source, IMagickGeometry geometry, Channels channels); void CopyPixels(IMagickImage source, IMagickGeometry geometry, PointD offset); void CopyPixels(IMagickImage source, IMagickGeometry geometry, PointD offset, Channels channels); void CopyPixels(IMagickImage source, IMagickGeometry geometry, int x, int y); void CopyPixels(IMagickImage source, IMagickGeometry geometry, int x, int y, Channels channels); void Crop(int width, int height); void Crop(int width, int height, Gravity gravity); void Crop(IMagickGeometry geometry); void Crop(IMagickGeometry geometry, Gravity gravity); void CycleColormap(int amount); void Decipher(string passphrase); double Deskew(Percentage threshold); double Deskew(IDeskewSettings settings); void Despeckle(); ColorType DetermineColorType(); void Distort(DistortMethod method, params double[] arguments); void Distort(DistortMethod method, IDistortSettings settings, params double[] arguments); void Draw(params IDrawable[] drawables); void Draw(IEnumerable<IDrawable> drawables); void Edge(double radius); void Emboss(); void Emboss(double radius, double sigma); void Encipher(string passphrase); void Enhance(); void Equalize(); void Evaluate(Channels channels, EvaluateFunction evaluateFunction, params double[] arguments); void Evaluate(Channels channels, EvaluateOperator evaluateOperator, double value); void Evaluate(Channels channels, EvaluateOperator evaluateOperator, Percentage percentage); void Evaluate(Channels channels, IMagickGeometry geometry, EvaluateOperator evaluateOperator, double value); void Evaluate(Channels channels, IMagickGeometry geometry, EvaluateOperator evaluateOperator, Percentage percentage); void Extent(int width, int height); void Extent(int x, int y, int width, int height); void Extent(int width, int height, Gravity gravity); void Extent(IMagickGeometry geometry); void Extent(IMagickGeometry geometry, Gravity gravity); void Flip(); void Flop(); ITypeMetric? FontTypeMetrics(string text); ITypeMetric? FontTypeMetrics(string text, bool ignoreNewlines); string? FormatExpression(string expression); void Frame(); void Frame(IMagickGeometry geometry); void Frame(int width, int height); void Frame(int width, int height, int innerBevel, int outerBevel); void Fx(string expression); void Fx(string expression, Channels channels); void GammaCorrect(double gamma); void GammaCorrect(double gamma, Channels channels); void GaussianBlur(double radius); void GaussianBlur(double radius, Channels channels); void GaussianBlur(double radius, double sigma); void GaussianBlur(double radius, double sigma, Channels channels); IEightBimProfile? Get8BimProfile(); string? GetArtifact(string name); string? GetAttribute(string name); string? GetClippingPath(); string? GetClippingPath(string pathName); IColorProfile? GetColorProfile(); IExifProfile? GetExifProfile(); IIptcProfile? GetIptcProfile(); IImageProfile? GetProfile(string name); IXmpProfile? GetXmpProfile(); void Grayscale(); void Grayscale(PixelIntensityMethod method); void HaldClut(IMagickImage image); bool HasProfile(string name); void HoughLine(); void HoughLine(int width, int height, int threshold); void Implode(double amount, PixelInterpolateMethod method); void InterpolativeResize(int width, int height, PixelInterpolateMethod method); void InterpolativeResize(IMagickGeometry geometry, PixelInterpolateMethod method); void InterpolativeResize(Percentage percentage, PixelInterpolateMethod method); void InterpolativeResize(Percentage percentageWidth, Percentage percentageHeight, PixelInterpolateMethod method); void InverseLevel(Percentage blackPointPercentage, Percentage whitePointPercentage); void InverseLevel(Percentage blackPointPercentage, Percentage whitePointPercentage, Channels channels); void InverseLevel(Percentage blackPointPercentage, Percentage whitePointPercentage, double midpoint); void InverseLevel(Percentage blackPointPercentage, Percentage whitePointPercentage, double midpoint, Channels channels); void Kmeans(IKmeansSettings settings); void Kuwahara(); void Kuwahara(double radius, double sigma); void Level(Percentage blackPointPercentage, Percentage whitePointPercentage); void Level(Percentage blackPointPercentage, Percentage whitePointPercentage, Channels channels); void Level(Percentage blackPointPercentage, Percentage whitePointPercentage, double gamma); void Level(Percentage blackPointPercentage, Percentage whitePointPercentage, double gamma, Channels channels); void LinearStretch(Percentage blackPoint, Percentage whitePoint); void LiquidRescale(int width, int height); void LiquidRescale(int width, int height, double deltaX, double rigidity); void LiquidRescale(IMagickGeometry geometry); void LiquidRescale(Percentage percentage); void LiquidRescale(Percentage percentageWidth, Percentage percentageHeight); void LiquidRescale(Percentage percentageWidth, Percentage percentageHeight, double deltaX, double rigidity); void LocalContrast(double radius, Percentage strength); void LocalContrast(double radius, Percentage strength, Channels channels); void Lower(int size); void Magnify(); IMagickErrorInfo Map(IMagickImage image); IMagickErrorInfo Map(IMagickImage image, IQuantizeSettings settings); void MeanShift(int size); void MeanShift(int size, Percentage colorDistance); void MeanShift(int width, int height); void MeanShift(int width, int height, Percentage colorDistance); void MedianFilter(); void MedianFilter(int radius); void Minify(); IEnumerable<PointD> MinimumBoundingBox(); void Modulate(Percentage brightness); void Modulate(Percentage brightness, Percentage saturation); void Modulate(Percentage brightness, Percentage saturation, Percentage hue); void Morphology(MorphologyMethod method, Kernel kernel); void Morphology(MorphologyMethod method, Kernel kernel, Channels channels); void Morphology(MorphologyMethod method, Kernel kernel, Channels channels, int iterations); void Morphology(MorphologyMethod method, Kernel kernel, int iterations); void Morphology(MorphologyMethod method, Kernel kernel, string? arguments); void Morphology(MorphologyMethod method, Kernel kernel, string? arguments, Channels channels); void Morphology(MorphologyMethod method, Kernel kernel, string? arguments, Channels channels, int iterations); void Morphology(MorphologyMethod method, Kernel kernel, string? arguments, int iterations); void Morphology(MorphologyMethod method, string userKernel); void Morphology(MorphologyMethod method, string userKernel, Channels channels); void Morphology(MorphologyMethod method, string userKernel, Channels channels, int iterations); void Morphology(MorphologyMethod method, string userKernel, int iterations); void Morphology(IMorphologySettings settings); IMoments Moments(); void MotionBlur(double radius, double sigma, double angle); void Negate(); void Negate(bool onlyGrayscale); void Negate(bool onlyGrayscale, Channels channels); void Negate(Channels channels); void Normalize(); void OilPaint(); void OilPaint(double radius, double sigma); void OrderedDither(string thresholdMap); void OrderedDither(string thresholdMap, Channels channels); void Perceptible(double epsilon); void Perceptible(double epsilon, Channels channels); IPerceptualHash? PerceptualHash(); void Ping(byte[] data); void Ping(byte[] data, int offset, int count); void Ping(FileInfo file); void Ping(Stream stream); void Ping(string fileName); void Polaroid(string caption, double angle, PixelInterpolateMethod method); void Posterize(int levels); void Posterize(int levels, DitherMethod method); void Posterize(int levels, DitherMethod method, Channels channels); void Posterize(int levels, Channels channels); void PreserveColorType(); IMagickErrorInfo? Quantize(IQuantizeSettings settings); void Raise(int size); void RandomThreshold(Percentage percentageLow, Percentage percentageHigh); void RandomThreshold(Percentage percentageLow, Percentage percentageHigh, Channels channels); void RangeThreshold(Percentage percentageLowBlack, Percentage percentageLowWhite, Percentage percentageHighWhite, Percentage percentageHighBlack); void Read(byte[] data); void Read(byte[] data, int offset, int count); void Read(byte[] data, int offset, int count, MagickFormat format); void Read(byte[] data, MagickFormat format); void Read(FileInfo file); void Read(FileInfo file, int width, int height); void Read(FileInfo file, MagickFormat format); void Read(Stream stream); void Read(Stream stream, MagickFormat format); void Read(string fileName); void Read(string fileName, int width, int height); void Read(string fileName, MagickFormat format); void ReduceNoise(); void ReduceNoise(int order); void RegionMask(IMagickGeometry region); void RemoveArtifact(string name); void RemoveAttribute(string name); void RemoveRegionMask(); void RemoveProfile(IImageProfile profile); void RemoveProfile(string name); void RemoveReadMask(); void RemoveWriteMask(); void RePage(); void Resample(double resolutionX, double resolutionY); void Resample(PointD density); void Resize(int width, int height); void Resize(IMagickGeometry geometry); void Resize(Percentage percentage); void Resize(Percentage percentageWidth, Percentage percentageHeight); void Roll(int x, int y); void Rotate(double degrees); void RotationalBlur(double angle); void RotationalBlur(double angle, Channels channels); void Sample(int width, int height); void Sample(IMagickGeometry geometry); void Sample(Percentage percentage); void Sample(Percentage percentageWidth, Percentage percentageHeight); void Scale(int width, int height); void Scale(IMagickGeometry geometry); void Scale(Percentage percentage); void Scale(Percentage percentageWidth, Percentage percentageHeight); void Segment(); void Segment(ColorSpace quantizeColorSpace, double clusterThreshold, double smoothingThreshold); void SelectiveBlur(double radius, double sigma, double threshold); void SelectiveBlur(double radius, double sigma, double threshold, Channels channels); void SelectiveBlur(double radius, double sigma, Percentage thresholdPercentage); void SelectiveBlur(double radius, double sigma, Percentage thresholdPercentage, Channels channels); void SepiaTone(); void SepiaTone(Percentage threshold); void SetArtifact(string name, string value); void SetArtifact(string name, bool flag); void SetAttenuate(double attenuate); void SetAttribute(string name, string value); void SetAttribute(string name, bool flag); void SetClippingPath(string value); void SetClippingPath(string value, string pathName); void SetCompression(CompressionMethod compression); void SetProfile(IImageProfile profile); void SetProfile(IColorProfile profile); void SetProfile(IColorProfile profile, ColorTransformMode mode); void SetReadMask(IMagickImage image); void SetWriteMask(IMagickImage image); void Shadow(int x, int y, double sigma, Percentage alpha); void Sharpen(); void Sharpen(Channels channels); void Sharpen(double radius, double sigma); void Sharpen(double radius, double sigma, Channels channels); void Shave(int leftRight, int topBottom); void Shear(double xAngle, double yAngle); void SigmoidalContrast(double contrast); void SigmoidalContrast(bool sharpen, double contrast); void SigmoidalContrast(double contrast, double midpoint); void SigmoidalContrast(bool sharpen, double contrast, double midpoint); void SigmoidalContrast(double contrast, Percentage midpointPercentage); void SigmoidalContrast(bool sharpen, double contrast, Percentage midpointPercentage); void Sketch(); void Sketch(double radius, double sigma, double angle); void Solarize(); void Solarize(double factor); void SortPixels(); void Solarize(Percentage factorPercentage); void Splice(IMagickGeometry geometry); void Spread(); void Spread(double radius); void Spread(PixelInterpolateMethod method, double radius); void Statistic(StatisticType type, int width, int height); IStatistics Statistics(); IStatistics Statistics(Channels channels); void Shade(); void Shade(double azimuth, double elevation); void Shade(double azimuth, double elevation, bool colorShading); void Shade(double azimuth, double elevation, bool colorShading, Channels channels); void Shadow(); void Stegano(IMagickImage watermark); void Stereo(IMagickImage rightImage); void Strip(); void Swirl(double degrees); void Swirl(PixelInterpolateMethod method, double degrees); void Texture(IMagickImage image); void Threshold(Percentage percentage); void Threshold(Percentage percentage, Channels channels); void Thumbnail(int width, int height); void Thumbnail(IMagickGeometry geometry); void Thumbnail(Percentage percentage); void Thumbnail(Percentage percentageWidth, Percentage percentageHeight); void Tile(IMagickImage image, CompositeOperator compose); void Tile(IMagickImage image, CompositeOperator compose, string? args); void Tint(string opacity); string ToBase64(); string ToBase64(MagickFormat format); byte[] ToByteArray(); byte[] ToByteArray(IWriteDefines defines); byte[] ToByteArray(MagickFormat format); bool TransformColorSpace(IColorProfile target); bool TransformColorSpace(IColorProfile target, ColorTransformMode mode); bool TransformColorSpace(IColorProfile source, IColorProfile target); bool TransformColorSpace(IColorProfile source, IColorProfile target, ColorTransformMode mode); void Transpose(); void Transverse(); void Trim(); void Trim(params Gravity[] edges); void Trim(Percentage percentBackground); void UnsharpMask(double radius, double sigma); void UnsharpMask(double radius, double sigma, Channels channels); void UnsharpMask(double radius, double sigma, double amount, double threshold); void UnsharpMask(double radius, double sigma, double amount, double threshold, Channels channels); void Vignette(); void Vignette(double radius, double sigma, int x, int y); void Wave(); void Wave(PixelInterpolateMethod method, double amplitude, double length); void WaveletDenoise(Percentage thresholdPercentage); void WaveletDenoise(Percentage thresholdPercentage, double softness); void WhiteBalance(); void WhiteBalance(Percentage vibrance); void WhiteThreshold(Percentage threshold); void WhiteThreshold(Percentage threshold, Channels channels); void Write(FileInfo file); void Write(FileInfo file, IWriteDefines defines); void Write(FileInfo file, MagickFormat format); void Write(Stream stream); void Write(Stream stream, IWriteDefines defines); void Write(Stream stream, MagickFormat format); void Write(string fileName); void Write(string fileName, IWriteDefines defines); void Write(string fileName, MagickFormat format); } public interface IMagickImageCollection : IDisposable { event EventHandler<WarningEventArgs> Warning; void Add(string fileName); void AddRange(byte[] data); void AddRange(string fileName); void AddRange(Stream stream); void Coalesce(); void Complex(IComplexSettings complexSettings); void Deconstruct(); void Insert(int index, string fileName); void Morph(int frames); void Optimize(); void OptimizePlus(); void OptimizeTransparency(); void Ping(byte[] data); void Ping(byte[] data, int offset, int count); void Ping(FileInfo file); void Ping(Stream stream); void Ping(string fileName); IMagickErrorInfo? Quantize(); IMagickErrorInfo? Quantize(IQuantizeSettings settings); void Read(byte[] data); void Read(byte[] data, int offset, int count); void Read(byte[] data, int offset, int count, MagickFormat format); void Read(byte[] data, MagickFormat format); void Read(FileInfo file); void Read(FileInfo file, MagickFormat format); void Read(Stream stream); void Read(Stream stream, MagickFormat format); void Read(string fileName); void Read(string fileName, MagickFormat format); void RePage(); void Reverse(); byte[] ToByteArray(); byte[] ToByteArray(IWriteDefines defines); byte[] ToByteArray(MagickFormat format); string ToBase64(); string ToBase64(MagickFormat format); void TrimBounds(); void Write(FileInfo file); void Write(FileInfo file, IWriteDefines defines); void Write(FileInfo file, MagickFormat format); void Write(Stream stream); void Write(Stream stream, IWriteDefines defines); void Write(Stream stream, MagickFormat format); void Write(string fileName); void Write(string fileName, IWriteDefines defines); void Write(string fileName, MagickFormat format); } public interface IMagickImageCollection<TQuantumType> : IMagickImageCollection, IDisposable, IList<IMagickImage<TQuantumType>>, ICollection<IMagickImage<TQuantumType>>, IEnumerable<IMagickImage<TQuantumType>>, IEnumerable where TQuantumType : struct { void AddRange(byte[] data, IMagickReadSettings<TQuantumType>? readSettings); void AddRange(IEnumerable<IMagickImage<TQuantumType>> images); void AddRange(string fileName, IMagickReadSettings<TQuantumType>? readSettings); void AddRange(Stream stream, IMagickReadSettings<TQuantumType>? readSettings); IMagickImage<TQuantumType> AppendHorizontally(); IMagickImage<TQuantumType> AppendVertically(); IMagickImageCollection<TQuantumType> Clone(); IMagickImage<TQuantumType> Combine(); IMagickImage<TQuantumType> Combine(ColorSpace colorSpace); IMagickImage<TQuantumType> Evaluate(EvaluateOperator evaluateOperator); IMagickImage<TQuantumType> Flatten(); IMagickImage<TQuantumType> Flatten(IMagickColor<TQuantumType> backgroundColor); void Map(IMagickImage<TQuantumType> image); void Map(IMagickImage<TQuantumType> image, IQuantizeSettings settings); IMagickImage<TQuantumType> Merge(); IMagickImage<TQuantumType> Montage(IMontageSettings<TQuantumType> settings); IMagickImage<TQuantumType> Mosaic(); void Ping(byte[] data, int offset, int count, IMagickReadSettings<TQuantumType>? readSettings); void Ping(byte[] data, IMagickReadSettings<TQuantumType>? readSettings); void Ping(FileInfo file, IMagickReadSettings<TQuantumType>? readSettings); void Ping(Stream stream, IMagickReadSettings<TQuantumType>? readSettings); void Ping(string fileName, IMagickReadSettings<TQuantumType>? readSettings); IMagickImage<TQuantumType> Polynomial(double[] terms); void Read(byte[] data, int offset, int count, IMagickReadSettings<TQuantumType>? readSettings); void Read(byte[] data, IMagickReadSettings<TQuantumType>? readSettings); void Read(FileInfo file, IMagickReadSettings<TQuantumType>? readSettings); void Read(Stream stream, IMagickReadSettings<TQuantumType>? readSettings); void Read(string fileName, IMagickReadSettings<TQuantumType>? readSettings); IMagickImage<TQuantumType> SmushHorizontal(int offset); IMagickImage<TQuantumType> SmushVertical(int offset); } public interface IMagickImageInfo { ColorSpace ColorSpace { get; } CompressionMethod Compression { get; } Density? Density { get; } string? FileName { get; } MagickFormat Format { get; } int Height { get; } Interlace Interlace { get; } int Quality { get; } int Width { get; } void Read(byte[] data); void Read(byte[] data, int offset, int count); void Read(FileInfo file); void Read(Stream stream); void Read(string fileName); } public interface IMagickImage<TQuantumType> : IMagickImage, IDisposable, IEquatable<IMagickImage<TQuantumType>>, IComparable<IMagickImage<TQuantumType>> where TQuantumType : struct { IMagickColor<TQuantumType>? BackgroundColor { get; set; } IMagickColor<TQuantumType>? BorderColor { get; set; } IMagickColor<TQuantumType>? MatteColor { get; set; } IMagickSettings<TQuantumType> Settings { get; } IMagickImage<TQuantumType> Clone(); IMagickImage<TQuantumType> Clone(IMagickGeometry geometry); IMagickImage<TQuantumType> Clone(int width, int height); IMagickImage<TQuantumType> Clone(int x, int y, int width, int height); void ColorAlpha(IMagickColor<TQuantumType> color); void Colorize(IMagickColor<TQuantumType> color, Percentage alpha); void Colorize(IMagickColor<TQuantumType> color, Percentage alphaRed, Percentage alphaGreen, Percentage alphaBlue); void ColorThreshold(IMagickColor<TQuantumType> startColor, IMagickColor<TQuantumType> stopColor); double Compare(IMagickImage image, ICompareSettings<TQuantumType> settings, IMagickImage difference); double Compare(IMagickImage image, ICompareSettings<TQuantumType> settings, IMagickImage difference, Channels channels); IEnumerable<IConnectedComponent<TQuantumType>> ConnectedComponents(int connectivity); IEnumerable<IConnectedComponent<TQuantumType>> ConnectedComponents(IConnectedComponentsSettings settings); IEnumerable<IMagickImage<TQuantumType>> CropToTiles(int width, int height); IEnumerable<IMagickImage<TQuantumType>> CropToTiles(IMagickGeometry geometry); void Draw(IDrawables<TQuantumType> drawables); void Extent(int width, int height, IMagickColor<TQuantumType> backgroundColor); void Extent(int width, int height, Gravity gravity, IMagickColor<TQuantumType> backgroundColor); void Extent(IMagickGeometry geometry, IMagickColor<TQuantumType> backgroundColor); void Extent(IMagickGeometry geometry, Gravity gravity, IMagickColor<TQuantumType> backgroundColor); void FloodFill(TQuantumType alpha, int x, int y); void FloodFill(IMagickColor<TQuantumType> color, int x, int y); void FloodFill(IMagickColor<TQuantumType> color, int x, int y, IMagickColor<TQuantumType> target); void FloodFill(IMagickColor<TQuantumType> color, PointD coordinate); void FloodFill(IMagickColor<TQuantumType> color, PointD coordinate, IMagickColor<TQuantumType> target); void FloodFill(IMagickImage<TQuantumType> image, int x, int y); void FloodFill(IMagickImage<TQuantumType> image, int x, int y, IMagickColor<TQuantumType> target); void FloodFill(IMagickImage<TQuantumType> image, PointD coordinate); void FloodFill(IMagickImage<TQuantumType> image, PointD coordinate, IMagickColor<TQuantumType> target); IMagickColor<TQuantumType>? GetColormap(int index); IPixelCollection<TQuantumType> GetPixels(); IUnsafePixelCollection<TQuantumType> GetPixelsUnsafe(); IMagickImage<TQuantumType>? GetReadMask(); IMagickImage<TQuantumType>? GetWriteMask(); Dictionary<IMagickColor<TQuantumType>, int> Histogram(); void InverseFloodFill(TQuantumType alpha, int x, int y); void InverseFloodFill(IMagickColor<TQuantumType> color, int x, int y); void InverseFloodFill(IMagickColor<TQuantumType> color, int x, int y, IMagickColor<TQuantumType> target); void InverseFloodFill(IMagickColor<TQuantumType> color, PointD coordinate); void InverseFloodFill(IMagickColor<TQuantumType> color, PointD coordinate, IMagickColor<TQuantumType> target); void InverseFloodFill(IMagickImage<TQuantumType> image, int x, int y); void InverseFloodFill(IMagickImage<TQuantumType> image, int x, int y, IMagickColor<TQuantumType> target); void InverseFloodFill(IMagickImage<TQuantumType> image, PointD coordinate); void InverseFloodFill(IMagickImage<TQuantumType> image, PointD coordinate, IMagickColor<TQuantumType> target); void InverseLevel(TQuantumType blackPoint, TQuantumType whitePoint); void InverseLevel(TQuantumType blackPoint, TQuantumType whitePoint, Channels channels); void InverseLevel(TQuantumType blackPoint, TQuantumType whitePoint, double midpoint); void InverseLevel(TQuantumType blackPoint, TQuantumType whitePoint, double midpoint, Channels channels); void InverseLevelColors(IMagickColor<TQuantumType> blackColor, IMagickColor<TQuantumType> whiteColor); void InverseLevelColors(IMagickColor<TQuantumType> blackColor, IMagickColor<TQuantumType> whiteColor, Channels channels); void InverseOpaque(IMagickColor<TQuantumType> target, IMagickColor<TQuantumType> fill); void InverseTransparent(IMagickColor<TQuantumType> color); void InverseTransparentChroma(IMagickColor<TQuantumType> colorLow, IMagickColor<TQuantumType> colorHigh); void Level(TQuantumType blackPoint, TQuantumType whitePoint); void Level(TQuantumType blackPoint, TQuantumType whitePoint, Channels channels); void Level(TQuantumType blackPoint, TQuantumType whitePoint, double gamma); void Level(TQuantumType blackPoint, TQuantumType whitePoint, double gamma, Channels channels); void LevelColors(IMagickColor<TQuantumType> blackColor, IMagickColor<TQuantumType> whiteColor); void LevelColors(IMagickColor<TQuantumType> blackColor, IMagickColor<TQuantumType> whiteColor, Channels channels); IMagickErrorInfo Map(IEnumerable<IMagickColor<TQuantumType>> colors); IMagickErrorInfo Map(IEnumerable<IMagickColor<TQuantumType>> colors, IQuantizeSettings settings); void Opaque(IMagickColor<TQuantumType> target, IMagickColor<TQuantumType> fill); void Ping(byte[] data, int offset, int count, IMagickReadSettings<TQuantumType>? readSettings); void Ping(byte[] data, IMagickReadSettings<TQuantumType>? readSettings); void Ping(FileInfo file, IMagickReadSettings<TQuantumType>? readSettings); void Ping(Stream stream, IMagickReadSettings<TQuantumType>? readSettings); void Ping(string fileName, IMagickReadSettings<TQuantumType>? readSettings); void RandomThreshold(TQuantumType low, TQuantumType high); void RandomThreshold(TQuantumType low, TQuantumType high, Channels channels); void RangeThreshold(TQuantumType lowBlack, TQuantumType lowWhite, TQuantumType highWhite, TQuantumType highBlack); void Read(byte[] data, int offset, int count, IMagickReadSettings<TQuantumType>? readSettings); void Read(byte[] data, IMagickReadSettings<TQuantumType>? readSettings); void Read(FileInfo file, IMagickReadSettings<TQuantumType>? readSettings); void Read(IMagickColor<TQuantumType> color, int width, int height); void Read(Stream stream, IMagickReadSettings<TQuantumType>? readSettings); void Read(string fileName, IMagickReadSettings<TQuantumType>? readSettings); void ReadPixels(byte[] data, IPixelReadSettings<TQuantumType>? settings); void ReadPixels(byte[] data, int offset, int count, IPixelReadSettings<TQuantumType>? settings); void ReadPixels(FileInfo file, IPixelReadSettings<TQuantumType>? settings); void ReadPixels(Stream stream, IPixelReadSettings<TQuantumType>? settings); void ReadPixels(string fileName, IPixelReadSettings<TQuantumType>? settings); IEnumerable<IMagickImage<TQuantumType>> Separate(); IEnumerable<IMagickImage<TQuantumType>> Separate(Channels channels); void SetColormap(int index, IMagickColor<TQuantumType> color); void Shadow(IMagickColor<TQuantumType> color); void Shadow(int x, int y, double sigma, Percentage alpha, IMagickColor<TQuantumType> color); void SparseColor(SparseColorMethod method, IEnumerable<ISparseColorArg<TQuantumType>> args); void SparseColor(SparseColorMethod method, params ISparseColorArg<TQuantumType>[] args); void SparseColor(Channels channels, SparseColorMethod method, IEnumerable<ISparseColorArg<TQuantumType>> args); void SparseColor(Channels channels, SparseColorMethod method, params ISparseColorArg<TQuantumType>[] args); IMagickSearchResult<TQuantumType> SubImageSearch(IMagickImage<TQuantumType> image); IMagickSearchResult<TQuantumType> SubImageSearch(IMagickImage<TQuantumType> image, ErrorMetric metric); IMagickSearchResult<TQuantumType> SubImageSearch(IMagickImage<TQuantumType> image, ErrorMetric metric, double similarityThreshold); void Tint(string opacity, IMagickColor<TQuantumType> color); void Transparent(IMagickColor<TQuantumType> color); void TransparentChroma(IMagickColor<TQuantumType> colorLow, IMagickColor<TQuantumType> colorHigh); IMagickImage<TQuantumType>? UniqueColors(); void WaveletDenoise(TQuantumType threshold); void WaveletDenoise(TQuantumType threshold, double softness); } public interface IConvolveMatrix : IDoubleMatrix { } public interface IDoubleMatrix { int Order { get; } double this[int x, int y] { get; set; } double GetValue(int x, int y); void SetColumn(int x, params double[] values); void SetRow(int y, params double[] values); void SetValue(int x, int y, double value); double[] ToArray(); } public interface IMagickColorMatrix : IDoubleMatrix { } public interface IOpenCLDevice { double BenchmarkScore { get; } OpenCLDeviceType DeviceType { get; } bool IsEnabled { get; set; } IEnumerable<IOpenCLKernelProfileRecord> KernelProfileRecords { get; } string Name { get; } bool ProfileKernels { get; set; } string Version { get; } } public interface IOpenCLKernelProfileRecord { long AverageDuration { get; } long Count { get; } long MaximumDuration { get; } long MinimumDuration { get; } string Name { get; } long TotalDuration { get; } } public interface IPixelCollection<TQuantumType> : IEnumerable<IPixel<TQuantumType>>, IEnumerable, IDisposable where TQuantumType : struct { int Channels { get; } IPixel<TQuantumType>? this[int x, int y] { get; } TQuantumType[]? GetArea(int x, int y, int width, int height); TQuantumType[]? GetArea(IMagickGeometry geometry); int GetIndex(PixelChannel channel); IPixel<TQuantumType> GetPixel(int x, int y); TQuantumType[]? GetValue(int x, int y); TQuantumType[]? GetValues(); void SetArea(int x, int y, int width, int height, TQuantumType[] values); void SetArea(IMagickGeometry geometry, TQuantumType[] values); void SetByteArea(int x, int y, int width, int height, byte[] values); void SetByteArea(IMagickGeometry geometry, byte[] values); void SetBytePixels(byte[] values); void SetDoubleArea(int x, int y, int width, int height, double[] values); void SetDoubleArea(IMagickGeometry geometry, double[] values); void SetDoublePixels(double[] values); void SetIntArea(int x, int y, int width, int height, int[] values); void SetIntArea(IMagickGeometry geometry, int[] values); void SetIntPixels(int[] values); void SetPixel(IPixel<TQuantumType> pixel); void SetPixel(IEnumerable<IPixel<TQuantumType>> pixels); void SetPixel(int x, int y, TQuantumType[] value); void SetPixels(TQuantumType[] values); TQuantumType[]? ToArray(); byte[]? ToByteArray(int x, int y, int width, int height, string mapping); byte[]? ToByteArray(int x, int y, int width, int height, PixelMapping mapping); byte[]? ToByteArray(IMagickGeometry geometry, string mapping); byte[]? ToByteArray(IMagickGeometry geometry, PixelMapping mapping); byte[]? ToByteArray(string mapping); byte[]? ToByteArray(PixelMapping mapping); ushort[]? ToShortArray(int x, int y, int width, int height, string mapping); ushort[]? ToShortArray(int x, int y, int width, int height, PixelMapping mapping); ushort[]? ToShortArray(IMagickGeometry geometry, string mapping); ushort[]? ToShortArray(IMagickGeometry geometry, PixelMapping mapping); ushort[]? ToShortArray(string mapping); ushort[]? ToShortArray(PixelMapping mapping); } public interface IPixel<TQuantumType> : IEquatable<IPixel<TQuantumType>> where TQuantumType : struct { int Channels { get; } int X { get; } int Y { get; } TQuantumType this[int channel] { get; set; } TQuantumType GetChannel(int channel); void SetChannel(int channel, TQuantumType value); void SetValues(TQuantumType[] values); TQuantumType[] ToArray(); IMagickColor<TQuantumType>? ToColor(); } public interface IUnsafePixelCollection<TQuantumType> : IPixelCollection<TQuantumType>, IEnumerable<IPixel<TQuantumType>>, IEnumerable, IDisposable where TQuantumType : struct { IntPtr GetAreaPointer(int x, int y, int width, int height); IntPtr GetAreaPointer(IMagickGeometry geometry); } public sealed class ClipPath : IClipPath { public string Name { get; } public IXPathNavigable Path { get; } internal ClipPath(string name, IXPathNavigable path) { Name = name; Path = path; } } internal sealed class ClipPathReader { private readonly int _height; private readonly int _width; private readonly int _offset; private readonly PointD[] _first = new PointD[3]; private readonly PointD[] _last = new PointD[3]; private readonly StringBuilder _path = new StringBuilder(); private int _index; private bool _inSubpath; private int _knotCount; public ClipPathReader(int width, int height, int offset) { _width = width; _height = height; _offset = offset; _index = _offset; } public static string Read(int width, int height, byte[] data, int offset, int length) { return new ClipPathReader(width, height, offset).Read(data, length); } private string Read(byte[] data, int length) { while (_index < _offset + length) { switch (ByteConverter.ToShort(data, ref _index)) { case 0: case 3: SetKnotCount(data); break; case 1: case 2: case 4: case 5: AddPath(data); break; default: _index += 24; break; } } return _path.ToString(); } private void AddPath(byte[] data) { if (_knotCount == 0) { _index += 24; return; } PointD[] array = CreatePoint(data); if (!_inSubpath) { _path.AppendFormat(CultureInfo.InvariantCulture, "M {0:0.###} {1:0.###}\n", new object[2] { array[1].X, array[1].Y }); for (int i = 0; i < 3; i++) { _first[i] = array[i]; _last[i] = array[i]; } } else { if (_last[1].X == _last[2].X && _last[1].Y == _last[2].Y && array[0].X == array[1].X && array[0].Y == array[1].Y) { _path.AppendFormat(CultureInfo.InvariantCulture, "L {0:0.###} {1:0.###}\n", new object[2] { array[1].X, array[1].Y }); } else { _path.AppendFormat(CultureInfo.InvariantCulture, "C {0:0.###} {1:0.###} {2:0.###} {3:0.###} {4:0.###} {5:0.###}\n", _last[2].X, _last[2].Y, array[0].X, array[0].Y, array[1].X, array[1].Y); } for (int j = 0; j < 3; j++) { _last[j] = array[j]; } } _inSubpath = true; _knotCount--; if (_knotCount == 0) { ClosePath(); _inSubpath = false; } } private void ClosePath() { if (_last[1].X == _last[2].X && _last[1].Y == _last[2].Y && _first[0].X == _first[1].X && _first[0].Y == _first[1].Y) { _path.AppendFormat(CultureInfo.InvariantCulture, "L {0:0.###} {1:0.###} Z\n", new object[2] { _first[1].X, _first[1].Y }); return; } _path.AppendFormat(CultureInfo.InvariantCulture, "C {0:0.###} {1:0.###} {2:0.###} {3:0.###} {4:0.###} {5:0.###} Z\n", _last[2].X, _last[2].Y, _first[0].X, _first[0].Y, _first[1].X, _first[1].Y); } private PointD[] CreatePoint(byte[] data) { PointD[] array = new PointD[3]; for (int i = 0; i < 3; i++) { uint num = (uint)ByteConverter.ToUInt(data, ref _index); int num2 = (int)num; if (num > int.MaxValue) { num2 = (int)num - -1 - 1; } uint num3 = (uint)ByteConverter.ToUInt(data, ref _index); int num4 = (int)num3; if (num3 > int.MaxValue) { num4 = (int)num3 - -1 - 1; } array[i] = new PointD((double)num4 * (double)_width / 4096.0 / 4096.0, (double)num2 * (double)_height / 4096.0 / 4096.0); } return array; } private void Reset(int offset) { _index = offset; } private void SetKnotCount(byte[] data) { if (_knotCount != 0) { _index += 24; return; } _knotCount = ByteConverter.ToShort(data, ref _index); _index += 22; } } public sealed class EightBimProfile : ImageProfile, IEightBimProfile, IImageProfile, IEquatable<IImageProfile> { private readonly int _height; private readonly int _width; private Collection<IClipPath>? _clipPaths; private Collection<IEightBimValue>? _values; public IEnumerable<IClipPath> ClipPaths { get { Initialize(); return _clipPaths; } } public IEnumerable<IEightBimValue> Values { get { Initialize(); return _values; } } public EightBimProfile(byte[] data) : base("8bim", data) { } public EightBimProfile(string fileName) : base("8bim", fileName) { } public EightBimProfile(Stream stream) : base("8bim", stream) { } public EightBimProfile(IMagickImage image, byte[] data) : base("8bim", data) { Throw.IfNull("image", image); _width = image.Width; _height = image.Height; } private ClipPath? CreateClipPath(string name, int offset, int length) { string clipPath = GetClipPath(offset, length); if (string.IsNullOrEmpty(clipPath)) { return null; } XmlDocument xmlDocument = XmlHelper.CreateDocument(); xmlDocument.CreateXmlDeclaration("1.0", "iso-8859-1", null); XmlElement xmlElement = XmlHelper.CreateElement(xmlDocument, "svg"); XmlHelper.SetAttribute(xmlElement, "width", _width); XmlHelper.SetAttribute(xmlElement, "height", _height); XmlElement element = XmlHelper.CreateElement(XmlHelper.CreateElement(xmlElement, "g"), "path"); XmlHelper.SetAttribute(element, "fill", "#00000000"); XmlHelper.SetAttribute(element, "stroke", "#00000000"); XmlHelper.SetAttribute(element, "stroke-width", "0"); XmlHelper.SetAttribute(element, "stroke-antialiasing", "false"); XmlHelper.SetAttribute(element, "d", clipPath); return new ClipPath(name, xmlDocument.CreateNavigator()); } private string? GetClipPath(int offset, int length) { if (_width == 0 || _height == 0) { return null; } byte[] data = GetData(); if (data == null) { return null; } return ClipPathReader.Read(_width, _height, data, offset, length); } [MemberNotNull(new string[] { "_clipPaths", "_values" })] private void Initialize() { if (_clipPaths != null && _values != null) { return; } _clipPaths = new Collection<IClipPath>(); _values = new Collection<IEightBimValue>(); byte[] data = GetData(); if (data == null) { return; } int offset = 0; while (offset < data.Length) { if (data[offset++] != 56 || data[offset++] != 66 || data[offset++] != 73 || data[offset++] != 77) { continue; } if (offset + 7 > data.Length) { break; } short num = ByteConverter.ToShort(data, ref offset); bool flag = num > 1999 && num < 2998; string name = null; int num2 = data[offset++]; if (num2 != 0) { if (flag && offset + num2 < data.Length) { name = Encoding.ASCII.GetString(data, offset, num2); } offset += num2; } if ((num2 & 1) == 0) { offset++; } num2 = ByteConverter.ToUInt(data, ref offset); if (offset + num2 > data.Length || num2 < 0) { break; } if (num2 != 0) { if (flag) { ClipPath clipPath = CreateClipPath(name, offset, num2); if (clipPath != null) { _clipPaths.Add(clipPath); } } byte[] array = new byte[num2]; Array.Copy(data, offset, array, 0, num2); _values.Add(new EightBimValue(num, array)); } offset += num2; } } } public sealed class EightBimValue : IEightBimValue, IEquatable<IEightBimValue> { private readonly byte[] _data; public short ID { get; } internal EightBimValue(short id, byte[] data) { ID = id; _data = data; } public override bool Equals(object? obj) { if (this == obj) { return true; } return Equals(obj as IEightBimValue); } public bool Equals(IEightBimValue? other) { if (other == null) { return false; } if (this == other) { return true; } if (ID != other.ID) { return false; } byte[] array = other.ToByteArray(); if (_data.Length != array.Length) { return false; } for (int i = 0; i < _data.Length; i++) { if (_data[i] != array[i]) { return false; } } return true; } public override int GetHashCode() { return _data.GetHashCode() ^ ID.GetHashCode(); } public byte[] ToByteArray() { byte[] array = new byte[_data.Length]; Array.Copy(_data, 0, array, 0, _data.Length); return array; } public override string ToString() { return ToString(Encoding.UTF8); } public string ToString(Encoding encoding) { Throw.IfNull("encoding", encoding); return encoding.GetString(_data); } } public interface IClipPath { string Name { get; } IXPathNavigable Path { get; } } public interface IEightBimProfile : IImageProfile, IEquatable<IImageProfile> { IEnumerable<IClipPath> ClipPaths { get; } IEnumerable<IEightBimValue> Values { get; } } public interface IEightBimValue : IEquatable<IEightBimValue> { short ID { get; } byte[] ToByteArray(); string ToString(Encoding encoding); } public sealed class ColorProfile : ImageProfile, IColorProfile, IImageProfile, IEquatable<IImageProfile> { private static readonly object _SyncRoot = new object(); private static readonly Dictionary<string, ColorProfile> _profiles = new Dictionary<string, ColorProfile>(); private ColorProfileData? _data; public static ColorProfile AdobeRGB1998 => Load("ImageMagick.Resources.ColorProfiles.RGB", "AdobeRGB1998.icc"); public static ColorProfile AppleRGB => Load("ImageMagick.Resources.ColorProfiles.RGB", "AppleRGB.icc"); public static ColorProfile CoatedFOGRA39 => Load("ImageMagick.Resources.ColorProfiles.CMYK", "CoatedFOGRA39.icc"); public static ColorProfile ColorMatchRGB => Load("ImageMagick.Resources.ColorProfiles.RGB", "ColorMatchRGB.icc"); public static ColorProfile SRGB => Load("ImageMagick.Resources.ColorProfiles.RGB", "SRGB.icm"); public static ColorProfile USWebCoatedSWOP => Load("ImageMagick.Resources.ColorProfiles.CMYK", "USWebCoatedSWOP.icc"); public ColorSpace ColorSpace { get { Initialize(); return _data.ColorSpace; } } public string? Copyright { get { Initialize(); return _data.Copyright; } } public string? Description { get { Initialize(); return _data.Description; } } public string? Manufacturer { get { Initialize(); return _data.Manufacturer; } } public string? Model { get { Initialize(); return _data.Model; } } public ColorProfile(byte[] data) : base("icc", data) { } public ColorProfile(Stream stream) : base("icc", stream) { } public ColorProfile(string fileName) : base("icc", fileName) { } public ColorProfile(string name, byte[] data) : base(name, data) { } private static ColorProfile Load(string resourcePath, string resourceName) { lock (_SyncRoot) { if (!_profiles.ContainsKey(resourceName)) { using Stream stream = TypeHelper.GetManifestResourceStream(typeof(ColorProfile), resourcePath, resourceName); _profiles[resourceName] = new ColorProfile(stream); } } return _profiles[resourceName]; } [MemberNotNull("_data")] private void Initialize() { _data = ColorProfileReader.Read(GetData()); } } internal sealed class ColorProfileData { public ColorSpace ColorSpace { get; set; } public string? Copyright { get; set; } public string? Description { get; set; } public string? Manufacturer { get; set; } public string? Model { get; set; } } internal sealed class ColorProfileReader { private readonly ColorProfileData _data = new ColorProfileData(); private readonly EndianReader _reader; private ColorProfileReader(byte[] data) { _reader = new EndianReader(data); } public static ColorProfileData Read(byte[]? data) { if (data == null) { return new ColorProfileData(); } ColorProfileReader colorProfileReader = new ColorProfileReader(data); colorProfileReader.ReadColorSpace(); colorProfileReader.ReadTagTable(); return colorProfileReader._data; } private static ColorSpace DetermineColorSpace(string colorSpace) { return colorSpace switch { "CMY" => ColorSpace.CMY, "CMYK" => ColorSpace.CMYK, "GRAY" => ColorSpace.Gray, "HSL" => ColorSpace.HSL, "HSV" => ColorSpace.HSV, "Lab" => ColorSpace.Lab, "Luv" => ColorSpace.YUV, "RGB" => ColorSpace.sRGB, "XYZ" => ColorSpace.XYZ, "YCbr" => ColorSpace.YCbCr, _ => throw new NotSupportedException(colorSpace), }; } private void ReadColorSpace() { _reader.Seek(16u); string text = _reader.ReadString(4u); if (text != null) { _data.ColorSpace = DetermineColorSpace(text.TrimEnd(new char[0])); } } private void ReadTagTable() { if (!_reader.Seek(128u)) { return; } uint? num = _reader.ReadLong(); for (int i = 0; i < num; i++) { switch (_reader.ReadLong()) { case 1668313716u: _data.Copyright = ReadTag(); break; case 1684370275u: _data.Description = ReadTag(); break; case 1684893284u: _data.Manufacturer = ReadTag(); break; case 1684890724u: _data.Model = ReadTag(); break; default: _reader.Skip(8u); break; } } } private string? ReadTag() { uint? num = _reader.ReadLong(); uint? num2 = _reader.ReadLong(); if (!num.HasValue || !num2.HasValue) { return null; } uint index = _reader.Index; if (!_reader.Seek(num.Value)) { return null; } string? result = ReadTagValue(num2.Value); _reader.Seek(index); return result; } private string? ReadTagValue(uint length) { string text = _reader.ReadString(4u); if (!(text == "desc")) { if (text == "text") { return ReadTextTypeValue(length); } return null; } return ReadTextDescriptionTypeValue(); } private string? ReadTextDescriptionTypeValue() { if (!_reader.Skip(4u)) { return null; } uint? num = _reader.ReadLong(); if (!num.HasValue) { return null; } return _reader.ReadString(num.Value); } private string? ReadTextTypeValue(uint length) { if (!_reader.Skip(4u)) { return null; } return _reader.ReadString(length); } } public interface IColorProfile : IImageProfile, IEquatable<IImageProfile> { ColorSpace ColorSpace { get; } string? Copyright { get; } string? Description { get; } string? Manufacturer { get; } string? Model { get; } } internal sealed class EndianReader { private readonly byte[] _data; public uint Index { get; private set; } public bool IsLittleEndian { get; set; } public EndianReader(byte[] data) { Throw.IfNullOrEmpty("data", data); _data = data; Index = 0u; } public bool CanRead(uint length) { if (length > _data.Length) { return false; } return Index + length <= _data.Length; } public bool Seek(uint index) { if (index >= _data.Length) { return false; } Index = index; return true; } public bool Skip(uint value) { if (Index + value >= _data.Length) { return false; } Index += value; return true; } public byte? ReadByte() { if (Index >= _data.Length) { return null; } byte value = _data[Index]; Index++; return value; } public double? ReadDouble() { if (!CanRead(8u)) { return null; } return IsLittleEndian ? ReadDoubleLSB() : ReadDoubleMSB(); } public uint? ReadLong() { if (!CanRead(4u)) { return null; } return IsLittleEndian ? ReadLongLSB() : ReadLongMSB(); } public ushort? ReadShort() { if (!CanRead(2u)) { return null; } return IsLittleEndian ? ReadShortLSB() : ReadShortMSB(); } public unsafe float? ReadFloat() { uint? num = ReadLong(); if (!num.HasValue) { return null; } uint value = num.Value; return *(float*)(&value); } public string? ReadString(uint length) { if (length == 0) { return string.Empty; } if (!CanRead(length)) { return null; } string text = Encoding.UTF8.GetString(_data, (int)Index, (int)length); int num = text.IndexOf('\0'); if (num != -1) { text = text.Substring(0, num); } Index += length; return text; } private unsafe double ReadDoubleLSB() { ulong num = _data[Index]; num |= (ulong)_data[Index + 1] << 8; num |= (ulong)_data[Index + 2] << 16; num |= (ulong)_data[Index + 3] << 24; num |= (ulong)_data[Index + 4] << 32; num |= (ulong)_data[Index + 5] << 40; num |= (ulong)_data[Index + 6] << 48; num |= (ulong)_data[Index + 7] << 56; Index += 8u; return *(double*)(&num); } private unsafe double ReadDoubleMSB() { ulong num = (ulong)_data[Index] << 56; num |= (ulong)_data[Index + 1] << 48; num |= (ulong)_data[Index + 2] << 40; num |= (ulong)_data[Index + 3] << 32; num |= (ulong)_data[Index + 4] << 24; num |= (ulong)_data[Index + 5] << 16; num |= (ulong)_data[Index + 6] << 8; num |= _data[Index + 7]; Index += 8u; return *(double*)(&num); } private uint ReadLongLSB() { int result = _data[Index] | (_data[Index + 1] << 8) | (_data[Index + 2] << 16) | (_data[Index + 3] << 24); Index += 4u; return (uint)result; } private uint ReadLongMSB() { int result = (_data[Index] << 24) | (_data[Index + 1] << 16) | (_data[Index + 2] << 8) | _data[Index + 3]; Index += 4u; return (uint)result; } private ushort ReadShortLSB() { ushort result = (ushort)(_data[Index] | (ushort)(_data[Index + 1] << 8)); Index += 2u; return result; } private ushort ReadShortMSB() { ushort result = (ushort)((ushort)(_data[Index] << 8) | _data[Index + 1]); Index += 2u; return result; } } internal sealed class ExifData { public uint ThumbnailLength { get; set; } public uint ThumbnailOffset { get; set; } public List<ExifTag> InvalidTags { get; } = new List<ExifTag>(); public List<IExifValue> Values { get; } = new List<IExifValue>(); } public enum ExifDataType { Unknown, Byte, String, Short, Long, Rational, SignedByte, Undefined, SignedShort, SignedLong, SignedRational, Float, Double } internal static class ExifDataTypes { public static uint GetSize(ExifDataType dataType) { switch (dataType) { case ExifDataType.Byte: case ExifDataType.String: case ExifDataType.SignedByte: case ExifDataType.Undefined: return 1u; case ExifDataType.Short: case ExifDataType.SignedShort: return 2u; case ExifDataType.Long: case ExifDataType.SignedLong: case ExifDataType.Float: return 4u; case ExifDataType.Rational: case ExifDataType.SignedRational: case ExifDataType.Double: return 8u; default: throw new NotSupportedException(dataType.ToString()); } } } [Flags] public enum ExifParts { None = 0, IfdTags = 1, ExifTags = 4, GpsTags = 8, All = 0xD } public sealed class ExifProfile : ImageProfile, IExifProfile, IImageProfile, IEquatable<IImageProfile> { private ExifData? _data; public ExifParts Parts { get; set; } = ExifParts.All; public IEnumerable<ExifTag> InvalidTags { get { InitializeValues(); return _data.InvalidTags; } } public int ThumbnailLength { get { InitializeValues(); return (int)_data.ThumbnailLength; } } public int ThumbnailOffset { get { InitializeValues(); return (int)_data.ThumbnailOffset; } } public IEnumerable<IExifValue> Values { get { InitializeValues(); return _data.Values; } } public ExifProfile() : base("exif") { } public ExifProfile(byte[] data) : base("exif", data) { } public ExifProfile(string fileName) : base("exif", fileName) { } public ExifProfile(Stream stream) : base("exif", stream) { } public IExifValue<TValueType>? GetValue<TValueType>(ExifTag<TValueType> tag) { foreach (IExifValue value in Values) { if (value.Tag == tag) { return (IExifValue<TValueType>)value; } } return null; } public void RemoveThumbnail() { InitializeValues(); _data.ThumbnailLength = 0u; _data.ThumbnailOffset = 0u; } public bool RemoveValue(ExifTag tag) { InitializeValues(); for (int i = 0; i < _data.Values.Count; i++) { if (_data.Values[i].Tag == tag) { _data.Values.RemoveAt(i); return true; } } return false; } public void Rewrite() { InitializeValues(); UpdateData(); } public void SetValue<TValueType>(ExifTag<TValueType> tag, TValueType value) { Throw.IfNull("value", value); InitializeValues(); foreach (IExifValue value2 in _data.Values) { if (value2.Tag == tag) { value2.SetValue(value); return; } } ExifValue exifValue = ExifValues.Create(tag); if (exifValue == null) { throw new NotSupportedException(); } exifValue.SetValue(value); _data.Values.Add(exifValue); } protected override void UpdateData() { if (_data != null) { if (_data.Values.Count == 0) { SetData(null); return; } ExifWriter exifWrit
plugins/Magick.NET-Q16-AnyCPU.dll
Decompiled 4 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.IO.Compression; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.AccessControl; using System.Security.Permissions; using System.Security.Principal; using System.Text; using System.Threading; using ImageMagick.Configuration; using ImageMagick.Defines; using ImageMagick.Helpers; using ImageMagick.ImageOptimizers; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: ComVisible(false)] [assembly: CLSCompliant(false)] [assembly: AssemblyTrademark("ImageMagick 7.1.0.18")] [assembly: AssemblyCompany("Dirk Lemstra")] [assembly: AssemblyConfiguration("ReleaseQ16")] [assembly: AssemblyCopyright("Copyright 2013-2021 Dirk Lemstra")] [assembly: AssemblyFileVersion("8.5.0")] [assembly: AssemblyInformationalVersion("8.5.0+94caf0f2fcdec9152671e40bd1e359f82d5d8fe6")] [assembly: AssemblyProduct("Magick.NET-Q16-AnyCPU")] [assembly: AssemblyTitle("Magick.NET Q16 AnyCPU net20")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, UnmanagedCode = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("8.5.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] internal sealed class NotNullAttribute : Attribute { } } namespace ImageMagick { public static class MagickAnyCPU { private static string _cacheDirectory = Path.GetTempPath(); public static string CacheDirectory { get { return _cacheDirectory; } set { if (!Directory.Exists(value)) { throw new InvalidOperationException("The specified directory does not exist."); } _cacheDirectory = value; } } public static bool HasSharedCacheDirectory { get; set; } internal static bool UsesDefaultCacheDirectory => _cacheDirectory == Path.GetTempPath(); } public abstract class ColorBase : IEquatable<ColorBase>, IComparable<ColorBase> { protected IMagickColor<ushort> Color { get; } protected ColorBase(IMagickColor<ushort> color) { Throw.IfNull("color", color); Color = color; } public static bool operator ==(ColorBase? left, ColorBase? right) { return object.Equals(left, right); } public static bool operator !=(ColorBase? left, ColorBase? right) { return !object.Equals(left, right); } public static bool operator >(ColorBase? left, ColorBase? right) { if ((object)left == null) { return (object)right == null; } return left.CompareTo(right) == 1; } public static bool operator <(ColorBase? left, ColorBase? right) { if ((object)left == null) { return (object)right != null; } return left.CompareTo(right) == -1; } public static bool operator >=(ColorBase? left, ColorBase? right) { if ((object)left == null) { return (object)right == null; } return left.CompareTo(right) >= 0; } public static bool operator <=(ColorBase? left, ColorBase? right) { if ((object)left == null) { return (object)right != null; } return left.CompareTo(right) <= 0; } public int CompareTo(ColorBase? other) { if ((object)other == null) { return 1; } UpdateColor(); other.UpdateColor(); return ((IComparable<IMagickColor<ushort>>)Color).CompareTo(other.Color); } public override bool Equals(object? obj) { return Equals(obj as ColorBase); } public bool Equals(ColorBase? other) { if ((object)other == null) { return false; } if ((object)this == other) { return true; } UpdateColor(); other.UpdateColor(); return ((IEquatable<IMagickColor<ushort>>)Color).Equals(other.Color); } public bool FuzzyEquals(ColorBase? other, Percentage fuzz) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if ((object)other == null) { return false; } if ((object)this == other) { return true; } UpdateColor(); other.UpdateColor(); return Color.FuzzyEquals(other.Color, fuzz); } public override int GetHashCode() { UpdateColor(); return ((object)Color).GetHashCode(); } public IMagickColor<ushort> ToMagickColor() { UpdateColor(); return (IMagickColor<ushort>)(object)new MagickColor(Color); } public override string ToString() { return ToMagickColor().ToString(); } protected virtual void UpdateColor() { } } public sealed class ColorCMYK : ColorBase { public ushort A { get { return base.Color.A; } set { base.Color.A = value; } } public ushort C { get { return base.Color.R; } set { base.Color.R = value; } } public ushort K { get { return base.Color.K; } set { base.Color.K = value; } } public ushort M { get { return base.Color.G; } set { base.Color.G = value; } } public ushort Y { get { return base.Color.B; } set { base.Color.B = value; } } public ColorCMYK(Percentage cyan, Percentage magenta, Percentage yellow, Percentage key) : base((IMagickColor<ushort>)(object)new MagickColor(PercentageHelper.ToQuantumType(cyan), PercentageHelper.ToQuantumType(magenta), PercentageHelper.ToQuantumType(yellow), PercentageHelper.ToQuantumType(key), Quantum.Max)) { }//IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) public ColorCMYK(Percentage cyan, Percentage magenta, Percentage yellow, Percentage key, Percentage alpha) : base((IMagickColor<ushort>)(object)new MagickColor(PercentageHelper.ToQuantumType(cyan), PercentageHelper.ToQuantumType(magenta), PercentageHelper.ToQuantumType(yellow), PercentageHelper.ToQuantumType(key), PercentageHelper.ToQuantumType(alpha))) { }//IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) public ColorCMYK(ushort cyan, ushort magenta, ushort yellow, ushort key) : base((IMagickColor<ushort>)(object)new MagickColor(cyan, magenta, yellow, key, Quantum.Max)) { } public ColorCMYK(ushort cyan, ushort magenta, ushort yellow, ushort key, ushort alpha) : base((IMagickColor<ushort>)(object)new MagickColor(cyan, magenta, yellow, key, alpha)) { } public ColorCMYK(string color) : base(CreateColor(color)) { } private ColorCMYK(IMagickColor<ushort> color) : base(color) { } public static implicit operator ColorCMYK?(MagickColor color) { return FromMagickColor((IMagickColor<ushort>)(object)color); } public static ColorCMYK? FromMagickColor(IMagickColor<ushort> color) { if (color == null) { return null; } return new ColorCMYK(color); } private static IMagickColor<ushort> CreateColor(string color) { Throw.IfNullOrEmpty("color", color); if (color[0] == '#') { if (!HexColor.TryParse(color, out List<ushort> channels)) { throw new ArgumentException("Invalid hex value.", "color"); } if (channels.Count == 4) { return (IMagickColor<ushort>)(object)new MagickColor(channels[0], channels[1], channels[2], channels[3], Quantum.Max); } } throw new ArgumentException("Invalid color specified", "color"); } } public sealed class ColorGray : ColorBase { private double _shade; public double Shade { get { return _shade; } set { if (!(value < 0.0) && !(value > 1.0)) { _shade = value; } } } public ColorGray(double shade) : base((IMagickColor<ushort>)(object)new MagickColor(0, 0, 0)) { Throw.IfTrue("shade", shade < 0.0 || shade > 1.0, "Invalid shade specified"); _shade = shade; } private ColorGray(IMagickColor<ushort> color) : base(color) { _shade = 0.212656 * Quantum.ScaleToDouble(color.R) + 0.715158 * Quantum.ScaleToDouble(color.G) + 0.072186 * Quantum.ScaleToDouble(color.B); } public static implicit operator ColorGray?(MagickColor color) { return FromMagickColor(color); } public static ColorGray? FromMagickColor(MagickColor color) { if (color == null) { return null; } return new ColorGray((IMagickColor<ushort>)(object)color); } protected override void UpdateColor() { ushort num = Quantum.ScaleToQuantum(_shade); base.Color.R = num; base.Color.G = num; base.Color.B = num; } } public sealed class ColorHSL : ColorBase { public double Hue { get; set; } public double Lightness { get; set; } public double Saturation { get; set; } public ColorHSL(double hue, double saturation, double lightness) : base((IMagickColor<ushort>)(object)new MagickColor(0, 0, 0)) { Hue = hue; Saturation = saturation; Lightness = lightness; } private ColorHSL(IMagickColor<ushort> color) : base(color) { Initialize((int)color.R, (int)color.G, (int)color.B); } public static implicit operator ColorHSL?(MagickColor color) { return FromMagickColor((IMagickColor<ushort>)(object)color); } public static ColorHSL? FromMagickColor(IMagickColor<ushort> color) { if (color == null) { return null; } return new ColorHSL(color); } protected override void UpdateColor() { double num = Hue * 360.0; double num2 = ((!(Lightness <= 0.5)) ? ((2.0 - 2.0 * Lightness) * Saturation) : (2.0 * Lightness * Saturation)); double num3 = Lightness - 0.5 * num2; num -= 360.0 * Math.Floor(num / 360.0); num /= 60.0; double num4 = num2 * (1.0 - Math.Abs(num - 2.0 * Math.Floor(num / 2.0) - 1.0)); switch ((int)Math.Floor(num)) { default: base.Color.R = Quantum.ScaleToQuantum(num3 + num2); base.Color.G = Quantum.ScaleToQuantum(num3 + num4); base.Color.B = Quantum.ScaleToQuantum(num3); break; case 1: base.Color.R = Quantum.ScaleToQuantum(num3 + num4); base.Color.G = Quantum.ScaleToQuantum(num3 + num2); base.Color.B = Quantum.ScaleToQuantum(num3); break; case 2: base.Color.R = Quantum.ScaleToQuantum(num3); base.Color.G = Quantum.ScaleToQuantum(num3 + num2); base.Color.B = Quantum.ScaleToQuantum(num3 + num4); break; case 3: base.Color.R = Quantum.ScaleToQuantum(num3); base.Color.G = Quantum.ScaleToQuantum(num3 + num4); base.Color.B = Quantum.ScaleToQuantum(num3 + num2); break; case 4: base.Color.R = Quantum.ScaleToQuantum(num3 + num4); base.Color.G = Quantum.ScaleToQuantum(num3); base.Color.B = Quantum.ScaleToQuantum(num3 + num2); break; case 5: base.Color.R = Quantum.ScaleToQuantum(num3 + num2); base.Color.G = Quantum.ScaleToQuantum(num3); base.Color.B = Quantum.ScaleToQuantum(num3 + num4); break; } } private void Initialize(double red, double green, double blue) { double num = 1.0 / (double)(int)Quantum.Max; double num2 = Math.Max(red, Math.Max(green, blue)) * num; double num3 = Math.Min(red, Math.Min(green, blue)) * num; double num4 = num2 - num3; Lightness = (num2 + num3) / 2.0; if (num4 <= 0.0) { Hue = 0.0; Saturation = 0.0; return; } if (Math.Abs(num2 - num * red) < double.Epsilon) { Hue = (num * green - num * blue) / num4; if (num * green < num * blue) { Hue += 6.0; } } else if (Math.Abs(num2 - num * green) < double.Epsilon) { Hue = 2.0 + (num * blue - num * red) / num4; } else { Hue = 4.0 + (num * red - num * green) / num4; } Hue *= 1.0 / 6.0; if (Lightness <= 0.5) { Saturation = num4 / (2.0 * Lightness); } else { Saturation = num4 / (2.0 - 2.0 * Lightness); } } } public sealed class ColorHSV : ColorBase { public double Hue { get; set; } public double Saturation { get; set; } public double Value { get; set; } public ColorHSV(double hue, double saturation, double value) : base((IMagickColor<ushort>)(object)new MagickColor(0, 0, 0)) { Hue = hue; Saturation = saturation; Value = value; } private ColorHSV(IMagickColor<ushort> color) : base(color) { Initialize((int)color.R, (int)color.G, (int)color.B); } public static implicit operator ColorHSV?(MagickColor color) { return FromMagickColor((IMagickColor<ushort>)(object)color); } public static ColorHSV? FromMagickColor(IMagickColor<ushort> color) { if (color == null) { return null; } return new ColorHSV(color); } public void HueShift(double degrees) { Hue += degrees / 360.0; while (Hue >= 1.0) { Hue -= 1.0; } while (Hue < 0.0) { Hue += 1.0; } } protected override void UpdateColor() { if (Math.Abs(Saturation) < double.Epsilon) { IMagickColor<ushort> color = base.Color; IMagickColor<ushort> color2 = base.Color; ushort num2 = (base.Color.B = Quantum.ScaleToQuantum(Value)); ushort r = (color2.G = num2); color.R = r; return; } double num4 = 6.0 * (Hue - Math.Floor(Hue)); double num5 = num4 - Math.Floor(num4); double value = Value * (1.0 - Saturation); double value2 = Value * (1.0 - Saturation * num5); double value3 = Value * (1.0 - Saturation * (1.0 - num5)); switch ((int)num4) { default: base.Color.R = Quantum.ScaleToQuantum(Value); base.Color.G = Quantum.ScaleToQuantum(value3); base.Color.B = Quantum.ScaleToQuantum(value); break; case 1: base.Color.R = Quantum.ScaleToQuantum(value2); base.Color.G = Quantum.ScaleToQuantum(Value); base.Color.B = Quantum.ScaleToQuantum(value); break; case 2: base.Color.R = Quantum.ScaleToQuantum(value); base.Color.G = Quantum.ScaleToQuantum(Value); base.Color.B = Quantum.ScaleToQuantum(value3); break; case 3: base.Color.R = Quantum.ScaleToQuantum(value); base.Color.G = Quantum.ScaleToQuantum(value2); base.Color.B = Quantum.ScaleToQuantum(Value); break; case 4: base.Color.R = Quantum.ScaleToQuantum(value3); base.Color.G = Quantum.ScaleToQuantum(value); base.Color.B = Quantum.ScaleToQuantum(Value); break; case 5: base.Color.R = Quantum.ScaleToQuantum(Value); base.Color.G = Quantum.ScaleToQuantum(value); base.Color.B = Quantum.ScaleToQuantum(value2); break; } } private void Initialize(double red, double green, double blue) { Hue = 0.0; Saturation = 0.0; Value = 0.0; double num = Math.Min(Math.Min(red, green), blue); double num2 = Math.Max(Math.Max(red, green), blue); if (Math.Abs(num2) < double.Epsilon) { return; } double num3 = num2 - num; Saturation = num3 / num2; Value = 1.0 / (double)(int)Quantum.Max * num2; if (!(Math.Abs(num3) < double.Epsilon)) { if (Math.Abs(red - num2) < double.Epsilon) { Hue = (green - blue) / num3; } else if (Math.Abs(green - num2) < double.Epsilon) { Hue = 2.0 + (blue - red) / num3; } else { Hue = 4.0 + (red - green) / num3; } Hue /= 6.0; if (Hue < 0.0) { Hue += 1.0; } } } } public sealed class ColorMono : ColorBase { public bool IsBlack { get; set; } public ColorMono(bool isBlack) : base((IMagickColor<ushort>)(object)(isBlack ? MagickColors.Black : MagickColors.White)) { IsBlack = isBlack; } private ColorMono(IMagickColor<ushort> color) : base(color) { if (((IEquatable<IMagickColor<ushort>>)color).Equals((IMagickColor<ushort>?)(object)MagickColors.Black)) { IsBlack = true; return; } if (((IEquatable<IMagickColor<ushort>>)color).Equals((IMagickColor<ushort>?)(object)MagickColors.White)) { IsBlack = false; return; } throw new ArgumentException("Invalid color specified.", "color"); } public static implicit operator ColorMono?(MagickColor color) { return FromMagickColor((IMagickColor<ushort>)(object)color); } public static ColorMono? FromMagickColor(IMagickColor<ushort> color) { if (color == null) { return null; } return new ColorMono(color); } protected override void UpdateColor() { ushort num = (ushort)((!IsBlack) ? Quantum.Max : 0); base.Color.R = num; base.Color.G = num; base.Color.B = num; } } public sealed class ColorRGB : ColorBase { public ushort B { get { return base.Color.B; } set { base.Color.B = value; } } public ushort G { get { return base.Color.G; } set { base.Color.G = value; } } public ushort R { get { return base.Color.R; } set { base.Color.R = value; } } public ColorRGB(IMagickColor<ushort> value) : base(value) { } public ColorRGB(ushort red, ushort green, ushort blue) : base((IMagickColor<ushort>)(object)new MagickColor(red, green, blue)) { } public static implicit operator ColorRGB?(MagickColor color) { return FromMagickColor((IMagickColor<ushort>)(object)color); } public static ColorRGB? FromMagickColor(IMagickColor<ushort> color) { if (color == null) { return null; } return new ColorRGB(color); } public ColorRGB? ComplementaryColor() { ColorHSV colorHSV = ColorHSV.FromMagickColor(ToMagickColor()); if (colorHSV == null) { return null; } colorHSV.HueShift(180.0); return new ColorRGB(colorHSV.ToMagickColor()); } } public sealed class ColorYUV : ColorBase { public double U { get; set; } public double V { get; set; } public double Y { get; set; } public ColorYUV(double y, double u, double v) : base((IMagickColor<ushort>)(object)new MagickColor(0, 0, 0)) { Y = y; U = u; V = v; } private ColorYUV(IMagickColor<ushort> color) : base(color) { Y = 1.0 / (double)(int)Quantum.Max * (0.298839 * (double)(int)color.R + 0.586811 * (double)(int)color.G + 0.11435 * (double)(int)color.B); U = 1.0 / (double)(int)Quantum.Max * (-0.147 * (double)(int)color.R - 0.289 * (double)(int)color.G + 0.436 * (double)(int)color.B) + 0.5; V = 1.0 / (double)(int)Quantum.Max * (0.615 * (double)(int)color.R - 0.515 * (double)(int)color.G - 0.1 * (double)(int)color.B) + 0.5; } public static implicit operator ColorYUV?(MagickColor color) { return FromMagickColor((IMagickColor<ushort>)(object)color); } public static ColorYUV? FromMagickColor(IMagickColor<ushort> color) { if (color == null) { return null; } return new ColorYUV(color); } protected override void UpdateColor() { base.Color.R = Quantum.ScaleToQuantum(Y - 3.945707070708279E-05 * (U - 0.5) + 1.139827967171717 * (V - 0.5)); base.Color.G = Quantum.ScaleToQuantum(Y - 0.39461016414141414 * (U - 0.5) - 0.5805003156565657 * (V - 0.5)); base.Color.B = Quantum.ScaleToQuantum(Y + 2.0319996843434343 * (U - 0.5) - 0.0004813762626262513 * (V - 0.5)); } } internal static class HexColor { public static bool TryParse(string value, out List<ushort> channels) { channels = new List<ushort>(); if (value.Length < 13) { return TryParseQ8(value, channels); } return TryParseQ16(value, channels); } private static bool TryParseQ8(string value, List<ushort> channels) { int num; if (value.Length == 4 || value.Length == 5) { num = 1; } else { if (value.Length != 3 && value.Length != 7 && value.Length != 9) { return false; } num = 2; } for (int i = 1; i < value.Length; i += num) { if (!TryParseHex(value, i, num, out var channel)) { return false; } channels.Add(Quantum.Convert((byte)channel)); } return true; } private static bool TryParseQ16(string value, List<ushort> channels) { if (value.Length != 13 && value.Length != 17) { return false; } for (int i = 1; i < value.Length; i += 4) { if (!TryParseHex(value, i, 4, out var channel)) { return false; } channels.Add(Quantum.Convert(channel)); } return true; } private static bool TryParseHex(string color, int offset, int length, out ushort channel) { channel = 0; ushort num = 1; int num2 = length - 1; while (num2 >= 0) { char c = color[offset + num2]; if (c >= '0' && c <= '9') { channel += (ushort)(num * (c - 48)); } else if (c >= 'a' && c <= 'f') { channel += (ushort)(num * (c - 97 + 10)); } else { if (c < 'A' || c > 'F') { return false; } channel += (ushort)(num * (c - 65 + 10)); } num2--; num *= 16; } if (length == 1) { channel += (byte)(channel * 16); } return true; } } public sealed class MagickColor : IMagickColor<ushort>, IEquatable<IMagickColor<ushort>>, IComparable<IMagickColor<ushort>> { [SuppressUnmanagedCodeSecurity] private static class NativeMethods { public static class X64 { static X64() { NativeLibraryLoader.Load(); } [DllImport("Magick.Native-Q16-x64.dll", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr MagickColor_Create(); [DllImport("Magick.Native-Q16-x64.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void MagickColor_Dispose(IntPtr instance); [DllImport("Magick.Native-Q16-x64.dll", CallingConvention = CallingConvention.Cdecl)] public static extern ulong MagickColor_Count_Get(IntPtr instance); [DllImport("Magick.Native-Q16-x64.dll", CallingConvention = CallingConvention.Cdecl)] public static extern ushort MagickColor_Red_Get(IntPtr instance); [DllImport("Magick.Native-Q16-x64.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void MagickColor_Red_Set(IntPtr instance, ushort value); [DllImport("Magick.Native-Q16-x64.dll", CallingConvention = CallingConvention.Cdecl)] public static extern ushort MagickColor_Green_Get(IntPtr instance); [DllImport("Magick.Native-Q16-x64.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void MagickColor_Green_Set(IntPtr instance, ushort value); [DllImport("Magick.Native-Q16-x64.dll", CallingConvention = CallingConvention.Cdecl)] public static extern ushort MagickColor_Blue_Get(IntPtr instance); [DllImport("Magick.Native-Q16-x64.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void MagickColor_Blue_Set(IntPtr instance, ushort value); [DllImport("Magick.Native-Q16-x64.dll", CallingConvention = CallingConvention.Cdecl)] public static extern ushort MagickColor_Alpha_Get(IntPtr instance); [DllImport("Magick.Native-Q16-x64.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void MagickColor_Alpha_Set(IntPtr instance, ushort value); [DllImport("Magick.Native-Q16-x64.dll", CallingConvention = CallingConvention.Cdecl)] public static extern ushort MagickColor_Black_Get(IntPtr instance); [DllImport("Magick.Native-Q16-x64.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void MagickColor_Black_Set(IntPtr instance, ushort value); [DllImport("Magick.Native-Q16-x64.dll", CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool MagickColor_IsCMYK_Get(IntPtr instance); [DllImport("Magick.Native-Q16-x64.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void MagickColor_IsCMYK_Set(IntPtr instance, [MarshalAs(UnmanagedType.Bool)] bool value); [DllImport("Magick.Native-Q16-x64.dll", CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool MagickColor_FuzzyEquals(IntPtr Instance, IntPtr other, ushort fuzz); [DllImport("Magick.Native-Q16-x64.dll", CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool MagickColor_Initialize(IntPtr Instance, IntPtr value); } public static class X86 { static X86() { NativeLibraryLoader.Load(); } [DllImport("Magick.Native-Q16-x86.dll", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr MagickColor_Create(); [DllImport("Magick.Native-Q16-x86.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void MagickColor_Dispose(IntPtr instance); [DllImport("Magick.Native-Q16-x86.dll", CallingConvention = CallingConvention.Cdecl)] public static extern ulong MagickColor_Count_Get(IntPtr instance); [DllImport("Magick.Native-Q16-x86.dll", CallingConvention = CallingConvention.Cdecl)] public static extern ushort MagickColor_Red_Get(IntPtr instance); [DllImport("Magick.Native-Q16-x86.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void MagickColor_Red_Set(IntPtr instance, ushort value); [DllImport("Magick.Native-Q16-x86.dll", CallingConvention = CallingConvention.Cdecl)] public static extern ushort MagickColor_Green_Get(IntPtr instance); [DllImport("Magick.Native-Q16-x86.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void MagickColor_Green_Set(IntPtr instance, ushort value); [DllImport("Magick.Native-Q16-x86.dll", CallingConvention = CallingConvention.Cdecl)] public static extern ushort MagickColor_Blue_Get(IntPtr instance); [DllImport("Magick.Native-Q16-x86.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void MagickColor_Blue_Set(IntPtr instance, ushort value); [DllImport("Magick.Native-Q16-x86.dll", CallingConvention = CallingConvention.Cdecl)] public static extern ushort MagickColor_Alpha_Get(IntPtr instance); [DllImport("Magick.Native-Q16-x86.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void MagickColor_Alpha_Set(IntPtr instance, ushort value); [DllImport("Magick.Native-Q16-x86.dll", CallingConvention = CallingConvention.Cdecl)] public static extern ushort MagickColor_Black_Get(IntPtr instance); [DllImport("Magick.Native-Q16-x86.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void MagickColor_Black_Set(IntPtr instance, ushort value); [DllImport("Magick.Native-Q16-x86.dll", CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool MagickColor_IsCMYK_Get(IntPtr instance); [DllImport("Magick.Native-Q16-x86.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void MagickColor_IsCMYK_Set(IntPtr instance, [MarshalAs(UnmanagedType.Bool)] bool value); [DllImport("Magick.Native-Q16-x86.dll", CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool MagickColor_FuzzyEquals(IntPtr Instance, IntPtr other, ushort fuzz); [DllImport("Magick.Native-Q16-x86.dll", CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool MagickColor_Initialize(IntPtr Instance, IntPtr value); } } private sealed class NativeMagickColor : NativeInstance { protected override string TypeName => "MagickColor"; public ulong Count { get { if (OperatingSystem.Is64Bit) { return NativeMethods.X64.MagickColor_Count_Get(base.Instance); } return NativeMethods.X86.MagickColor_Count_Get(base.Instance); } } public ushort Red { get { if (OperatingSystem.Is64Bit) { return NativeMethods.X64.MagickColor_Red_Get(base.Instance); } return NativeMethods.X86.MagickColor_Red_Get(base.Instance); } set { if (OperatingSystem.Is64Bit) { NativeMethods.X64.MagickColor_Red_Set(base.Instance, value); } else { NativeMethods.X86.MagickColor_Red_Set(base.Instance, value); } } } public ushort Green { get { if (OperatingSystem.Is64Bit) { return NativeMethods.X64.MagickColor_Green_Get(base.Instance); } return NativeMethods.X86.MagickColor_Green_Get(base.Instance); } set { if (OperatingSystem.Is64Bit) { NativeMethods.X64.MagickColor_Green_Set(base.Instance, value); } else { NativeMethods.X86.MagickColor_Green_Set(base.Instance, value); } } } public ushort Blue { get { if (OperatingSystem.Is64Bit) { return NativeMethods.X64.MagickColor_Blue_Get(base.Instance); } return NativeMethods.X86.MagickColor_Blue_Get(base.Instance); } set { if (OperatingSystem.Is64Bit) { NativeMethods.X64.MagickColor_Blue_Set(base.Instance, value); } else { NativeMethods.X86.MagickColor_Blue_Set(base.Instance, value); } } } public ushort Alpha { get { if (OperatingSystem.Is64Bit) { return NativeMethods.X64.MagickColor_Alpha_Get(base.Instance); } return NativeMethods.X86.MagickColor_Alpha_Get(base.Instance); } set { if (OperatingSystem.Is64Bit) { NativeMethods.X64.MagickColor_Alpha_Set(base.Instance, value); } else { NativeMethods.X86.MagickColor_Alpha_Set(base.Instance, value); } } } public ushort Black { get { if (OperatingSystem.Is64Bit) { return NativeMethods.X64.MagickColor_Black_Get(base.Instance); } return NativeMethods.X86.MagickColor_Black_Get(base.Instance); } set { if (OperatingSystem.Is64Bit) { NativeMethods.X64.MagickColor_Black_Set(base.Instance, value); } else { NativeMethods.X86.MagickColor_Black_Set(base.Instance, value); } } } public bool IsCMYK { get { if (OperatingSystem.Is64Bit) { return NativeMethods.X64.MagickColor_IsCMYK_Get(base.Instance); } return NativeMethods.X86.MagickColor_IsCMYK_Get(base.Instance); } set { if (OperatingSystem.Is64Bit) { NativeMethods.X64.MagickColor_IsCMYK_Set(base.Instance, value); } else { NativeMethods.X86.MagickColor_IsCMYK_Set(base.Instance, value); } } } static NativeMagickColor() { Environment.Initialize(); } protected override void Dispose(IntPtr instance) { if (OperatingSystem.Is64Bit) { NativeMethods.X64.MagickColor_Dispose(instance); } else { NativeMethods.X86.MagickColor_Dispose(instance); } } public NativeMagickColor() { if (OperatingSystem.Is64Bit) { base.Instance = NativeMethods.X64.MagickColor_Create(); } else { base.Instance = NativeMethods.X86.MagickColor_Create(); } if (base.Instance == IntPtr.Zero) { throw new InvalidOperationException(); } } public NativeMagickColor(IntPtr instance) { base.Instance = instance; } public bool FuzzyEquals(IMagickColor<ushort>? other, ushort fuzz) { using INativeInstance nativeInstance = CreateInstance(other); if (OperatingSystem.Is64Bit) { return NativeMethods.X64.MagickColor_FuzzyEquals(base.Instance, nativeInstance.Instance, fuzz); } return NativeMethods.X86.MagickColor_FuzzyEquals(base.Instance, nativeInstance.Instance, fuzz); } public bool Initialize(string? value) { using INativeInstance nativeInstance = UTF8Marshaler.CreateInstance(value); if (OperatingSystem.Is64Bit) { return NativeMethods.X64.MagickColor_Initialize(base.Instance, nativeInstance.Instance); } return NativeMethods.X86.MagickColor_Initialize(base.Instance, nativeInstance.Instance); } } public ushort A { get; set; } public ushort B { get; set; } public ushort G { get; set; } public bool IsCmyk { get; private set; } public ushort K { get; set; } public ushort R { get; set; } public MagickColor() { } public MagickColor(IMagickColor<ushort> color) { Throw.IfNull("color", color); R = color.R; G = color.G; B = color.B; A = color.A; K = color.K; IsCmyk = color.IsCmyk; } public MagickColor(ushort red, ushort green, ushort blue) { Initialize(red, green, blue, Quantum.Max); } public MagickColor(ushort red, ushort green, ushort blue, ushort alpha) { Initialize(red, green, blue, alpha); } public MagickColor(ushort cyan, ushort magenta, ushort yellow, ushort black, ushort alpha) { Initialize(cyan, magenta, yellow, alpha); K = black; IsCmyk = true; } public MagickColor(string color) { Throw.IfNullOrEmpty("color", color); if (color.Equals("transparent", StringComparison.OrdinalIgnoreCase)) { Initialize(Quantum.Max, Quantum.Max, Quantum.Max, 0); return; } if (color[0] == '#') { ParseHexColor(color); return; } using NativeMagickColor nativeMagickColor = new NativeMagickColor(); Throw.IfFalse("color", nativeMagickColor.Initialize(color), "Invalid color specified"); Initialize(nativeMagickColor); } private MagickColor(NativeMagickColor instance) { Initialize(instance); } public static bool operator ==(MagickColor? left, MagickColor? right) { return object.Equals(left, right); } public static bool operator !=(MagickColor? left, MagickColor? right) { return !object.Equals(left, right); } public static bool operator >(MagickColor? left, MagickColor? right) { if ((object)left == null) { return (object)right == null; } return left.CompareTo((IMagickColor<ushort>?)(object)right) == 1; } public static bool operator <(MagickColor? left, MagickColor? right) { if ((object)left == null) { return (object)right != null; } return left.CompareTo((IMagickColor<ushort>?)(object)right) == -1; } public static bool operator >=(MagickColor? left, MagickColor? right) { if ((object)left == null) { return (object)right == null; } return left.CompareTo((IMagickColor<ushort>?)(object)right) >= 0; } public static bool operator <=(MagickColor? left, MagickColor? right) { if ((object)left == null) { return (object)right != null; } return left.CompareTo((IMagickColor<ushort>?)(object)right) <= 0; } public static MagickColor FromRgb(byte red, byte green, byte blue) { MagickColor magickColor = new MagickColor(); magickColor.SetFromBytes(red, green, blue, byte.MaxValue); return magickColor; } public static MagickColor FromRgba(byte red, byte green, byte blue, byte alpha) { MagickColor magickColor = new MagickColor(); magickColor.SetFromBytes(red, green, blue, alpha); return magickColor; } public int CompareTo(IMagickColor<ushort>? other) { if (other == null) { return 1; } if (R < other.R) { return -1; } if (R > other.R) { return 1; } if (G < other.G) { return -1; } if (G > other.G) { return 1; } if (B < other.B) { return -1; } if (B > other.B) { return 1; } if (K < other.K) { return -1; } if (K > other.K) { return 1; } if (A < other.A) { return -1; } if (A > other.A) { return 1; } return 0; } public override bool Equals(object? obj) { if (this == obj) { return true; } return Equals(obj as IMagickColor<ushort>); } public bool Equals(IMagickColor<ushort>? other) { if (other == null) { return false; } if (this == other) { return true; } if (IsCmyk == other.IsCmyk && A == other.A && B == other.B && G == other.G && R == other.R) { return K == other.K; } return false; } public bool FuzzyEquals(IMagickColor<ushort> other, Percentage fuzz) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (other == null) { return false; } if (this == other) { return true; } using NativeMagickColor nativeMagickColor = CreateNativeInstance((IMagickColor<ushort>)(object)this); return nativeMagickColor.FuzzyEquals(other, PercentageHelper.ToQuantumType(fuzz)); } public override int GetHashCode() { return IsCmyk.GetHashCode() ^ A.GetHashCode() ^ B.GetHashCode() ^ G.GetHashCode() ^ K.GetHashCode() ^ R.GetHashCode(); } public void SetFromBytes(byte red, byte green, byte blue, byte alpha) { R = Quantum.Convert(red); G = Quantum.Convert(green); B = Quantum.Convert(blue); A = Quantum.Convert(alpha); K = 0; IsCmyk = false; } public byte[] ToByteArray() { if (!IsCmyk) { return new byte[4] { Quantum.ScaleToByte(R), Quantum.ScaleToByte(G), Quantum.ScaleToByte(B), Quantum.ScaleToByte(A) }; } return new byte[5] { Quantum.ScaleToByte(R), Quantum.ScaleToByte(G), Quantum.ScaleToByte(B), Quantum.ScaleToByte(K), Quantum.ScaleToByte(A) }; } public string ToHexString() { if (IsCmyk) { throw new NotSupportedException("This method only works for non cmyk colors."); } byte b = Quantum.ScaleToByte(R); byte b2 = Quantum.ScaleToByte(G); byte b3 = Quantum.ScaleToByte(B); if (A == Quantum.Max) { return string.Format(CultureInfo.InvariantCulture, "#{0:X2}{1:X2}{2:X2}", new object[3] { b, b2, b3 }); } byte b4 = Quantum.ScaleToByte(A); return string.Format(CultureInfo.InvariantCulture, "#{0:X2}{1:X2}{2:X2}{3:X2}", b, b2, b3, b4); } public string ToShortString() { if (A != Quantum.Max) { return ToString(); } if (IsCmyk) { return string.Format(CultureInfo.InvariantCulture, "cmyk({0},{1},{2},{3})", R, G, B, K); } return string.Format(CultureInfo.InvariantCulture, "#{0:X4}{1:X4}{2:X4}", new object[3] { R, G, B }); } public override string ToString() { if (IsCmyk) { return string.Format(CultureInfo.InvariantCulture, "cmyka({0},{1},{2},{3},{4:0.0###})", R, G, B, K, (double)(int)A / (double)(int)Quantum.Max); } return string.Format(CultureInfo.InvariantCulture, "#{0:X4}{1:X4}{2:X4}{3:X4}", R, G, B, A); } internal static IMagickColor<ushort>? Clone(IMagickColor<ushort>? value) { if (value == null) { return value; } return (IMagickColor<ushort>?)(object)new MagickColor { R = value.R, G = value.G, B = value.B, A = value.A, K = value.K, IsCmyk = value.IsCmyk }; } internal static IMagickColor<ushort>? CreateInstance(IntPtr instance, out int count) { count = 0; if (instance == IntPtr.Zero) { return null; } using NativeMagickColor nativeMagickColor = new NativeMagickColor(instance); count = (int)nativeMagickColor.Count; return (IMagickColor<ushort>?)(object)new MagickColor(nativeMagickColor); } private static NativeMagickColor CreateNativeInstance(IMagickColor<ushort> instance) { return new NativeMagickColor { Red = instance.R, Green = instance.G, Blue = instance.B, Alpha = instance.A, Black = instance.K, IsCMYK = instance.IsCmyk }; } private void Initialize(NativeMagickColor instance) { R = instance.Red; G = instance.Green; B = instance.Blue; A = instance.Alpha; K = instance.Black; IsCmyk = instance.IsCMYK; } private void Initialize(ushort red, ushort green, ushort blue, ushort alpha) { R = red; G = green; B = blue; A = alpha; K = 0; IsCmyk = false; } private void ParseHexColor(string color) { if (!HexColor.TryParse(color, out List<ushort> channels)) { throw new ArgumentException("Invalid hex value.", "color"); } if (channels.Count == 1) { Initialize(channels[0], channels[0], channels[0], Quantum.Max); } else if (channels.Count == 3) { Initialize(channels[0], channels[1], channels[2], Quantum.Max); } else { Initialize(channels[0], channels[1], channels[2], channels[3]); } } internal static INativeInstance CreateInstance(IMagickColor<ushort>? instance) { if (instance == null) { return NativeInstance.Zero; } return CreateNativeInstance(instance); } internal static IMagickColor<ushort>? CreateInstance(IntPtr instance) { if (instance == IntPtr.Zero) { return null; } using NativeMagickColor instance2 = new NativeMagickColor(instance); return (IMagickColor<ushort>?)(object)new MagickColor(instance2); } } internal static class MagickColorCollection { [SuppressUnmanagedCodeSecurity] private static class NativeMethods { public static class X64 { static X64() { NativeLibraryLoader.Load(); } [DllImport("Magick.Native-Q16-x64.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void MagickColorCollection_DisposeList(IntPtr list); [DllImport("Magick.Native-Q16-x64.dll", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr MagickColorCollection_GetInstance(IntPtr list, UIntPtr index); } public static class X86 { static X86() { NativeLibraryLoader.Load(); } [DllImport("Magick.Native-Q16-x86.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void MagickColorCollection_DisposeList(IntPtr list); [DllImport("Magick.Native-Q16-x86.dll", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr MagickColorCollection_GetInstance(IntPtr list, UIntPtr index); } } private static class NativeMagickColorCollection { static NativeMagickColorCollection() { Environment.Initialize(); } public static void DisposeList(IntPtr list) { if (OperatingSystem.Is64Bit) { NativeMethods.X64.MagickColorCollection_DisposeList(list); } else { NativeMethods.X86.MagickColorCollection_DisposeList(list); } } public static IntPtr GetInstance(IntPtr list, int index) { if (OperatingSystem.Is64Bit) { return NativeMethods.X64.MagickColorCollection_GetInstance(list, (UIntPtr)(ulong)index); } return NativeMethods.X86.MagickColorCollection_GetInstance(list, (UIntPtr)(ulong)index); } } public static void DisposeList(IntPtr list) { if (list != IntPtr.Zero) { NativeMagickColorCollection.DisposeList(list); } } public static Dictionary<IMagickColor<ushort>, int> ToDictionary(IntPtr list, int length) { Dictionary<IMagickColor<ushort>, int> dictionary = new Dictionary<IMagickColor<ushort>, int>(); if (list == IntPtr.Zero) { return dictionary; } for (int i = 0; i < length; i++) { int count; IMagickColor<ushort> val = MagickColor.CreateInstance(NativeMagickColorCollection.GetInstance(list, i), out count); if (val != null) { dictionary[val] = count; } } return dictionary; } } [GeneratedCode("Magick.NET.FileGenerator", "")] public static class MagickColors { public static MagickColor None => MagickColor.FromRgba(0, 0, 0, 0); public static MagickColor Transparent => MagickColor.FromRgba(0, 0, 0, 0); public static MagickColor AliceBlue => MagickColor.FromRgba(240, 248, byte.MaxValue, byte.MaxValue); public static MagickColor AntiqueWhite => MagickColor.FromRgba(250, 235, 215, byte.MaxValue); public static MagickColor Aqua => MagickColor.FromRgba(0, byte.MaxValue, byte.MaxValue, byte.MaxValue); public static MagickColor Aquamarine => MagickColor.FromRgba(127, byte.MaxValue, 212, byte.MaxValue); public static MagickColor Azure => MagickColor.FromRgba(240, byte.MaxValue, byte.MaxValue, byte.MaxValue); public static MagickColor Beige => MagickColor.FromRgba(245, 245, 220, byte.MaxValue); public static MagickColor Bisque => MagickColor.FromRgba(byte.MaxValue, 228, 196, byte.MaxValue); public static MagickColor Black => MagickColor.FromRgba(0, 0, 0, byte.MaxValue); public static MagickColor BlanchedAlmond => MagickColor.FromRgba(byte.MaxValue, 235, 205, byte.MaxValue); public static MagickColor Blue => MagickColor.FromRgba(0, 0, byte.MaxValue, byte.MaxValue); public static MagickColor BlueViolet => MagickColor.FromRgba(138, 43, 226, byte.MaxValue); public static MagickColor Brown => MagickColor.FromRgba(165, 42, 42, byte.MaxValue); public static MagickColor BurlyWood => MagickColor.FromRgba(222, 184, 135, byte.MaxValue); public static MagickColor CadetBlue => MagickColor.FromRgba(95, 158, 160, byte.MaxValue); public static MagickColor Chartreuse => MagickColor.FromRgba(127, byte.MaxValue, 0, byte.MaxValue); public static MagickColor Chocolate => MagickColor.FromRgba(210, 105, 30, byte.MaxValue); public static MagickColor Coral => MagickColor.FromRgba(byte.MaxValue, 127, 80, byte.MaxValue); public static MagickColor CornflowerBlue => MagickColor.FromRgba(100, 149, 237, byte.MaxValue); public static MagickColor Cornsilk => MagickColor.FromRgba(byte.MaxValue, 248, 220, byte.MaxValue); public static MagickColor Crimson => MagickColor.FromRgba(220, 20, 60, byte.MaxValue); public static MagickColor Cyan => MagickColor.FromRgba(0, byte.MaxValue, byte.MaxValue, byte.MaxValue); public static MagickColor DarkBlue => MagickColor.FromRgba(0, 0, 139, byte.MaxValue); public static MagickColor DarkCyan => MagickColor.FromRgba(0, 139, 139, byte.MaxValue); public static MagickColor DarkGoldenrod => MagickColor.FromRgba(184, 134, 11, byte.MaxValue); public static MagickColor DarkGray => MagickColor.FromRgba(169, 169, 169, byte.MaxValue); public static MagickColor DarkGreen => MagickColor.FromRgba(0, 100, 0, byte.MaxValue); public static MagickColor DarkKhaki => MagickColor.FromRgba(189, 183, 107, byte.MaxValue); public static MagickColor DarkMagenta => MagickColor.FromRgba(139, 0, 139, byte.MaxValue); public static MagickColor DarkOliveGreen => MagickColor.FromRgba(85, 107, 47, byte.MaxValue); public static MagickColor DarkOrange => MagickColor.FromRgba(byte.MaxValue, 140, 0, byte.MaxValue); public static MagickColor DarkOrchid => MagickColor.FromRgba(153, 50, 204, byte.MaxValue); public static MagickColor DarkRed => MagickColor.FromRgba(139, 0, 0, byte.MaxValue); public static MagickColor DarkSalmon => MagickColor.FromRgba(233, 150, 122, byte.MaxValue); public static MagickColor DarkSeaGreen => MagickColor.FromRgba(143, 188, 143, byte.MaxValue); public static MagickColor DarkSlateBlue => MagickColor.FromRgba(72, 61, 139, byte.MaxValue); public static MagickColor DarkSlateGray => MagickColor.FromRgba(47, 79, 79, byte.MaxValue); public static MagickColor DarkTurquoise => MagickColor.FromRgba(0, 206, 209, byte.MaxValue); public static MagickColor DarkViolet => MagickColor.FromRgba(148, 0, 211, byte.MaxValue); public static MagickColor DeepPink => MagickColor.FromRgba(byte.MaxValue, 20, 147, byte.MaxValue); public static MagickColor DeepSkyBlue => MagickColor.FromRgba(0, 191, byte.MaxValue, byte.MaxValue); public static MagickColor DimGray => MagickColor.FromRgba(105, 105, 105, byte.MaxValue); public static MagickColor DodgerBlue => MagickColor.FromRgba(30, 144, byte.MaxValue, byte.MaxValue); public static MagickColor Firebrick => MagickColor.FromRgba(178, 34, 34, byte.MaxValue); public static MagickColor FloralWhite => MagickColor.FromRgba(byte.MaxValue, 250, 240, byte.MaxValue); public static MagickColor ForestGreen => MagickColor.FromRgba(34, 139, 34, byte.MaxValue); public static MagickColor Fuchsia => MagickColor.FromRgba(byte.MaxValue, 0, byte.MaxValue, byte.MaxValue); public static MagickColor Gainsboro => MagickColor.FromRgba(220, 220, 220, byte.MaxValue); public static MagickColor GhostWhite => MagickColor.FromRgba(248, 248, byte.MaxValue, byte.MaxValue); public static MagickColor Gold => MagickColor.FromRgba(byte.MaxValue, 215, 0, byte.MaxValue); public static MagickColor Goldenrod => MagickColor.FromRgba(218, 165, 32, byte.MaxValue); public static MagickColor Gray => MagickColor.FromRgba(128, 128, 128, byte.MaxValue); public static MagickColor Green => MagickColor.FromRgba(0, 128, 0, byte.MaxValue); public static MagickColor GreenYellow => MagickColor.FromRgba(173, byte.MaxValue, 47, byte.MaxValue); public static MagickColor Honeydew => MagickColor.FromRgba(240, byte.MaxValue, 240, byte.MaxValue); public static MagickColor HotPink => MagickColor.FromRgba(byte.MaxValue, 105, 180, byte.MaxValue); public static MagickColor IndianRed => MagickColor.FromRgba(205, 92, 92, byte.MaxValue); public static MagickColor Indigo => MagickColor.FromRgba(75, 0, 130, byte.MaxValue); public static MagickColor Ivory => MagickColor.FromRgba(byte.MaxValue, byte.MaxValue, 240, byte.MaxValue); public static MagickColor Khaki => MagickColor.FromRgba(240, 230, 140, byte.MaxValue); public static MagickColor Lavender => MagickColor.FromRgba(230, 230, 250, byte.MaxValue); public static MagickColor LavenderBlush => MagickColor.FromRgba(byte.MaxValue, 240, 245, byte.MaxValue); public static MagickColor LawnGreen => MagickColor.FromRgba(124, 252, 0, byte.MaxValue); public static MagickColor LemonChiffon => MagickColor.FromRgba(byte.MaxValue, 250, 205, byte.MaxValue); public static MagickColor LightBlue => MagickColor.FromRgba(173, 216, 230, byte.MaxValue); public static MagickColor LightCoral => MagickColor.FromRgba(240, 128, 128, byte.MaxValue); public static MagickColor LightCyan => MagickColor.FromRgba(224, byte.MaxValue, byte.MaxValue, byte.MaxValue); public static MagickColor LightGoldenrodYellow => MagickColor.FromRgba(250, 250, 210, byte.MaxValue); public static MagickColor LightGreen => MagickColor.FromRgba(144, 238, 144, byte.MaxValue); public static MagickColor LightGray => MagickColor.FromRgba(211, 211, 211, byte.MaxValue); public static MagickColor LightPink => MagickColor.FromRgba(byte.MaxValue, 182, 193, byte.MaxValue); public static MagickColor LightSalmon => MagickColor.FromRgba(byte.MaxValue, 160, 122, byte.MaxValue); public static MagickColor LightSeaGreen => MagickColor.FromRgba(32, 178, 170, byte.MaxValue); public static MagickColor LightSkyBlue => MagickColor.FromRgba(135, 206, 250, byte.MaxValue); public static MagickColor LightSlateGray => MagickColor.FromRgba(119, 136, 153, byte.MaxValue); public static MagickColor LightSteelBlue => MagickColor.FromRgba(176, 196, 222, byte.MaxValue); public static MagickColor LightYellow => MagickColor.FromRgba(byte.MaxValue, byte.MaxValue, 224, byte.MaxValue); public static MagickColor Lime => MagickColor.FromRgba(0, byte.MaxValue, 0, byte.MaxValue); public static MagickColor LimeGreen => MagickColor.FromRgba(50, 205, 50, byte.MaxValue); public static MagickColor Linen => MagickColor.FromRgba(250, 240, 230, byte.MaxValue); public static MagickColor Magenta => MagickColor.FromRgba(byte.MaxValue, 0, byte.MaxValue, byte.MaxValue); public static MagickColor Maroon => MagickColor.FromRgba(128, 0, 0, byte.MaxValue); public static MagickColor MediumAquamarine => MagickColor.FromRgba(102, 205, 170, byte.MaxValue); public static MagickColor MediumBlue => MagickColor.FromRgba(0, 0, 205, byte.MaxValue); public static MagickColor MediumOrchid => MagickColor.FromRgba(186, 85, 211, byte.MaxValue); public static MagickColor MediumPurple => MagickColor.FromRgba(147, 112, 219, byte.MaxValue); public static MagickColor MediumSeaGreen => MagickColor.FromRgba(60, 179, 113, byte.MaxValue); public static MagickColor MediumSlateBlue => MagickColor.FromRgba(123, 104, 238, byte.MaxValue); public static MagickColor MediumSpringGreen => MagickColor.FromRgba(0, 250, 154, byte.MaxValue); public static MagickColor MediumTurquoise => MagickColor.FromRgba(72, 209, 204, byte.MaxValue); public static MagickColor MediumVioletRed => MagickColor.FromRgba(199, 21, 133, byte.MaxValue); public static MagickColor MidnightBlue => MagickColor.FromRgba(25, 25, 112, byte.MaxValue); public static MagickColor MintCream => MagickColor.FromRgba(245, byte.MaxValue, 250, byte.MaxValue); public static MagickColor MistyRose => MagickColor.FromRgba(byte.MaxValue, 228, 225, byte.MaxValue); public static MagickColor Moccasin => MagickColor.FromRgba(byte.MaxValue, 228, 181, byte.MaxValue); public static MagickColor NavajoWhite => MagickColor.FromRgba(byte.MaxValue, 222, 173, byte.MaxValue); public static MagickColor Navy => MagickColor.FromRgba(0, 0, 128, byte.MaxValue); public static MagickColor OldLace => MagickColor.FromRgba(253, 245, 230, byte.MaxValue); public static MagickColor Olive => MagickColor.FromRgba(128, 128, 0, byte.MaxValue); public static MagickColor OliveDrab => MagickColor.FromRgba(107, 142, 35, byte.MaxValue); public static MagickColor Orange => MagickColor.FromRgba(byte.MaxValue, 165, 0, byte.MaxValue); public static MagickColor OrangeRed => MagickColor.FromRgba(byte.MaxValue, 69, 0, byte.MaxValue); public static MagickColor Orchid => MagickColor.FromRgba(218, 112, 214, byte.MaxValue); public static MagickColor PaleGoldenrod => MagickColor.FromRgba(238, 232, 170, byte.MaxValue); public static MagickColor PaleGreen => MagickColor.FromRgba(152, 251, 152, byte.MaxValue); public static MagickColor PaleTurquoise => MagickColor.FromRgba(175, 238, 238, byte.MaxValue); public static MagickColor PaleVioletRed => MagickColor.FromRgba(219, 112, 147, byte.MaxValue); public static MagickColor PapayaWhip => MagickColor.FromRgba(byte.MaxValue, 239, 213, byte.MaxValue); public static MagickColor PeachPuff => MagickColor.FromRgba(byte.MaxValue, 218, 185, byte.MaxValue); public static MagickColor Peru => MagickColor.FromRgba(205, 133, 63, byte.MaxValue); public static MagickColor Pink => MagickColor.FromRgba(byte.MaxValue, 192, 203, byte.MaxValue); public static MagickColor Plum => MagickColor.FromRgba(221, 160, 221, byte.MaxValue); public static MagickColor PowderBlue => MagickColor.FromRgba(176, 224, 230, byte.MaxValue); public static MagickColor Purple => MagickColor.FromRgba(128, 0, 128, byte.MaxValue); public static MagickColor Red => MagickColor.FromRgba(byte.MaxValue, 0, 0, byte.MaxValue); public static MagickColor RosyBrown => MagickColor.FromRgba(188, 143, 143, byte.MaxValue); public static MagickColor RoyalBlue => MagickColor.FromRgba(65, 105, 225, byte.MaxValue); public static MagickColor SaddleBrown => MagickColor.FromRgba(139, 69, 19, byte.MaxValue); public static MagickColor Salmon => MagickColor.FromRgba(250, 128, 114, byte.MaxValue); public static MagickColor SandyBrown => MagickColor.FromRgba(244, 164, 96, byte.MaxValue); public static MagickColor SeaGreen => MagickColor.FromRgba(46, 139, 87, byte.MaxValue); public static MagickColor SeaShell => MagickColor.FromRgba(byte.MaxValue, 245, 238, byte.MaxValue); public static MagickColor Sienna => MagickColor.FromRgba(160, 82, 45, byte.MaxValue); public static MagickColor Silver => MagickColor.FromRgba(192, 192, 192, byte.MaxValue); public static MagickColor SkyBlue => MagickColor.FromRgba(135, 206, 235, byte.MaxValue); public static MagickColor SlateBlue => MagickColor.FromRgba(106, 90, 205, byte.MaxValue); public static MagickColor SlateGray => MagickColor.FromRgba(112, 128, 144, byte.MaxValue); public static MagickColor Snow => MagickColor.FromRgba(byte.MaxValue, 250, 250, byte.MaxValue); public static MagickColor SpringGreen => MagickColor.FromRgba(0, byte.MaxValue, 127, byte.MaxValue); public static MagickColor SteelBlue => MagickColor.FromRgba(70, 130, 180, byte.MaxValue); public static MagickColor Tan => MagickColor.FromRgba(210, 180, 140, byte.MaxValue); public static MagickColor Teal => MagickColor.FromRgba(0, 128, 128, byte.MaxValue); public static MagickColor Thistle => MagickColor.FromRgba(216, 191, 216, byte.MaxValue); public static MagickColor Tomato => MagickColor.FromRgba(byte.MaxValue, 99, 71, byte.MaxValue); public static MagickColor Turquoise => MagickColor.FromRgba(64, 224, 208, byte.MaxValue); public static MagickColor Violet => MagickColor.FromRgba(238, 130, 238, byte.MaxValue); public static MagickColor Wheat => MagickColor.FromRgba(245, 222, 179, byte.MaxValue); public static MagickColor White => MagickColor.FromRgba(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue); public static MagickColor WhiteSmoke => MagickColor.FromRgba(245, 245, 245, byte.MaxValue); public static MagickColor Yellow => MagickColor.FromRgba(byte.MaxValue, byte.MaxValue, 0, byte.MaxValue); public static MagickColor YellowGreen => MagickColor.FromRgba(154, 205, 50, byte.MaxValue); } public sealed class MagickDefine : IDefine { public MagickFormat Format { get; } public string Name { get; } public string Value { get; } public MagickDefine(string name, string value) : this((MagickFormat)0, name, value) { } public MagickDefine(MagickFormat format, string name, string value) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) Throw.IfNullOrEmpty("name", name); Throw.IfNullOrEmpty("value", value); Format = format; Name = name; Value = value; } } internal abstract class DrawableCoordinates<TCoordinateType> { protected List<TCoordinateType> Coordinates { get; } protected DrawableCoordinates(IEnumerable<TCoordinateType> coordinates, int minCount) { Throw.IfNull("coordinates", coordinates); Coordinates = CheckCoordinates(new List<TCoordinateType>(coordinates), minCount); } public IList<TCoordinateType> ToList() { return Coordinates; } private static List<TCoordinateType> CheckCoordinates(List<TCoordinateType> coordinates, int minCount) { if (coordinates.Count == 0) { throw new ArgumentException("Value cannot be empty", "coordinates"); } foreach (TCoordinateType coordinate in coordinates) { if (coordinate == null) { throw new ArgumentNullException("coordinates", "Value should not contain null values"); } } if (coordinates.Count < minCount) { throw new ArgumentException("Value should contain at least " + minCount + " coordinates.", "coordinates"); } return coordinates; } } internal class PathArcCoordinates : DrawableCoordinates<PathArc> { public PathArcCoordinates(IEnumerable<PathArc> coordinates) : base(coordinates, 0) { } } internal class PointDCoordinates : DrawableCoordinates<PointD> { public PointDCoordinates(IEnumerable<PointD> coordinates) : this(coordinates, 0) { } public PointDCoordinates(IEnumerable<PointD> coordinates, int minCount) : base(coordinates, minCount) { } public PointDCoordinates(params PointD[] coordinates) : this((IEnumerable<PointD>)coordinates) { } } public sealed class DrawableAffine : IDrawableAffine, IDrawable, IDrawingWand { public double ScaleX { get; set; } public double ScaleY { get; set; } public double ShearX { get; set; } public double ShearY { get; set; } public double TranslateX { get; set; } public double TranslateY { get; set; } public DrawableAffine() { Reset(); } public DrawableAffine(double scaleX, double scaleY, double shearX, double shearY, double translateX, double translateY) { ScaleX = scaleX; ScaleY = scaleY; ShearX = shearX; ShearY = shearY; TranslateX = translateX; TranslateY = translateY; } void IDrawingWand.Draw(DrawingWand wand) { wand?.Affine(ScaleX, ScaleY, ShearX, ShearY, TranslateX, TranslateY); } public void Reset() { ScaleX = 1.0; ScaleY = 1.0; ShearX = 0.0; ShearY = 0.0; TranslateX = 0.0; TranslateY = 0.0; } public void TransformOrigin(double translateX, double translateY) { Transform(new DrawableAffine { TranslateX = translateX, TranslateY = translateY }); } public void TransformRotation(double angle) { Transform(new DrawableAffine { ScaleX = Math.Cos(DegreesToRadians(Math.IEEERemainder(angle, 360.0))), ScaleY = Math.Cos(DegreesToRadians(Math.IEEERemainder(angle, 360.0))), ShearX = 0.0 - Math.Sin(DegreesToRadians(Math.IEEERemainder(angle, 360.0))), ShearY = Math.Sin(DegreesToRadians(Math.IEEERemainder(angle, 360.0))) }); } public void TransformScale(double scaleX, double scaleY) { Transform(new DrawableAffine { ScaleX = scaleX, ScaleY = scaleY }); } public void TransformSkewX(double skewX) { Transform(new DrawableAffine { ShearX = Math.Tan(DegreesToRadians(Math.IEEERemainder(skewX, 360.0))) }); } public void TransformSkewY(double skewY) { Transform(new DrawableAffine { ShearY = Math.Tan(DegreesToRadians(Math.IEEERemainder(skewY, 360.0))) }); } private static double DegreesToRadians(double x) { return Math.PI * x / 180.0; } private void Transform(DrawableAffine affine) { double scaleX = ScaleX; double scaleY = ScaleY; double shearX = ShearX; double shearY = ShearY; double translateX = TranslateX; double translateY = TranslateY; ScaleX = scaleX * affine.ScaleX + shearY * affine.ShearX; ScaleY = shearX * affine.ShearY + scaleY * affine.ScaleY; ShearX = shearX * affine.ScaleX + scaleY * affine.ShearX; ShearY = scaleX * affine.ShearY + shearY * affine.ScaleY; TranslateX = scaleX * affine.TranslateX + shearY * affine.TranslateY + translateX; TranslateY = shearX * affine.TranslateX + scaleY * affine.TranslateY + translateY; } } public sealed class DrawableAlpha : IDrawable, IDrawingWand { public PaintMethod PaintMethod { get; set; } public double X { get; set; } public double Y { get; set; } public DrawableAlpha(double x, double y, PaintMethod paintMethod) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) X = x; Y = y; PaintMethod = paintMethod; } void IDrawingWand.Draw(DrawingWand wand) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) wand?.Alpha(X, Y, PaintMethod); } } public sealed class DrawableArc : IDrawable, IDrawingWand { public double EndDegrees { get; set; } public double EndX { get; set; } public double EndY { get; set; } public double StartDegrees { get; set; } public double StartX { get; set; } public double StartY { get; set; } public DrawableArc(double startX, double startY, double endX, double endY, double startDegrees, double endDegrees) { StartX = startX; StartY = startY; EndX = endX; EndY = endY; StartDegrees = startDegrees; EndDegrees = endDegrees; } void IDrawingWand.Draw(DrawingWand wand) { wand?.Arc(StartX, StartY, EndX, EndY, StartDegrees, EndDegrees); } } public sealed class DrawableBezier : IDrawable, IDrawingWand { private readonly PointDCoordinates _coordinates; public IEnumerable<PointD> Coordinates => _coordinates.ToList(); public DrawableBezier(params PointD[] coordinates) { _coordinates = new PointDCoordinates(coordinates, 3); } public DrawableBezier(IEnumerable<PointD> coordinates) { _coordinates = new PointDCoordinates(coordinates, 3); } void IDrawingWand.Draw(DrawingWand wand) { wand?.Bezier(_coordinates.ToList()); } } public sealed class DrawableBorderColor : IDrawable, IDrawingWand { public IMagickColor<ushort> Color { get; set; } public DrawableBorderColor(IMagickColor<ushort> color) { Throw.IfNull("color", color); Color = color; } void IDrawingWand.Draw(DrawingWand wand) { wand?.BorderColor(Color); } } public sealed class DrawableCircle : IDrawable, IDrawingWand { public double OriginX { get; set; } public double OriginY { get; set; } public double PerimeterX { get; set; } public double PerimeterY { get; set; } public DrawableCircle(double originX, double originY, double perimeterX, double perimeterY) { OriginX = originX; OriginY = originY; PerimeterX = perimeterX; PerimeterY = perimeterY; } void IDrawingWand.Draw(DrawingWand wand) { wand?.Circle(OriginX, OriginY, PerimeterX, PerimeterY); } } public sealed class DrawableClipPath : IDrawable, IDrawingWand { public string ClipPath { get; set; } public DrawableClipPath(string clipPath) { Throw.IfNullOrEmpty("clipPath", clipPath); ClipPath = clipPath; } void IDrawingWand.Draw(DrawingWand wand) { wand?.ClipPath(ClipPath); } } public sealed class DrawableClipRule : IDrawable, IDrawingWand { public FillRule FillRule { get; set; } public DrawableClipRule(FillRule fillRule) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) FillRule = fillRule; } void IDrawingWand.Draw(DrawingWand wand) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) wand?.ClipRule(FillRule); } } public sealed class DrawableClipUnits : IDrawable, IDrawingWand { public ClipPathUnit Units { get; set; } public DrawableClipUnits(ClipPathUnit units) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) Units = units; } void IDrawingWand.Draw(DrawingWand wand) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) wand?.ClipUnits(Units); } } public sealed class DrawableColor : IDrawable, IDrawingWand { public PaintMethod PaintMethod { get; set; } public double X { get; set; } public double Y { get; set; } public DrawableColor(double x, double y, PaintMethod paintMethod) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) X = x; Y = y; PaintMethod = paintMethod; } void IDrawingWand.Draw(DrawingWand wand) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) wand?.Color(X, Y, PaintMethod); } } public sealed class DrawableComposite : IDrawable, IDrawingWand { private readonly IMagickImage<ushort> _image; public CompositeOperator Compose { get; set; } public double Height { get; set; } public double Width { get; set; } public double X { get; set; } public double Y { get; set; } public DrawableComposite(double x, double y, IMagickImage<ushort> image) : this(x, y, (CompositeOperator)37, image) { } public DrawableComposite(double x, double y, CompositeOperator compose, IMagickImage<ushort> image) : this(image) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) X = x; Y = y; Width = ((IMagickImage)_image).Width; Height = ((IMagickImage)_image).Height; Compose = compose; } public DrawableComposite(IMagickGeometry offset, IMagickImage<ushort> image) : this(offset, (CompositeOperator)37, image) { } public DrawableComposite(IMagickGeometry offset, CompositeOperator compose, IMagickImage<ushort> image) : this(image) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) Throw.IfNull("offset", offset); X = offset.X; Y = offset.Y; Width = offset.Width; Height = offset.Height; Compose = compose; } private DrawableComposite(IMagickImage<ushort> image) { Throw.IfNull("image", image); _image = image; } void IDrawingWand.Draw(DrawingWand wand) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) wand?.Composite(X, Y, Width, Height, Compose, _image); } } public sealed class DrawableDensity : IDrawable, IDrawingWand { public PointD Density { get; set; } public DrawableDensity(double density) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) Density = new PointD(density); } public DrawableDensity(PointD pointDensity) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) Density = pointDensity; } void IDrawingWand.Draw(DrawingWand wand) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) wand?.Density(Density); } } public sealed class DrawableEllipse : IDrawable, IDrawingWand { public double EndDegrees { get; set; } public double OriginX { get; set; } public double OriginY { get; set; } public double RadiusX { get; set; } public double RadiusY { get; set; } public double StartDegrees { get; set; } public DrawableEllipse(double originX, double originY, double radiusX, double radiusY, double startDegrees, double endDegrees) { OriginX = originX; OriginY = originY; RadiusX = radiusX; RadiusY = radiusY; StartDegrees = startDegrees; EndDegrees = endDegrees; } void IDrawingWand.Draw(DrawingWand wand) { wand?.Ellipse(OriginX, OriginY, RadiusX, RadiusY, StartDegrees, EndDegrees); } } public sealed class DrawableFillColor : IDrawable, IDrawingWand { public IMagickColor<ushort> Color { get; set; } public DrawableFillColor(IMagickColor<ushort> color) { Throw.IfNull("color", color); Color = color; } void IDrawingWand.Draw(DrawingWand wand) { wand?.FillColor(Color); } } public sealed class DrawableFillOpacity : IDrawable, IDrawingWand { public Percentage Opacity { get; set; } public DrawableFillOpacity(Percentage opacity) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) Opacity = opacity; } void IDrawingWand.Draw(DrawingWand wand) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (wand != null) { Percentage opacity = Opacity; wand.FillOpacity(((Percentage)(ref opacity)).ToDouble() / 100.0); } } } public sealed class DrawableFillPatternUrl : IDrawable, IDrawingWand { public string Url { get; set; } public DrawableFillPatternUrl(string url) { Url = url; } void IDrawingWand.Draw(DrawingWand wand) { wand?.FillPatternUrl(Url); } } public sealed class DrawableFillRule : IDrawable, IDrawingWand { public FillRule FillRule { get; set; } public DrawableFillRule(FillRule fillRule) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) FillRule = fillRule; } void IDrawingWand.Draw(DrawingWand wand) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) wand?.FillRule(FillRule); } } public sealed class DrawableFont : IDrawable, IDrawingWand { private static readonly string[] _fontExtensions = new string[5] { ".ttf", ".ttc", ".pfb", ".pfm", ".otf" }; public string Family { get; set; } public FontStyleType Style { get; set; } public FontWeight Weight { get; set; } public FontStretch Stretch { get; set; } public DrawableFont(string family) : this(family, (FontStyleType)4, (FontWeight)400, (FontStretch)1) { } public DrawableFont(string family, FontStyleType style, FontWeight weight, FontStretch stretch) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) Throw.IfNullOrEmpty("family", family); Family = family; Style = style; Weight = weight; Stretch = stretch; } void IDrawingWand.Draw(DrawingWand wand) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (wand == null) { return; } string[] fontExtensions = _fontExtensions; foreach (string value in fontExtensions) { if (Family.EndsWith(value, StringComparison.OrdinalIgnoreCase)) { wand.Font(Family); return; } } wand.FontFamily(Family, Style, Weight, Stretch); } } public sealed class DrawableFontPointSize : IDrawable, IDrawingWand { public double PointSize { get; set; } public DrawableFontPointSize(double pointSize) { PointSize = pointSize; } void IDrawingWand.Draw(DrawingWand wand) { wand?.FontPointSize(PointSize); } } public sealed class DrawableGravity : IDrawable, IDrawingWand { public Gravity Gravity { get; set; } public DrawableGravity(Gravity gravity) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) Gravity = gravity; } void IDrawingWand.Draw(DrawingWand wand) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) wand?.Gravity(Gravity); } } public sealed class DrawableLine : IDrawable, IDrawingWand { public double EndX { get; set; } public double EndY { get; set; } public double StartX { get; set; } public double StartY { get; set; } public DrawableLine(double startX, double startY, double endX, double endY) { StartX = startX; StartY = startY; EndX = endX; EndY = endY; } void IDrawingWand.Draw(DrawingWand wand) { wand?.Line(StartX, StartY, EndX, EndY); } } public sealed class DrawablePath : IDrawable, IDrawingWand { private readonly List<IPath> _paths; public IEnumerable<IPath> Paths => _paths; public DrawablePath(params IPath[] paths) { _paths = new List<IPath>(paths); } public DrawablePath(IEnumerable<IPath> paths) { _paths = new List<IPath>(paths); } void IDrawingWand.Draw(DrawingWand wand) { if (wand == null) { return; } wand.PathStart(); foreach (IDrawingWand path in _paths) { path.Draw(wand); } wand.PathFinish(); } } public sealed class DrawablePoint : IDrawable, IDrawingWand { public double X { get; set; } public double Y { get; set; } public DrawablePoint(double x, double y) { X = x; Y = y; } void IDrawingWand.Draw(DrawingWand wand) { wand?.Point(X, Y); } } public sealed class DrawablePolygon : IDrawable, IDrawingWand { private readonly PointDCoordinates _coordinates; public DrawablePolygon(params PointD[] coordinates) { _coordinates = new PointDCoordinates(coordinates, 3); } public DrawablePolygon(IEnumerable<PointD> coordinates) { _coordinates = new PointDCoordinates(coordinates, 3); } void IDrawingWand.Draw(DrawingWand wand) { wand?.Polygon(_coordinates.ToList()); } } public sealed class DrawablePolyline : IDrawable, IDrawingWand { private readonly PointDCoordinates _coordinates; public DrawablePolyline(params PointD[] coordinates) { _coordinates = new PointDCoordinates(coordinates, 3); } public DrawablePolyline(IEnumerable<PointD> coordinates) { _coordinates = new PointDCoordinates(coordinates, 3); } void IDrawingWand.Draw(DrawingWand wand) { wand?.Polyline(_coordinates.ToList()); } } public sealed class DrawablePopClipPath : IDrawable, IDrawingWand { void IDrawingWand.Draw(DrawingWand wand) { wand?.PopClipPath(); } } public sealed class DrawablePopGraphicContext : IDrawable, IDrawingWand { void IDrawingWand.Draw(DrawingWand wand) { wand?.PopGraphicContext(); } } public sealed class DrawablePopPattern : IDrawable, IDrawingWand { void IDrawingWand.Draw(DrawingWand wand) { wand?.PopPattern(); } } public sealed class DrawablePushClipPath : IDrawable, IDrawingWand { public string ClipPath { get; set; } public DrawablePushClipPath(string clipPath) { ClipPath = clipPath; } void IDrawingWand.Draw(DrawingWand wand) { wand?.PushClipPath(ClipPath); } } public sealed class DrawablePushGraphicContext : IDrawable, IDrawingWand { void IDrawingWand.Draw(DrawingWand wand) { wand?.PushGraphicContext(); } } public sealed class DrawablePushPattern : IDrawable, IDrawingWand { public string ID { get; set; } public double Height { get; set; } public double Width { get; set; } public double X { get; set; } public double Y { get; set; } public DrawablePushPattern(string id, double x, double y, double width, double height) { ID = id; X = x; Y = y; Width = width; Height = height; } void IDrawingWand.Draw(DrawingWand wand) { wand?.PushPattern(ID, X, Y, Width, Height); } } public sealed class DrawableRectangle : IDrawable, IDrawingWand { public double LowerRightX { get; set; } public double LowerRightY { get; set; } public double UpperLeftX { get; set; } public double UpperLeftY { get; set; } public DrawableRectangle(double upperLeftX, double upperLeftY, double lowerRightX, double lowerRightY) { UpperLeftX = upperLeftX; UpperLeftY = upperLeftY; LowerRightX = lowerRightX; LowerRightY = lowerRightY; } void IDrawingWand.Draw(DrawingWand wand) { wand?.Rectangle(UpperLeftX, UpperLeftY, LowerRightX, LowerRightY); } } public sealed class DrawableRotation : IDrawable, IDrawingWand { public double Angle { get; set; } public DrawableRotation(double angle) { Angle = angle; } void IDrawingWand.Draw(DrawingWand wand) { wand?.Rotation(Angle); } } public sealed class DrawableRoundRectangle : IDrawable, IDrawingWand { public double CornerHeight { get; set; } public double CornerWidth { get; set; } public double LowerRightX { get; set; } public double LowerRightY { get; set; } public double UpperLeftX { get; set; } public double UpperLeftY { get; set; } public DrawableRoundRectangle(double upperLeftX, double upperLeftY, double lowerRightX, double lowerRightY, double cornerWidth, double cornerHeight) { UpperLeftX = upperLeftX; UpperLeftY = upperLeftY; LowerRightX = lowerRightX; LowerRightY = lowerRightY; CornerWidth = cornerWidth; CornerHeight = cornerHeight; } void IDrawingWand.Draw(DrawingWand wand) { wand?.RoundRectangle(UpperLeftX, UpperLeftY, LowerRightX, LowerRightY, CornerWidth, CornerHeight); } } [GeneratedCode("Magick.NET.FileGenerator", "")] public sealed class Drawables : IDrawables<ushort>, IEnumerable<IDrawable>, IEnumerable { private readonly Collection<IDrawable> _drawables; public Drawables() { _drawables = new Collection<IDrawable>(); } public IDrawables<ushort> Draw(IMagickImage<ushort> image) { Throw.IfNull("image", image); image.Draw((IDrawables<ushort>)this); return (IDrawables<ushort>)(object)this; } IEnumerator IEnumerable.GetEnumerator() { return _drawables.GetEnumerator(); } public ITypeMetric? FontTypeMetrics(string text) { return FontTypeMetrics(text, ignoreNewlines: false); } public ITypeMetric? FontTypeMetrics(string text, bool ignoreNewlines) { using MagickImage image = new MagickImage((IMagickColor<ushort>)(object)MagickColors.Transparent, 1, 1); using DrawingWand drawingWand = new DrawingWand((IMagickImage<ushort>)(object)image); drawingWand.Draw(this); return drawingWand.FontTypeMetrics(text, ignoreNewlines); } public IPaths<ushort> Paths() { return (IPaths<ushort>)(object)new Paths(this); } public IEnumerator<IDrawable> GetEnumerator() { return _drawables.GetEnumerator(); } public IDrawables<ushort> Affine(double scaleX, double scaleY, double shearX, double shearY, double translateX, double translateY) { _drawables.Add((IDrawable)(object)new DrawableAffine(scaleX, scaleY, shearX, shearY, translateX, translateY)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Alpha(double x, double y, PaintMethod paintMethod) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) _drawables.Add((IDrawable)(object)new DrawableAlpha(x, y, paintMethod)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Arc(double startX, double startY, double endX, double endY, double startDegrees, double endDegrees) { _drawables.Add((IDrawable)(object)new DrawableArc(startX, startY, endX, endY, startDegrees, endDegrees)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Bezier(params PointD[] coordinates) { _drawables.Add((IDrawable)(object)new DrawableBezier(coordinates)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Bezier(IEnumerable<PointD> coordinates) { _drawables.Add((IDrawable)(object)new DrawableBezier(coordinates)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> BorderColor(IMagickColor<ushort> color) { _drawables.Add((IDrawable)(object)new DrawableBorderColor(color)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Circle(double originX, double originY, double perimeterX, double perimeterY) { _drawables.Add((IDrawable)(object)new DrawableCircle(originX, originY, perimeterX, perimeterY)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> ClipPath(string clipPath) { _drawables.Add((IDrawable)(object)new DrawableClipPath(clipPath)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> ClipRule(FillRule fillRule) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _drawables.Add((IDrawable)(object)new DrawableClipRule(fillRule)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> ClipUnits(ClipPathUnit units) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _drawables.Add((IDrawable)(object)new DrawableClipUnits(units)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Color(double x, double y, PaintMethod paintMethod) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) _drawables.Add((IDrawable)(object)new DrawableColor(x, y, paintMethod)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Composite(IMagickGeometry offset, IMagickImage<ushort> image) { _drawables.Add((IDrawable)(object)new DrawableComposite(offset, image)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Composite(double x, double y, IMagickImage<ushort> image) { _drawables.Add((IDrawable)(object)new DrawableComposite(x, y, image)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Composite(IMagickGeometry offset, CompositeOperator compose, IMagickImage<ushort> image) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) _drawables.Add((IDrawable)(object)new DrawableComposite(offset, compose, image)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Composite(double x, double y, CompositeOperator compose, IMagickImage<ushort> image) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) _drawables.Add((IDrawable)(object)new DrawableComposite(x, y, compose, image)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Density(double density) { _drawables.Add((IDrawable)(object)new DrawableDensity(density)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Density(PointD pointDensity) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _drawables.Add((IDrawable)(object)new DrawableDensity(pointDensity)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Ellipse(double originX, double originY, double radiusX, double radiusY, double startDegrees, double endDegrees) { _drawables.Add((IDrawable)(object)new DrawableEllipse(originX, originY, radiusX, radiusY, startDegrees, endDegrees)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> FillColor(IMagickColor<ushort> color) { _drawables.Add((IDrawable)(object)new DrawableFillColor(color)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> FillOpacity(Percentage opacity) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _drawables.Add((IDrawable)(object)new DrawableFillOpacity(opacity)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> FillPatternUrl(string url) { _drawables.Add((IDrawable)(object)new DrawableFillPatternUrl(url)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> FillRule(FillRule fillRule) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _drawables.Add((IDrawable)(object)new DrawableFillRule(fillRule)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Font(string family) { _drawables.Add((IDrawable)(object)new DrawableFont(family)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Font(string family, FontStyleType style, FontWeight weight, FontStretch stretch) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) _drawables.Add((IDrawable)(object)new DrawableFont(family, style, weight, stretch)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> FontPointSize(double pointSize) { _drawables.Add((IDrawable)(object)new DrawableFontPointSize(pointSize)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Gravity(Gravity gravity) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _drawables.Add((IDrawable)(object)new DrawableGravity(gravity)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Line(double startX, double startY, double endX, double endY) { _drawables.Add((IDrawable)(object)new DrawableLine(startX, startY, endX, endY)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Path(params IPath[] paths) { _drawables.Add((IDrawable)(object)new DrawablePath(paths)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Path(IEnumerable<IPath> paths) { _drawables.Add((IDrawable)(object)new DrawablePath(paths)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Point(double x, double y) { _drawables.Add((IDrawable)(object)new DrawablePoint(x, y)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Polygon(params PointD[] coordinates) { _drawables.Add((IDrawable)(object)new DrawablePolygon(coordinates)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Polygon(IEnumerable<PointD> coordinates) { _drawables.Add((IDrawable)(object)new DrawablePolygon(coordinates)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Polyline(params PointD[] coordinates) { _drawables.Add((IDrawable)(object)new DrawablePolyline(coordinates)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Polyline(IEnumerable<PointD> coordinates) { _drawables.Add((IDrawable)(object)new DrawablePolyline(coordinates)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> PopClipPath() { _drawables.Add((IDrawable)(object)new DrawablePopClipPath()); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> PopGraphicContext() { _drawables.Add((IDrawable)(object)new DrawablePopGraphicContext()); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> PopPattern() { _drawables.Add((IDrawable)(object)new DrawablePopPattern()); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> PushClipPath(string clipPath) { _drawables.Add((IDrawable)(object)new DrawablePushClipPath(clipPath)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> PushGraphicContext() { _drawables.Add((IDrawable)(object)new DrawablePushGraphicContext()); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> PushPattern(string id, double x, double y, double width, double height) { _drawables.Add((IDrawable)(object)new DrawablePushPattern(id, x, y, width, height)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Rectangle(double upperLeftX, double upperLeftY, double lowerRightX, double lowerRightY) { _drawables.Add((IDrawable)(object)new DrawableRectangle(upperLeftX, upperLeftY, lowerRightX, lowerRightY)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Rotation(double angle) { _drawables.Add((IDrawable)(object)new DrawableRotation(angle)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> RoundRectangle(double upperLeftX, double upperLeftY, double lowerRightX, double lowerRightY, double cornerWidth, double cornerHeight) { _drawables.Add((IDrawable)(object)new DrawableRoundRectangle(upperLeftX, upperLeftY, lowerRightX, lowerRightY, cornerWidth, cornerHeight)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Scaling(double x, double y) { _drawables.Add((IDrawable)(object)new DrawableScaling(x, y)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> SkewX(double angle) { _drawables.Add((IDrawable)(object)new DrawableSkewX(angle)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> SkewY(double angle) { _drawables.Add((IDrawable)(object)new DrawableSkewY(angle)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> StrokeAntialias(bool isEnabled) { _drawables.Add((IDrawable)(object)new DrawableStrokeAntialias(isEnabled)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> StrokeColor(IMagickColor<ushort> color) { _drawables.Add((IDrawable)(object)new DrawableStrokeColor(color)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> StrokeDashArray(params double[] dash) { _drawables.Add((IDrawable)(object)new DrawableStrokeDashArray(dash)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> StrokeDashOffset(double offset) { _drawables.Add((IDrawable)(object)new DrawableStrokeDashOffset(offset)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> StrokeLineCap(LineCap lineCap) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _drawables.Add((IDrawable)(object)new DrawableStrokeLineCap(lineCap)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> StrokeLineJoin(LineJoin lineJoin) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _drawables.Add((IDrawable)(object)new DrawableStrokeLineJoin(lineJoin)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> StrokeMiterLimit(int miterlimit) { _drawables.Add((IDrawable)(object)new DrawableStrokeMiterLimit(miterlimit)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> StrokeOpacity(Percentage opacity) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _drawables.Add((IDrawable)(object)new DrawableStrokeOpacity(opacity)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> StrokePatternUrl(string url) { _drawables.Add((IDrawable)(object)new DrawableStrokePatternUrl(url)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> StrokeWidth(double width) { _drawables.Add((IDrawable)(object)new DrawableStrokeWidth(width)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Text(double x, double y, string value) { _drawables.Add((IDrawable)(object)new DrawableText(x, y, value)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> TextAlignment(TextAlignment alignment) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _drawables.Add((IDrawable)(object)new DrawableTextAlignment(alignment)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> TextAntialias(bool isEnabled) { _drawables.Add((IDrawable)(object)new DrawableTextAntialias(isEnabled)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> TextDecoration(TextDecoration decoration) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _drawables.Add((IDrawable)(object)new DrawableTextDecoration(decoration)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> TextDirection(TextDirection direction) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _drawables.Add((IDrawable)(object)new DrawableTextDirection(direction)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> TextEncoding(Encoding encoding) { _drawables.Add((IDrawable)(object)new DrawableTextEncoding(encoding)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> TextInterlineSpacing(double spacing) { _drawables.Add((IDrawable)(object)new DrawableTextInterlineSpacing(spacing)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> TextInterwordSpacing(double spacing) { _drawables.Add((IDrawable)(object)new DrawableTextInterwordSpacing(spacing)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> TextKerning(double kerning) { _drawables.Add((IDrawable)(object)new DrawableTextKerning(kerning)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> TextUnderColor(IMagickColor<ushort> color) { _drawables.Add((IDrawable)(object)new DrawableTextUnderColor(color)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Translation(double x, double y) { _drawables.Add((IDrawable)(object)new DrawableTranslation(x, y)); return (IDrawables<ushort>)(object)this; } public IDrawables<ushort> Viewbox(double upperLeftX, double upperLeftY, double lowerRightX, double lowerRightY) { _drawables.Add((IDrawable)(object)new DrawableViewbox(upperLeftX, upperLeftY, lowerRightX, lowerRightY)); return (IDrawables<ushort>)(object)this; } } public sealed class DrawableScaling : IDrawable, IDrawingWand { public double X { get; set; } public double Y { get; set; } public DrawableScaling(double x, double y) { X = x; Y = y; } void IDrawingWand.Draw(DrawingWand wand) { wand?.Scaling(X, Y); } } public sealed class DrawableSkewX : IDrawable, IDrawingWand { public double Angle { get; set; } public DrawableSkewX(double angle) { Angle = angle; } void IDrawingWand.Draw(DrawingWand wand) { wand?.SkewX(Angle); } } public sealed class DrawableSkewY : IDrawable, IDrawingWand { public double Angle { get; set; } public DrawableSkewY(double angle) { Angle = angle; } void IDrawingWand.Draw(DrawingWand wand) { wand?.SkewY(Angle); } } public sealed class DrawableStrokeAntialias : IDrawable, IDrawingWand { public bool IsEnabled { get; set; } public DrawableStrokeAntialias(bool isEnabled) { IsEnabled = isEnabled; } void IDrawingWand.Draw(DrawingWand wand) { wand?.StrokeAntialias(IsEnabled); } } public sealed class DrawableStrokeColor : IDrawable, IDrawingWand { public IMagickColor<ushort> Color { get; set; } public DrawableStrokeColor(IMagickColor<ushort> color) { Throw.IfNull("color", color); Color = color; } void IDrawingWand.Draw(DrawingWand wand) { wand?.StrokeColor(Color); } } public sealed class DrawableStrokeDashArray : IDrawable, IDrawingWand { private readonly double[] _dash; public DrawableStrokeDashArray(params double[] dash) { _dash = dash; } void IDrawingWand.Draw(DrawingWand wand) { wand?.StrokeDashArray(_dash); } } public sealed class DrawableStrokeDashOffset : IDrawable, IDrawingWand { public double Offset { get; set; } public DrawableStrokeDashOffset(double offset) { Offset = offset; } void IDrawingWand.Draw(DrawingWand wand) { wand?.StrokeDashOffset(Offset); } } public sealed class DrawableStrokeLineCap : IDrawable, IDrawingWand { public LineCap LineCap { get; set; } public DrawableStrokeLineCap(LineCap lineCap) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) LineCap = lineCap; } void IDrawingWand.Draw(DrawingWand wand) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) wand?.StrokeLineCap(LineCap); } } public sealed class DrawableStrokeLineJoin : IDrawable, IDrawingWand { public LineJoin LineJoin { get; set; } public DrawableStrokeLineJoin(LineJoin lineJoin) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) LineJoin = lineJoin; } void IDrawingWand.Draw(DrawingWand wand) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) wand?.StrokeLineJoin(LineJoin); } } public sealed class DrawableStrokeMiterLimit : IDrawable, IDrawingWand { public int Miterlimit { get; set; } public DrawableStrokeMiterLimit(int miterlimit) { Miterlimit = miterlimit; } void IDrawingWand.Draw(DrawingWand wand) { wand?.StrokeMiterLimit(Miterlimit); } } public sealed class DrawableStrokeOpacity : IDrawable, IDrawingWand { public Percentage Opacity { get; set; } public DrawableStrokeOpacity(Percentage opacity) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) Opacity = opacity; } void IDrawingWand.Draw(DrawingWand wand) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) wand?.StrokeOpacity((double)Opacity / 100.0); } } public sealed class DrawableStrokePatternUrl : IDrawable, IDrawingWand { public string Url { get; set; } public DrawableStrokePatternUrl(string url) { Url = url; } void IDrawingWand.Draw(DrawingWand wand) { wand?.StrokePatternUrl(Url); } } public sealed class DrawableStrokeWidth : IDrawable, IDrawingWand { public double Width { get; set; } public DrawableStrokeWidth(double width) { Width = width; } void IDrawingWand.Draw(DrawingWand wand) { wand?.StrokeWidth(Width); } } public sealed class DrawableText : IDrawable, IDrawingWand { public string Value { get; set; } public double X { get; set; } public double Y { get; set; } public DrawableText(double x, double y, string value) { Throw.IfNullOrEmpty("value", value); X = x; Y = y; Value = value; } void IDrawingWand.Draw(DrawingWand wand) { wand?.Text(X, Y, Value); } } public sealed class DrawableTextAlignment : IDrawable, IDrawingWand { public TextAlignment Alignment { get; set; } public DrawableTextAlignment(TextAlignment alignment) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) Alignment = alignment; } void IDrawingWand.Draw(DrawingWand wand) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) wand?.TextAlignment(Alignment); } } public sealed class DrawableTextAntialias : IDrawable, IDrawingWand { public bool IsEnabled { get; set; } public DrawableTextAntialias(bool isEnabled) { IsEnabled = isEnabled;