}
if(transitionType == TYPE_FADE) {
motion = Motion.createSplineMotion(0, 256, speed);
motion.start();
Graphics g = buffer.getGraphics();
g.translate(-source.getAbsoluteX(), -source.getAbsoluteY());
if(getSource().getParent() != null){
getSource().getComponentForm().paintComponent(g);
}
//getSource().paintBackgrounds(g);
paint(g, getDestination(), 0, 0);
rgbBuffer = new RGBImage(buffer.getRGB(), buffer.getWidth(), buffer.getHeight());
paint(g, getSource(), 0, 0);
g.translate(source.getAbsoluteX(), source.getAbsoluteY());
} else {
if (transitionType == TYPE_SLIDE) {
int dest;
int startOffset = 0;
if (slideType == SLIDE_HORIZONTAL) {
dest = w;
if(destination instanceof Dialog) {
startOffset = w - ((Dialog)destination).getContentPane().getWidth();
if(forward) {
startOffset -= ((Dialog)destination).getContentPane().getStyle().getMargin(Component.LEFT);
} else {
startOffset -= ((Dialog)destination).getContentPane().getStyle().getMargin(Component.RIGHT);
}
} else {
if(source instanceof Dialog) {
dest = ((Dialog)source).getContentPane().getWidth();
if(forward) {
dest += ((Dialog)source).getContentPane().getStyle().getMargin(Component.LEFT);
} else {
dest += ((Dialog)source).getContentPane().getStyle().getMargin(Component.RIGHT);
}
}
}
} else {
dest = h;
if(destination instanceof Dialog) {
startOffset = h - ((Dialog)destination).getContentPane().getHeight() -
((Dialog)destination).getTitleComponent().getHeight();
if(forward) {
startOffset -= ((Dialog)destination).getContentPane().getStyle().getMargin(Component.BOTTOM);
} else {
startOffset -= ((Dialog)destination).getContentPane().getStyle().getMargin(Component.TOP);
startOffset -= ((Dialog)destination).getTitleStyle().getMargin(Component.TOP);
if(!drawDialogMenu && ((Dialog)destination).getCommandCount() > 0) {
startOffset -= ((Dialog)destination).getSoftButton(0).getParent().getHeight();
}
}
} else {
if(source instanceof Dialog) {
dest = ((Dialog)source).getContentPane().getHeight() +
((Dialog)source).getTitleComponent().getHeight();
if(forward) {
dest += ((Dialog)source).getContentPane().getStyle().getMargin(Component.BOTTOM);
} else {
dest += ((Dialog)source).getContentPane().getStyle().getMargin(Component.TOP);
dest += ((Dialog)source).getTitleStyle().getMargin(Component.TOP);
if(((Dialog)source).getCommandCount() > 0) {
dest += ((Dialog)source).getSoftButton(0).getParent().getHeight();
}
}
}
}
}
motion = Motion.createSplineMotion(startOffset, dest, speed);
// make sure the destination is painted fully at least once
// we must use a full buffer otherwise the clipping will take effect
Graphics g = buffer.getGraphics();
// If this is a dialog render the tinted frame once since
// tinting is expensive
if(getSource() instanceof Dialog) {
paint(g, getDestination(), 0, 0);