Ejemplo n.º 1
0
 internal static INativeInstance CreateInstance(IQuantizeSettings instance)
 {
     if (instance == null)
     {
         return(NativeInstance.Zero);
     }
     return(QuantizeSettings.CreateNativeInstance(instance));
 }
Ejemplo n.º 2
0
        private static INativeInstance CreateNativeInstance(IQuantizeSettings settings)
        {
            var instance = new NativeQuantizeSettings();

            instance.SetColors(settings.Colors);
            instance.SetColorSpace(settings.ColorSpace);
            instance.SetDitherMethod(settings.DitherMethod ?? ImageMagick.DitherMethod.No);
            instance.SetMeasureErrors(settings.MeasureErrors);
            instance.SetTreeDepth(settings.TreeDepth);

            return(instance);
        }
 public void Quantize(IMagickImage image, IQuantizeSettings settings)
 {
     using (INativeInstance settingsNative = QuantizeSettings.CreateInstance(settings))
     {
         IntPtr exception = IntPtr.Zero;
         #if PLATFORM_AnyCPU
         if (OperatingSystem.Is64Bit)
         #endif
         #if PLATFORM_x64 || PLATFORM_AnyCPU
         NativeMethods.X64.MagickImageCollection_Quantize(image.GetInstance(), settingsNative.Instance, out exception);
         #endif
         #if PLATFORM_AnyCPU
         else
         #endif
         #if PLATFORM_x86 || PLATFORM_AnyCPU
         NativeMethods.X86.MagickImageCollection_Quantize(image.GetInstance(), settingsNative.Instance, out exception);
         #endif
         CheckException(exception);
     }
 }
Ejemplo n.º 4
0
 public void Map(IMagickImage image, IQuantizeSettings settings, IMagickImage remapImage)
 {
     using (INativeInstance settingsNative = QuantizeSettings.CreateInstance(settings))
     {
         IntPtr exception = IntPtr.Zero;
         #if PLATFORM_AnyCPU
         if (NativeLibrary.Is64Bit)
         #endif
         #if PLATFORM_x64 || PLATFORM_AnyCPU
         NativeMethods.X64.MagickImageCollection_Map(image.GetInstance(), settingsNative.Instance, remapImage.GetInstance(), out exception);
         #endif
         #if PLATFORM_AnyCPU
         else
         #endif
         #if PLATFORM_x86 || PLATFORM_AnyCPU
         NativeMethods.X86.MagickImageCollection_Map(image.GetInstance(), settingsNative.Instance, remapImage.GetInstance(), out exception);
         #endif
         CheckException(exception);
     }
 }