question: private void composite ( ) { ArrayList < Sprite > newSlaves = new ArrayList < Sprite > ( slaves . size ( ) ) ; ImageSprite floor = null ; ListIterator < Sprite > iter = slaves . listIterator ( ) ; boolean copied = false ; while ( iter . hasNext ( ) ) { Sprite current = iter . next ( ) ; if ( current instanceof ImageSprite ) { if ( floor != null ) { if ( ! copied ) { floor = new ImageSprite ( floor ) ; copied = true ; } Graphics g = floor . getGraphics ( ) ; current . draw ( g , 0 , 0 ) ; g . dispose ( ) ; } else { floor = ( ImageSprite ) current ; if ( blend != null ) { floor = new ImageSprite ( floor ) ; copied = true ; } } } else { if ( floor != null ) { newSlaves . add ( floor ) ; floor = null ; } newSlaves . add ( current ) ; } } if ( floor != null ) { newSlaves . add ( floor ) ; } newSlaves . trimToSize ( ) ; slaves = newSlaves ; if ( blend != null ) { applyBlend ( newSlaves ) ; blend = null ; adjSprite = null ; } composited = true ; }
target:  Merge all ImageSprite layers.