CreateInstance() static private méthode

static private CreateInstance ( MagickColor instance ) : INativeInstance
instance MagickColor
Résultat INativeInstance
Exemple #1
0
 public bool FuzzyEquals(IMagickColor <QuantumType>?other, QuantumType fuzz)
 {
     using (var otherNative = MagickColor.CreateInstance(other))
     {
         bool result;
         #if PLATFORM_AnyCPU
         if (OperatingSystem.IsArm64)
         #endif
         #if PLATFORM_arm64 || PLATFORM_AnyCPU
         result = NativeMethods.ARM64.MagickColor_FuzzyEquals(Instance, otherNative.Instance, fuzz);
         #endif
         #if PLATFORM_AnyCPU
         else if (OperatingSystem.Is64Bit)
         #endif
         #if PLATFORM_x64 || PLATFORM_AnyCPU
         result = NativeMethods.X64.MagickColor_FuzzyEquals(Instance, otherNative.Instance, fuzz);
         #endif
         #if PLATFORM_AnyCPU
         else
         #endif
         #if PLATFORM_x86 || PLATFORM_AnyCPU
         result = NativeMethods.X86.MagickColor_FuzzyEquals(Instance, otherNative.Instance, fuzz);
         #endif
         return(result);
     }
 }
Exemple #2
0
 public bool FuzzyEquals(MagickColor other, QuantumType fuzz)
 {
     using (INativeInstance otherNative = MagickColor.CreateInstance(other))
     {
         if (NativeLibrary.Is64Bit)
         {
             return(NativeMethods.X64.MagickColor_FuzzyEquals(Instance, otherNative.Instance, fuzz));
         }
         else
         {
             return(NativeMethods.X86.MagickColor_FuzzyEquals(Instance, otherNative.Instance, fuzz));
         }
     }
 }
Exemple #3
0
 public void SetStrokeColor(MagickColor value)
 {
     using (INativeInstance valueNative = MagickColor.CreateInstance(value))
     {
         if (NativeLibrary.Is64Bit)
         {
             NativeMethods.X64.MontageSettings_SetStrokeColor(Instance, valueNative.Instance);
         }
         else
         {
             NativeMethods.X86.MontageSettings_SetStrokeColor(Instance, valueNative.Instance);
         }
     }
 }
Exemple #4
0
            public static IMagickColor <QuantumType> GetColor(IntPtr instance)
            {
                IntPtr result;

                #if PLATFORM_AnyCPU
                if (OperatingSystem.Is64Bit)
                #endif
                #if PLATFORM_x64 || PLATFORM_AnyCPU
                result = NativeMethods.X64.ConnectedComponent_GetColor(instance);
                #endif
                #if PLATFORM_AnyCPU
                else
                #endif
                #if PLATFORM_x86 || PLATFORM_AnyCPU
                result = NativeMethods.X86.ConnectedComponent_GetColor(instance);
                #endif
                return(MagickColor.CreateInstance(result));
            }
 public void SetStrokeColor(MagickColor value)
 {
     using (INativeInstance valueNative = MagickColor.CreateInstance(value))
     {
         #if PLATFORM_AnyCPU
         if (NativeLibrary.Is64Bit)
         #endif
         #if PLATFORM_x64 || PLATFORM_AnyCPU
         NativeMethods.X64.MontageSettings_SetStrokeColor(Instance, valueNative.Instance);
         #endif
         #if PLATFORM_AnyCPU
         else
         #endif
         #if PLATFORM_x86 || PLATFORM_AnyCPU
         NativeMethods.X86.MontageSettings_SetStrokeColor(Instance, valueNative.Instance);
         #endif
     }
 }
Exemple #6
0
 public bool FuzzyEquals(MagickColor other, QuantumType fuzz)
 {
     using (INativeInstance otherNative = MagickColor.CreateInstance(other))
     {
         #if PLATFORM_AnyCPU
         if (NativeLibrary.Is64Bit)
         #endif
         #if PLATFORM_x64 || PLATFORM_AnyCPU
         return(NativeMethods.X64.MagickColor_FuzzyEquals(Instance, otherNative.Instance, fuzz));
         #endif
         #if PLATFORM_AnyCPU
         else
         #endif
         #if PLATFORM_x86 || PLATFORM_AnyCPU
         return(NativeMethods.X86.MagickColor_FuzzyEquals(Instance, otherNative.Instance, fuzz));
         #endif
     }
 }
            public static MagickColor GetColor(IntPtr instance)
            {
                IntPtr result;

                #if PLATFORM_AnyCPU
                if (NativeLibrary.Is64Bit)
                #endif
                #if PLATFORM_x64 || PLATFORM_AnyCPU
                result = NativeMethods.X64.ConnectedComponent_GetColor(instance);
                #endif
                #if PLATFORM_AnyCPU
                else
                #endif
                #if PLATFORM_x86 || PLATFORM_AnyCPU
                result = NativeMethods.X86.ConnectedComponent_GetColor(instance);
                #endif
                return(MagickColor.CreateInstance(result));
            }
   public void SetFillColor(MagickColor value)
   {
       using (INativeInstance valueNative = MagickColor.CreateInstance(value))
       {
 #if ANYCPU
           if (NativeLibrary.Is64Bit)
 #endif
 #if WIN64 || ANYCPU
           NativeMethods.X64.MontageSettings_SetFillColor(Instance, valueNative.Instance);
 #endif
 #if ANYCPU
           else
 #endif
 #if !WIN64 || ANYCPU
           NativeMethods.X86.MontageSettings_SetFillColor(Instance, valueNative.Instance);
 #endif
       }
   }
 public void SetStrokeColor(IMagickColor <QuantumType> value)
 {
     using (INativeInstance valueNative = MagickColor.CreateInstance(value))
     {
         #if PLATFORM_AnyCPU
         if (OperatingSystem.Is64Bit)
         #endif
         #if PLATFORM_x64 || PLATFORM_AnyCPU
         NativeMethods.X64.MontageSettings_SetStrokeColor(Instance, valueNative.Instance);
         #endif
         #if PLATFORM_AnyCPU
         else
         #endif
         #if PLATFORM_x86 || PLATFORM_AnyCPU
         NativeMethods.X86.MontageSettings_SetStrokeColor(Instance, valueNative.Instance);
         #endif
     }
 }
        public static Dictionary <IMagickColor <QuantumType>, int> ToDictionary(IntPtr list, int length)
        {
            var colors = new Dictionary <IMagickColor <QuantumType>, int>();

            if (list == IntPtr.Zero)
            {
                return(colors);
            }

            for (int i = 0; i < length; i++)
            {
                var instance = NativeMagickColorCollection.GetInstance(list, i);

                var color = MagickColor.CreateInstance(instance, out var count);
                colors[color] = count;
            }

            return(colors);
        }
Exemple #11
0
        public static Dictionary <MagickColor, int> ToDictionary(IntPtr list, int length)
        {
            Dictionary <MagickColor, int> colors = new Dictionary <MagickColor, int>();

            if (list == IntPtr.Zero)
            {
                return(colors);
            }

            for (int i = 0; i < length; i++)
            {
                IntPtr instance = NativeMagickColorCollection.GetInstance(list, i);
                Debug.Assert(instance != IntPtr.Zero);

                MagickColor color = MagickColor.CreateInstance(instance);
                colors[color] = color.Count;
            }

            return(colors);
        }
 public void SetBorderColor(IMagickColor <QuantumType>?value)
 {
     using (var valueNative = MagickColor.CreateInstance(value))
     {
         #if PLATFORM_AnyCPU
         if (OperatingSystem.IsArm64)
         #endif
         #if PLATFORM_arm64 || PLATFORM_AnyCPU
         NativeMethods.ARM64.MontageSettings_SetBorderColor(Instance, valueNative.Instance);
         #endif
         #if PLATFORM_AnyCPU
         else if (OperatingSystem.Is64Bit)
         #endif
         #if PLATFORM_x64 || PLATFORM_AnyCPU
         NativeMethods.X64.MontageSettings_SetBorderColor(Instance, valueNative.Instance);
         #endif
         #if PLATFORM_AnyCPU
         else
         #endif
         #if PLATFORM_x86 || PLATFORM_AnyCPU
         NativeMethods.X86.MontageSettings_SetBorderColor(Instance, valueNative.Instance);
         #endif
     }
 }