GF4J 0.9.4 Beta

gameframe.engines.jdk11x
Class CComponentGraphicsEngine.CDrawableBitmap

java.lang.Object
  |
  +--gameframe.engines.jdk11x.CComponentGraphicsEngine.CDrawableBitmap
All Implemented Interfaces:
DrawableBitmap, java.awt.image.ImageObserver
Enclosing class:
CComponentGraphicsEngine

class CComponentGraphicsEngine.CDrawableBitmap
extends java.lang.Object
implements DrawableBitmap, java.awt.image.ImageObserver

Implementation of the drawable bitmap image for plain Java 1.1 graphics engine.


Field Summary
private  int m_bitmapHeight
          Height of the bitmap.
private  int m_bitmapWidth
          Width of the bitmap.
private  java.awt.Rectangle m_clipper
          Clipping region used when drawing the bitmap.
 java.awt.Graphics m_graphics
          The graphics context of this image.
private  java.awt.Image m_image
          Reference to the AWT image that represents the bitmap in this graphics engine.
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
(package private) CComponentGraphicsEngine.CDrawableBitmap(java.awt.Image image, java.awt.Graphics graphics)
          Constructs an drawable bitmap from the given AWT image.
 
Method Summary
 void blitTo(DrawableBitmap bitmap, int x, int y)
          Draws the given bitmap to this 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.
 boolean imageUpdate(java.awt.Image img, int infoflags, int x, int y, int width, int height)
          The image observer method that gets updated when an image is loading.
 void strecthTo(DrawableBitmap bitmap, int x, int y, int width, int height)
          This method traps false usage where the user tries to blit a bitmap that was not loaded by this graphics engine to a bitmap that was created by this graphics engine.
 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.
 
Methods inherited from class java.lang.Object
, clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

m_image

private java.awt.Image m_image
Reference to the AWT image that represents the bitmap in this graphics engine.

m_graphics

public java.awt.Graphics m_graphics
The graphics context of this image.

m_bitmapWidth

private int m_bitmapWidth
Width of the bitmap.

m_bitmapHeight

private int m_bitmapHeight
Height of the bitmap.

m_clipper

private java.awt.Rectangle m_clipper
Clipping region used when drawing the bitmap.
Constructor Detail

CComponentGraphicsEngine.CDrawableBitmap

CComponentGraphicsEngine.CDrawableBitmap(java.awt.Image image,
                                         java.awt.Graphics graphics)
Constructs an drawable bitmap from the given AWT image. The image that is given as parameter must be an image whose graphics context can be gotten!
Parameters:
image - The image that this bitmap represents.
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.
Specified by:
blitTo in interface DrawableBitmap
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.

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 slow, so it's use is not preferred during actual game play.
Specified by:
strecthTo in interface DrawableBitmap
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 of the destination where the image is drawn to.
height - The height of the destination where the image is drawn to.

blitTo

public void blitTo(DrawableBitmap bitmap,
                   int x,
                   int y)
Draws the given bitmap to this drawable bitmap at the given location. The location can be outside of the visible screen area in which case the bitmap is clipped accordingly.
Specified by:
blitTo in interface DrawableBitmap
Parameters:
bitmap - The bitmap that will be drawn to this bitmap.
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.

strecthTo

public void strecthTo(DrawableBitmap bitmap,
                      int x,
                      int y,
                      int width,
                      int height)
This method traps false usage where the user tries to blit a bitmap that was not loaded by this graphics engine to a bitmap that was created by this graphics engine. This method does nothing.
Specified by:
strecthTo in interface DrawableBitmap
Parameters:
bitmap - The bitmap that will be drawn to this bitmap.
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 of the destination where the image is drawn to.
height - The height of the destination where the image is drawn to.

getWidth

public int getWidth()
Returns the width of the bitmap.
Specified by:
getWidth in interface DrawableBitmap
Returns:
Width of the bitmap if available.

getHeight

public int getHeight()
Returns the height of the bitmap.
Specified by:
getHeight in interface DrawableBitmap
Returns:
Height of the bitmap if available.

finalize

public void finalize()
Frees all the resources that are used by the bitmap implementation.
Specified by:
finalize in interface DrawableBitmap
Overrides:
finalize in class java.lang.Object

imageUpdate

public boolean imageUpdate(java.awt.Image img,
                           int infoflags,
                           int x,
                           int y,
                           int width,
                           int height)
The image observer method that gets updated when an image is loading.
Specified by:
imageUpdate in interface java.awt.image.ImageObserver

GF4J 0.9.4 Beta