com.golden.gamedev.engine
Interface BaseGraphics

All Known Implementing Classes:
AppletMode, FullScreenMode, HybridMode, WindowMode

public interface BaseGraphics

The BaseGraphics interface provide all needed abstraction for drawing unto screen.


Method Summary
 void cleanup()
          Releases all graphics resources and do finalization.
 boolean flip()
          Flips backbuffer to screen (primary surface).
 Graphics2D getBackBuffer()
          Returns backbuffer where the rendering perform.
 Component getComponent()
          Returns the component where the rendering perform.
 Dimension getSize()
          Returns the dimension of this graphics component.
 

Method Detail

getBackBuffer

public Graphics2D getBackBuffer()
Returns backbuffer where the rendering perform.

Returns:
backbuffer graphics.

flip

public boolean flip()
Flips backbuffer to screen (primary surface). Since the backbuffer is VolatileImage type, the flipping data could be lost and need to be restored. Therefore, if this method return false, backbuffer needs to be rerendered.

For Example:

    do {
        Graphics2D g = BaseGraphics.getBackBuffer();
        //.... do graphics operation
    } while (BaseGraphics.flip() == false);
 
See VolatileImage for detail information.

Returns:
true, if the flipping is successfully proceed
See Also:
getBackBuffer(), VolatileImage

cleanup

public void cleanup()
Releases all graphics resources and do finalization.


getSize

public Dimension getSize()
Returns the dimension of this graphics component.

Returns:
graphics dimension.

getComponent

public Component getComponent()
Returns the component where the rendering perform.

Returns:
graphics component.