GF4J 0.9.4 Beta

gameframe.graphics
Interface DrawableBitmap


public interface DrawableBitmap

Defines an interface to a bitmap image that can blit (draw) or strecth (scale) itself in the graphics engine's backbuffer or into drawable bitmap, but also can be blitted into. The graphics engine in question is allways the graphics engine that loaded the bitmap. The bitmap in question must be a bitmap created by the same graphics engine as this drawable bitmap. If the bitmap was created by different graphics engine the results are unpredictable. Most of the methods offered in this interface are implemented to be as fast as possible. An exception is the method getSubBitmap() that tries to minimize the memory usage to the extent that is possible (maybe even using the same bitmap data as the original bitmap but with different clipping and blitting regions).

Since:
GameFrame for Java 0.9
Version:
GameFrame for Java 0.9.4
Author:
Pasi Keränen 16. May 1999

Method Summary
 void blitTo(DrawableBitmap bitmap, int x, int y)
          Draws the bitmap to the given drawable bitmap at the given location.
 void blitTo(int x, int y)
          Draws the bitmap to the graphics engine that loaded it at the given location.
 void finalize()
          Frees all the resources that are used by the bitmap implementation.
 int getHeight()
          Returns the height of the bitmap.
 int getWidth()
          Returns the width of the bitmap.
 void strecthTo(DrawableBitmap bitmap, int x, int y, int width, int height)
          Draws the bitmap to the given drawable bitmap at the given location at the given size.
 void strecthTo(int x, int y, int width, int height)
          Draws the bitmap to the graphics engine that loaded it at the given location and at the given size.
 

Method Detail

blitTo

public void blitTo(int x,
                   int y)
Draws the bitmap to the graphics engine that loaded it at the given location. The location can be outside of the visible screen area in which case the bitmap is clipped accordingly. This method is fast and is usable during the game execution.
Parameters:
x - The x-coordinate of the location where the image is drawn to.
y - The y-coordinate of the location where the image is drawn to.
Since:
GameFrame for Java 0.9

strecthTo

public void strecthTo(int x,
                      int y,
                      int width,
                      int height)
Draws the bitmap to the graphics engine that loaded it at the given location and at the given size. If this bitmap is larger or smaller than the destination size the bitmap will automatically be scaled. Note: This method is usually a bit slow, so it's use is not preferred during interactive periods in game execution.
Parameters:
x - The x-coordinate of the location where the image is drawn to.
y - The y-coordinate of the location where the image is drawn to.
width - The with that is used when drawing the image.
height - The height that is used when drawing the image.
Since:
GameFrame for Java 0.9

blitTo

public void blitTo(DrawableBitmap bitmap,
                   int x,
                   int y)
Draws the bitmap to the given drawable bitmap at the given location. The location can be outside of the visible screen area in which case the bitmap is clipped accordingly. This method is fast and is usable during the game execution.
Parameters:
bitmap - The bitmap that will be drawn to.
x - The x-coordinate of the location where the image is drawn to.
y - The y-coordinate of the location where the image is drawn to.
Since:
GameFrame for Java 0.9

strecthTo

public void strecthTo(DrawableBitmap bitmap,
                      int x,
                      int y,
                      int width,
                      int height)
Draws the bitmap to the given drawable bitmap at the given location at the given size. If this bitmap is larger or smaller than the destination size the bitmap will automatically be scaled. Note: This method is usually a bit slow, so it's use is not preferred during interactive periods in game execution.
Parameters:
bitmap - The bitmap that will be drawn to.
x - The x-coordinate of the location where the image is drawn to.
y - The y-coordinate of the location where the image is drawn to.
width - The with that is used when drawing the image.
height - The height that is used when drawing the image.
Since:
GameFrame for Java 0.9

getWidth

public int getWidth()
Returns the width of the bitmap. This method is fast and is usable during the game execution.
Returns:
Width of the bitmap if available.
Since:
GameFrame for Java 0.9

getHeight

public int getHeight()
Returns the height of the bitmap. This method is fast and is usable during the game execution.
Returns:
Height of the bitmap if available.
Since:
GameFrame for Java 0.9

finalize

public void finalize()
Frees all the resources that are used by the bitmap implementation. This method is quite slow to execute and should preferrably be called upon exiting the game or between level changes etc.
Since:
GameFrame for Java 0.9

GF4J 0.9.4 Beta