public IntPtr Merge(IMagickImage image, LayerMethod method)
            {
                IntPtr exception = IntPtr.Zero;
                IntPtr result;

                #if PLATFORM_AnyCPU
                if (OperatingSystem.Is64Bit)
                #endif
                #if PLATFORM_x64 || PLATFORM_AnyCPU
                result = NativeMethods.X64.MagickImageCollection_Merge(image.GetInstance(), (UIntPtr)method, out exception);
                #endif
                #if PLATFORM_AnyCPU
                else
                #endif
                #if PLATFORM_x86 || PLATFORM_AnyCPU
                result = NativeMethods.X86.MagickImageCollection_Merge(image.GetInstance(), (UIntPtr)method, out exception);
                #endif
                var magickException = MagickExceptionHelper.Create(exception);
                if (magickException == null)
                {
                    return(result);
                }
                if (magickException is MagickErrorException)
                {
                    if (result != IntPtr.Zero)
                    {
                        Dispose(result);
                    }
                    throw magickException;
                }
                RaiseWarning(magickException);
                return(result);
            }
Ejemplo n.º 2
0
            public IntPtr Merge(MagickImage image, LayerMethod method)
            {
                IntPtr exception = IntPtr.Zero;
                IntPtr result;

                if (NativeLibrary.Is64Bit)
                {
                    result = NativeMethods.X64.MagickImageCollection_Merge(MagickImage.GetInstance(image), (UIntPtr)method, out exception);
                }
                else
                {
                    result = NativeMethods.X86.MagickImageCollection_Merge(MagickImage.GetInstance(image), (UIntPtr)method, out exception);
                }
                MagickException magickException = MagickExceptionHelper.Create(exception);

                if (MagickExceptionHelper.IsError(magickException))
                {
                    if (result != IntPtr.Zero)
                    {
                        Dispose(result);
                    }
                    throw magickException;
                }
                RaiseWarning(magickException);
                return(result);
            }
Ejemplo n.º 3
0
        private static void Keyb(byte key, int x, int y)
        {
            //if (angle != 0) return;
            switch (key)
            {
                #region Cube Rotation
            case (byte)'v':
                rc.RotateCube(new CubeRotation(true, false, false, false));
                break;

            case (byte)'V':
                rc.RotateCube(new CubeRotation(true, false, false, true));
                break;

            case (byte)'b':
                rc.RotateCube(new CubeRotation(false, true, false, false));
                break;

            case (byte)'B':
                rc.RotateCube(new CubeRotation(false, true, false, true));
                break;

            case (byte)'n':
                rc.RotateCube(new CubeRotation(false, false, true, false));
                break;

            case (byte)'N':
                rc.RotateCube(new CubeRotation(false, false, true, true));
                break;
                #endregion

                #region Edge Clockwise Rotation
            case (byte)'w':
                rc.RotateEdge(new EdgeRotation(EdgeNum.U, false, false));
                break;

            case (byte)'a':
                rc.RotateEdge(new EdgeRotation(EdgeNum.F, false, false));
                break;

            case (byte)'s':
                rc.RotateEdge(new EdgeRotation(EdgeNum.R, false, false));
                break;

            case (byte)'d':
                rc.RotateEdge(new EdgeRotation(EdgeNum.B, false, false));
                break;

            case (byte)'f':
                rc.RotateEdge(new EdgeRotation(EdgeNum.L, false, false));
                break;

            case (byte)'x':
                rc.RotateEdge(new EdgeRotation(EdgeNum.D, false, false));
                break;
                #endregion

                #region Edge Anticlockwise Rotation
            case (byte)'W':
                rc.RotateEdge(new EdgeRotation(EdgeNum.U, false, true));
                break;

            case (byte)'A':
                rc.RotateEdge(new EdgeRotation(EdgeNum.F, false, true));
                break;

            case (byte)'S':
                rc.RotateEdge(new EdgeRotation(EdgeNum.R, false, true));
                break;

            case (byte)'D':
                rc.RotateEdge(new EdgeRotation(EdgeNum.B, false, true));
                break;

            case (byte)'F':
                rc.RotateEdge(new EdgeRotation(EdgeNum.L, false, true));
                break;

            case (byte)'X':
                rc.RotateEdge(new EdgeRotation(EdgeNum.D, false, true));
                break;
                #endregion

                #region Double Edge Rotation
            case (byte)'i':
                rc.RotateEdge(new EdgeRotation(EdgeNum.U, true, false));
                break;

            case (byte)'j':
                rc.RotateEdge(new EdgeRotation(EdgeNum.F, true, false));
                break;

            case (byte)'k':
                rc.RotateEdge(new EdgeRotation(EdgeNum.R, true, false));
                break;

            case (byte)'l':
                rc.RotateEdge(new EdgeRotation(EdgeNum.B, true, false));
                break;

            case (byte)';':
                rc.RotateEdge(new EdgeRotation(EdgeNum.L, true, false));
                break;

            case (byte)',':
                rc.RotateEdge(new EdgeRotation(EdgeNum.D, true, false));
                break;
                #endregion

            case (byte)'`':
                if (isAnimationEnabled)
                {
                    DisableAnimation();
                }
                else
                {
                    EnableAnimation();
                }
                break;

            case (byte)'=':
                rotationSpeed += RotationSpeedChenge;
                break;

            case (byte)'-':
                rotationSpeed = Math.Max(MinRotationSpeed, rotationSpeed - RotationSpeedChenge);
                break;

            case (byte)'1':
                LayerMethod.Solve(rc);
                break;
            }
            Glut.glutPostRedisplay();
        }
Ejemplo n.º 4
0
 public IntPtr Merge(MagickImage image, LayerMethod method)
 {
   IntPtr exception = IntPtr.Zero;
   IntPtr result;
   #if ANYCPU
   if (NativeLibrary.Is64Bit)
   #endif
   #if WIN64 || ANYCPU
   result = NativeMethods.X64.MagickImageCollection_Merge(MagickImage.GetInstance(image), (UIntPtr)method, out exception);
   #endif
   #if ANYCPU
   else
   #endif
   #if !WIN64 || ANYCPU
   result = NativeMethods.X86.MagickImageCollection_Merge(MagickImage.GetInstance(image), (UIntPtr)method, out exception);
   #endif
   MagickException magickException = MagickExceptionHelper.Create(exception);
   if (MagickExceptionHelper.IsError(magickException))
   {
     if (result != IntPtr.Zero)
       Dispose(result);
     throw magickException;
   }
   RaiseWarning(magickException);
   return result;
 }