Class CubicRotationTransition


  • public class CubicRotationTransition
    extends Transition
    A cubic rotation effect. Showing two sides of a cube, the cube rotates from one side to the other side.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void drawImage​(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Image src, org.eclipse.swt.graphics.ImageData srcData, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight)
      Draw an image to a graphics context object.
      private void drawImageData​(org.eclipse.swt.graphics.ImageData srcData, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight)
      Draw an image to the image data buffer object that contains all the image data to be drawn to the graphics context object.
      protected void endTransition​(org.eclipse.swt.graphics.Image from, org.eclipse.swt.graphics.Image to, org.eclipse.swt.graphics.GC gc, double direction)  
      double getQuality()
      Returns a percentage representing the quality of image slicing
      private void initImgDataBuffers​(org.eclipse.swt.graphics.GC gc, double direction)
      Initialize the image data buffers, used to draw the transition instead of drawing into the graphics context object directly.
      protected void initTransition​(org.eclipse.swt.graphics.Image from, org.eclipse.swt.graphics.Image to, org.eclipse.swt.graphics.GC gc, double direction)  
      void setQuality​(double quality)
      Sets the quality of image slicing as a percentage in the interval from 0 to 100 inclusive
      protected void stepTransition​(long t, org.eclipse.swt.graphics.Image from, org.eclipse.swt.graphics.Image to, org.eclipse.swt.graphics.GC gc, double direction)  
      private boolean useDataBuffersToDraw()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • _w

        private int _w
      • _halfW

        private int _halfW
      • _h

        private int _h
      • _halfH

        private int _halfH
      • _a1

        private double _a1
      • _a2

        private double _a2
      • _x

        private double _x
      • _y

        private double _y
      • _x0

        private double _x0
      • _y0

        private double _y0
      • _v0

        private double _v0
      • _flag1

        private boolean _flag1
      • _fromData

        private org.eclipse.swt.graphics.ImageData _fromData
      • _toData

        private org.eclipse.swt.graphics.ImageData _toData
      • _imgDataBuffer

        private org.eclipse.swt.graphics.ImageData _imgDataBuffer
      • _imgDataToDraw

        private org.eclipse.swt.graphics.ImageData _imgDataToDraw
      • _bgImage

        private org.eclipse.swt.graphics.Image _bgImage
      • _halfT

        private long _halfT
      • _t1

        private long _t1
      • _tSqrd

        private long _tSqrd
      • _dy1

        private double _dy1
      • _dx1

        private double _dx1
      • _dx2

        private double _dx2
      • _dy2

        private double _dy2
      • _x1

        private double _x1
      • _y1

        private double _y1
      • _x2

        private double _x2
      • _y2

        private double _y2
      • _destHeight

        private double _destHeight
      • _destWidth

        private double _destWidth
      • _destHeight0

        private double _destHeight0
      • _destWidth0

        private double _destWidth0
      • _destHeightV0

        private double _destHeightV0
      • _destWidthV0

        private double _destWidthV0
      • _ratio1

        private double _ratio1
      • _ratio2

        private double _ratio2
      • _remainedSize

        private double _remainedSize
      • _quality

        private double _quality
    • Constructor Detail

      • CubicRotationTransition

        public CubicRotationTransition​(TransitionManager transitionManager,
                                       long fps,
                                       long T)
        This constructor creates a CubicRotationTransition with number of frames per second of fps and total transition time of T milliseconds.
        Parameters:
        transitionManager - the transition manager to be used to manage transitions
        fps - number of frames per second
        T - the total time the transition effect will take in milliseconds
    • Method Detail

      • initTransition

        protected void initTransition​(org.eclipse.swt.graphics.Image from,
                                      org.eclipse.swt.graphics.Image to,
                                      org.eclipse.swt.graphics.GC gc,
                                      double direction)
        Specified by:
        initTransition in class Transition
      • initImgDataBuffers

        private void initImgDataBuffers​(org.eclipse.swt.graphics.GC gc,
                                        double direction)
        Initialize the image data buffers, used to draw the transition instead of drawing into the graphics context object directly.
        Parameters:
        gc - Graphics context where to initialize the background image object.
        direction - Direction to be used as a reference to initialize the image data buffers.
      • useDataBuffersToDraw

        private boolean useDataBuffersToDraw()
        Returns:
        true if the application will use the data buffers to draw the image, false if the buffers won't be used and the image will be drawn directly to the graphics context object instead.
      • drawImage

        private void drawImage​(org.eclipse.swt.graphics.GC gc,
                               org.eclipse.swt.graphics.Image src,
                               org.eclipse.swt.graphics.ImageData srcData,
                               int srcX,
                               int srcY,
                               int srcWidth,
                               int srcHeight,
                               int destX,
                               int destY,
                               int destWidth,
                               int destHeight)
        Draw an image to a graphics context object. The image can be drawn using image data buffers before drawing to the graphics context object, or drawn directly to the graphics context object.
        Parameters:
        gc - Graphics context object to draw the image to.
        src - the source image.
        srcData - image data of the source image.
        srcX - the x coordinate in the source image to copy from
        srcY - the y coordinate in the source image to copy from
        srcWidth - the width in pixels to copy from the source
        srcHeight - the height in pixels to copy from the source
        destX - the x coordinate in the destination to copy to
        destY - the y coordinate in the destination to copy to
        destWidth - the width in pixels of the destination rectangle
        destHeight - the height in pixels of the destination rectangle
      • drawImageData

        private void drawImageData​(org.eclipse.swt.graphics.ImageData srcData,
                                   int srcX,
                                   int srcY,
                                   int srcWidth,
                                   int srcHeight,
                                   int destX,
                                   int destY,
                                   int destWidth,
                                   int destHeight)
        Draw an image to the image data buffer object that contains all the image data to be drawn to the graphics context object.
        Parameters:
        srcData - image data of the source image.
        srcX - the x coordinate in the source image to copy from
        srcY - the y coordinate in the source image to copy from
        srcWidth - the width in pixels to copy from the source
        srcHeight - the height in pixels to copy from the source
        destX - the x coordinate in the destination to copy to
        destY - the y coordinate in the destination to copy to
        destWidth - the width in pixels of the destination rectangle
        destHeight - the height in pixels of the destination rectangle
      • stepTransition

        protected void stepTransition​(long t,
                                      org.eclipse.swt.graphics.Image from,
                                      org.eclipse.swt.graphics.Image to,
                                      org.eclipse.swt.graphics.GC gc,
                                      double direction)
        Specified by:
        stepTransition in class Transition
      • endTransition

        protected void endTransition​(org.eclipse.swt.graphics.Image from,
                                     org.eclipse.swt.graphics.Image to,
                                     org.eclipse.swt.graphics.GC gc,
                                     double direction)
        Specified by:
        endTransition in class Transition
      • setQuality

        public void setQuality​(double quality)
        Sets the quality of image slicing as a percentage in the interval from 0 to 100 inclusive
        Parameters:
        quality - is a percentage from 0 to 100 inclusive
      • getQuality

        public double getQuality()
        Returns a percentage representing the quality of image slicing
        Returns:
        a percentage representing the quality of image slicing