Class CubicRotationTransition
- java.lang.Object
-
- org.eclipse.nebula.effects.stw.Transition
-
- org.eclipse.nebula.effects.stw.transitions.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.
-
-
Field Summary
Fields Modifier and Type Field Description private double
_a1
private double
_a2
private org.eclipse.swt.graphics.Image
_bgImage
private double
_destHeight
private double
_destHeight0
private double
_destHeightV0
private double
_destWidth
private double
_destWidth0
private double
_destWidthV0
private double
_dx1
private double
_dx2
private double
_dy1
private double
_dy2
private boolean
_flag1
private org.eclipse.swt.graphics.ImageData
_fromData
private int
_h
private int
_halfH
private long
_halfT
private int
_halfW
private org.eclipse.swt.graphics.ImageData
_imgDataBuffer
private org.eclipse.swt.graphics.ImageData
_imgDataToDraw
private double
_quality
private double
_ratio1
private double
_ratio2
private double
_remainedSize
private long
_t1
private org.eclipse.swt.graphics.ImageData
_toData
private long
_tSqrd
private double
_v0
private int
_w
private double
_x
private double
_x0
private double
_x1
private double
_x2
private double
_y
private double
_y0
private double
_y1
private double
_y2
-
Fields inherited from class org.eclipse.nebula.effects.stw.Transition
_fps, _T, _transitionManager, DEFAULT_FPS, DEFAULT_T, DIR_DOWN, DIR_LEFT, DIR_RIGHT, DIR_UP, IS_LINUX_OS, IS_MAC_OS
-
-
Constructor Summary
Constructors Constructor Description CubicRotationTransition(TransitionManager transitionManager)
This constructor creates a CubicRotationTransition with number of frames per second ofTransition.DEFAULT_FPS
and total transition time ofTransition.DEFAULT_T
milliseconds.CubicRotationTransition(TransitionManager transitionManager, long fps, long T)
This constructor creates a CubicRotationTransition with number of frames per second offps
and total transition time ofT
milliseconds.
-
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 slicingprivate 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 inclusiveprotected 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 org.eclipse.nebula.effects.stw.Transition
doEvents, getFPS, getTotalTransitionTime, setFPS, setTotalTransitionTime, start
-
-
-
-
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)
This constructor creates a CubicRotationTransition with number of frames per second ofTransition.DEFAULT_FPS
and total transition time ofTransition.DEFAULT_T
milliseconds. It is similar to new CubicRotationTransition(transitionManager,Transition.DEFAULT_FPS
,Transition.DEFAULT_T
)- Parameters:
transitionManager
- the transition manager to be used to manage transitions
-
CubicRotationTransition
public CubicRotationTransition(TransitionManager transitionManager, long fps, long T)
This constructor creates a CubicRotationTransition with number of frames per second offps
and total transition time ofT
milliseconds.- Parameters:
transitionManager
- the transition manager to be used to manage transitionsfps
- number of frames per secondT
- 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 classTransition
-
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 fromsrcY
- the y coordinate in the source image to copy fromsrcWidth
- the width in pixels to copy from the sourcesrcHeight
- the height in pixels to copy from the sourcedestX
- the x coordinate in the destination to copy todestY
- the y coordinate in the destination to copy todestWidth
- the width in pixels of the destination rectangledestHeight
- 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 fromsrcY
- the y coordinate in the source image to copy fromsrcWidth
- the width in pixels to copy from the sourcesrcHeight
- the height in pixels to copy from the sourcedestX
- the x coordinate in the destination to copy todestY
- the y coordinate in the destination to copy todestWidth
- the width in pixels of the destination rectangledestHeight
- 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 classTransition
-
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 classTransition
-
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
-
-