Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.newdawn.slick
Class Graphics

    java.lang.Object
      org.newdawn.slick.Graphics

Direct Known Subclasses:
  FBOGraphics, PBufferGraphics, PBufferUniqueGraphics

    public class Graphics

extends java.lang.Object

A graphics context that can be used to render primatives to the accelerated canvas provided by LWJGL.

Author:
  kevin

Field Summary
`protected static Graphics` | `currentGraphics` The last graphics context in use
`protected static Font` | `DEFAULT_FONT` The default font to use
`protected static SGL` | `GL` The renderer to use for all GL operations
`static int` | `MODE_ADD` Draw adding the existing colour to the new colour
`static int` | `MODE_ALPHA_BLEND` Draw using the alpha blending
`static int` | `MODE_ALPHA_MAP` Draw to the alpha map
`static int` | `MODE_COLOR_MULTIPLY` Draw multiplying the source and destination colours
`static int` | `MODE_NORMAL` The normal drawing mode
`static int` | `MODE_SCREEN` Draw blending the new image into the old one by a factor of it's colour
`protected int` | `screenHeight` The height of the screen
`protected int` | `screenWidth` The width of the screen

Constructor Summary
`Graphics()` Default constructor for sub-classes
`Graphics(int width, int height)` Create a new graphics context.

Method Summary
`void` | `clear()` Clear the graphics context
`void` | `clearAlphaMap()` Clear the state of the alpha map across the entire screen.
`void` | `clearClip()` Clear the clipping being applied.
`void` | `clearWorldClip()` Clear world clipping setup.
`void` | `copyArea(Image target, int x, int y)` Copy an area of the rendered screen into an image.
`void` | `destroy()` Dispose this graphics context, this will release any underlying resourses.
`protected void` | `disable()` Disable rendering to this graphics context
`void` | `draw(Shape shape)` Draw the outline of the given shape.
`void` | `draw(Shape shape, ShapeFill fill)` Draw the outline of the given shape.
`void` | `drawAnimation(Animation anim, float x, float y)` Draw an animation to this graphics context
`void` | `drawAnimation(Animation anim, float x, float y, Color col)` Draw an animation to this graphics context
`void` | `drawArc(float x1, float y1, float width, float height, float start, float end)` Draw an oval to the canvas
`void` | `drawArc(float x1, float y1, float width, float height, int segments, float start, float end)` Draw an oval to the canvas
`void` | `drawGradientLine(float x1, float y1, Color Color1, float x2, float y2, Color Color2)` Draw a line with a gradient between the two points.
`void` | `drawGradientLine(float x1, float y1, float red1, float green1, float blue1, float alpha1, float x2, float y2, float red2, float green2, float blue2, float alpha2)` Draw a line with a gradient between the two points.
`void` | `drawImage(Image image, float x, float y)` Draw an image to the screen
`void` | `drawImage(Image image, float x, float y, Color col)` Draw an image to the screen
`void` | `drawImage(Image image, float x, float y, float srcx, float srcy, float srcx2, float srcy2)` Draw a section of an image at a particular location and scale on the screen
`void` | `drawImage(Image image, float x, float y, float srcx, float srcy, float srcx2, float srcy2, Color col)` Draw a section of an image at a particular location and scale on the screen
`void` | `drawImage(Image image, float x, float y, float x2, float y2, float srcx, float srcy, float srcx2, float srcy2)` Draw a section of an image at a particular location and scale on the screen
`void` | `drawImage(Image image, float x, float y, float x2, float y2, float srcx, float srcy, float srcx2, float srcy2, Color col)` Draw a section of an image at a particular location and scale on the screen
`void` | `drawLine(float x1, float y1, float x2, float y2)` Draw a line on the canvas in the current colour
`void` | `drawOval(float x1, float y1, float width, float height)` Draw an oval to the canvas
`void` | `drawOval(float x1, float y1, float width, float height, int segments)` Draw an oval to the canvas
`void` | `drawRect(float x1, float y1, float width, float height)` Draw a rectangle to the canvas in the current colour
`void` | `drawRoundRect(float x, float y, float width, float height, int cornerRadius)` Draw a rounded rectangle
`void` | `drawRoundRect(float x, float y, float width, float height, int cornerRadius, int segs)` Draw a rounded rectangle
`void` | `drawString(java.lang.String str, float x, float y)` Draw a string to the screen using the current font
`protected void` | `enable()` Enable rendering to this graphics context
`void` | `fill(Shape shape)` Draw the the given shape filled in.
`void` | `fill(Shape shape, ShapeFill fill)` Draw the the given shape filled in.
`void` | `fillArc(float x1, float y1, float width, float height, float start, float end)` Fill an arc to the canvas (a wedge)
`void` | `fillArc(float x1, float y1, float width, float height, int segments, float start, float end)` Fill an arc to the canvas (a wedge)
`void` | `fillOval(float x1, float y1, float width, float height)` Fill an oval to the canvas
`void` | `fillOval(float x1, float y1, float width, float height, int segments)` Fill an oval to the canvas
`void` | `fillRect(float x1, float y1, float width, float height)` Fill a rectangle on the canvas in the current color
`void` | `fillRect(float x, float y, float width, float height, Image pattern, float offX, float offY)` Tile a rectangle with a pattern specifing the offset from the top corner that one tile should match
`void` | `fillRoundRect(float x, float y, float width, float height, int cornerRadius)` Fill a rounded rectangle
`void` | `fillRoundRect(float x, float y, float width, float height, int cornerRadius, int segs)` Fill a rounded rectangle
`void` | `flush()` Flush this graphics context to the underlying rendering context
`void` | `getArea(int x, int y, int width, int height, java.nio.ByteBuffer target)` Get an ara of pixels as RGBA values into a buffer
`Color` | `getBackground()` Get the current graphics context background color
`Rectangle` | `getClip()` Return the currently applied clipping rectangle
`Color` | `getColor()` Get the color in use by this graphics context
`Font` | `getFont()` Get the current font
`float` | `getLineWidth()` Get the width of lines being drawn in this context
`Color` | `getPixel(int x, int y)` Get the colour of a single pixel in this graphics context
`Rectangle` | `getWorldClip()` Get the last set world clip or null of the world clip isn't set
`boolean` | `isAntiAlias()` True if antialiasing has been turned on for this graphics context
`void` | `popTransform()` Pop a previously pushed transform from the stack to the current.
`void` | `pushTransform()` Push the current state of the transform from this graphics contexts onto the underlying graphics stack's transform stack.
`void` | `resetFont()` Reset to using the default font for this context
`void` | `resetLineWidth()` Reset the line width in use to the default for this graphics context
`void` | `resetTransform()` Reset the transformation on this graphics context
`void` | `rotate(float rx, float ry, float ang)` Apply a rotation to everything draw on the graphics context
`void` | `scale(float sx, float sy)` Apply a scaling factor to everything drawn on the graphics context
`void` | `setAntiAlias(boolean anti)` Indicate if we should antialias as we draw primitives
`void` | `setBackground(Color color)` Set the background colour of the graphics context.
`void` | `setClip(int x, int y, int width, int height)` Set the clipping to apply to the drawing.
`void` | `setClip(Rectangle rect)` Set the clipping to apply to the drawing.
`void` | `setColor(Color color)` Set the color to use when rendering to this context
`static void` | `setCurrent(Graphics current)` Set the current graphics context in use
`void` | `setDrawMode(int mode)` Set the drawing mode to use.
`void` | `setFont(Font font)` Set the font to be used when rendering text
`void` | `setLineWidth(float width)` Set the with of the line to be used when drawing line based primitives
`void` | `setWorldClip(float x, float y, float width, float height)` Set clipping that controls which areas of the world will be drawn to.
`void` | `setWorldClip(Rectangle clip)` Set the world clip to be applied
`void` | `texture(Shape shape, Image image)` Draw the the given shape filled in with a texture
`void` | `texture(Shape shape, Image image, boolean fit)` Draw the the given shape filled in with a texture
`void` | `texture(Shape shape, Image image, float scaleX, float scaleY)` Draw the the given shape filled in with a texture
`void` | `texture(Shape shape, Image image, float scaleX, float scaleY, boolean fit)` Draw the the given shape filled in with a texture
`void` | `texture(Shape shape, Image image, float scaleX, float scaleY, ShapeFill fill)` Draw the the given shape filled in with a texture
`void` | `texture(Shape shape, Image image, ShapeFill fill)` Draw the the given shape filled in with a texture
`void` | `translate(float x, float y)` Apply a translation to everything drawn to the context

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### GL

    protected static SGL GL

  The renderer to use for all GL operations

### MODE_NORMAL

    public static int MODE_NORMAL

  The normal drawing mode

### MODE_ALPHA_MAP

    public static int MODE_ALPHA_MAP

  Draw to the alpha map

### MODE_ALPHA_BLEND

    public static int MODE_ALPHA_BLEND

  Draw using the alpha blending

### MODE_COLOR_MULTIPLY

    public static int MODE_COLOR_MULTIPLY

  Draw multiplying the source and destination colours

### MODE_ADD

    public static int MODE_ADD

  Draw adding the existing colour to the new colour

### MODE_SCREEN

    public static int MODE_SCREEN

  Draw blending the new image into the old one by a factor of it's colour

### currentGraphics

    protected static Graphics currentGraphics

  The last graphics context in use

### DEFAULT_FONT

    protected static Font DEFAULT_FONT

  The default font to use

### screenWidth

    protected int screenWidth

  The width of the screen

### screenHeight

    protected int screenHeight

  The height of the screen

Constructor Detail

### Graphics

    public Graphics()

  Default constructor for sub-classes

### Graphics

    public Graphics(int width,
                    int height)

  Create a new graphics context. Only the container should be doing this really

  Parameters:
    `width` - The width of the screen for this context
    `height` - The height of the screen for this context

Method Detail

### setCurrent

    public static void setCurrent(Graphics current)

  Set the current graphics context in use

  Parameters:
    `current` - The graphics context that should be considered current

### setDrawMode

    public void setDrawMode(int mode)

  Set the drawing mode to use. This mode defines how pixels are drawn to the graphics context. It can be used to draw into the alpha map. The mode supplied should be one of `MODE_NORMAL` or `MODE_ALPHA_MAP` or `MODE_ALPHA_BLEND`

  Parameters:
    `mode` - The mode to apply.

### clearAlphaMap

    public void clearAlphaMap()

  Clear the state of the alpha map across the entire screen. This sets alpha to 0 everywhere, meaning in `MODE_ALPHA_BLEND` nothing will be drawn.

### enable

    protected void enable()

  Enable rendering to this graphics context

### flush

    public void flush()

  Flush this graphics context to the underlying rendering context

### disable

    protected void disable()

  Disable rendering to this graphics context

### getFont

    public Font getFont()

  Get the current font

  Returns:
    The current font

### setBackground

    public void setBackground(Color color)

  Set the background colour of the graphics context. This colour is used when clearing the context. Note that calling this method alone does not cause the context to be cleared.

  Parameters:
    `color` - The background color of the graphics context

### getBackground

    public Color getBackground()

  Get the current graphics context background color

  Returns:
    The background color of this graphics context

### clear

    public void clear()

  Clear the graphics context

### resetTransform

    public void resetTransform()

  Reset the transformation on this graphics context

### scale

    public void scale(float sx,
                      float sy)

  Apply a scaling factor to everything drawn on the graphics context

  Parameters:
    `sx` - The scaling factor to apply to the x axis
    `sy` - The scaling factor to apply to the y axis

### rotate

    public void rotate(float rx,
                       float ry,
                       float ang)

  Apply a rotation to everything draw on the graphics context

  Parameters:
    `rx` - The x coordinate of the center of rotation
    `ry` - The y coordinate of the center of rotation
    `ang` - The angle (in degrees) to rotate by

### translate

    public void translate(float x,
                          float y)

  Apply a translation to everything drawn to the context

  Parameters:
    `x` - The amount to translate on the x-axis
    `y` - The amount of translate on the y-axis

### setFont

    public void setFont(Font font)

  Set the font to be used when rendering text

  Parameters:
    `font` - The font to be used when rendering text

### resetFont

    public void resetFont()

  Reset to using the default font for this context

### setColor

    public void setColor(Color color)

  Set the color to use when rendering to this context

  Parameters:
    `color` - The color to use when rendering to this context

### getColor

    public Color getColor()

  Get the color in use by this graphics context

  Returns:
    The color in use by this graphics context

### drawLine

    public void drawLine(float x1,
                         float y1,
                         float x2,
                         float y2)

  Draw a line on the canvas in the current colour

  Parameters:
    `x1` - The x coordinate of the start point
    `y1` - The y coordinate of the start point
    `x2` - The x coordinate of the end point
    `y2` - The y coordinate of the end point

### draw

    public void draw(Shape shape,
                     ShapeFill fill)

  Draw the outline of the given shape.

  Parameters:
    `shape` - The shape to draw.
    `fill` - The fill type to apply

### fill

    public void fill(Shape shape,
                     ShapeFill fill)

  Draw the the given shape filled in.

  Parameters:
    `shape` - The shape to fill.
    `fill` - The fill type to apply

### draw

    public void draw(Shape shape)

  Draw the outline of the given shape.

  Parameters:
    `shape` - The shape to draw.

### fill

    public void fill(Shape shape)

  Draw the the given shape filled in.

  Parameters:
    `shape` - The shape to fill.

### texture

    public void texture(Shape shape,
                        Image image)

  Draw the the given shape filled in with a texture

  Parameters:
    `shape` - The shape to texture.
    `image` - The image to tile across the shape

### texture

    public void texture(Shape shape,
                        Image image,
                        ShapeFill fill)

  Draw the the given shape filled in with a texture

  Parameters:
    `shape` - The shape to texture.
    `image` - The image to tile across the shape
    `fill` - The shape fill to apply

### texture

    public void texture(Shape shape,
                        Image image,
                        boolean fit)

  Draw the the given shape filled in with a texture

  Parameters:
    `shape` - The shape to texture.
    `image` - The image to tile across the shape
    `fit` - True if we want to fit the image on to the shape

### texture

    public void texture(Shape shape,
                        Image image,
                        float scaleX,
                        float scaleY)

  Draw the the given shape filled in with a texture

  Parameters:
    `shape` - The shape to texture.
    `image` - The image to tile across the shape
    `scaleX` - The scale to apply on the x axis for texturing
    `scaleY` - The scale to apply on the y axis for texturing

### texture

    public void texture(Shape shape,
                        Image image,
                        float scaleX,
                        float scaleY,
                        boolean fit)

  Draw the the given shape filled in with a texture

  Parameters:
    `shape` - The shape to texture.
    `image` - The image to tile across the shape
    `scaleX` - The scale to apply on the x axis for texturing
    `scaleY` - The scale to apply on the y axis for texturing
    `fit` - True if we want to fit the image on to the shape

### texture

    public void texture(Shape shape,
                        Image image,
                        float scaleX,
                        float scaleY,
                        ShapeFill fill)

  Draw the the given shape filled in with a texture

  Parameters:
    `shape` - The shape to texture.
    `image` - The image to tile across the shape
    `scaleX` - The scale to apply on the x axis for texturing
    `scaleY` - The scale to apply on the y axis for texturing
    `fill` - The shape fill to apply

### drawRect

    public void drawRect(float x1,
                         float y1,
                         float width,
                         float height)

  Draw a rectangle to the canvas in the current colour

  Parameters:
    `x1` - The x coordinate of the top left corner
    `y1` - The y coordinate of the top left corner
    `width` - The width of the rectangle to draw
    `height` - The height of the rectangle to draw

### clearClip

    public void clearClip()

  Clear the clipping being applied. This will allow graphics to be drawn anywhere on the screen

### setWorldClip

    public void setWorldClip(float x,
                             float y,
                             float width,
                             float height)

  Set clipping that controls which areas of the world will be drawn to. Note that world clip is different from standard screen clip in that it's defined in the space of the current world coordinate - i.e. it's affected by translate, rotate, scale etc.

  Parameters:
    `x` - The x coordinate of the top left corner of the allowed area
    `y` - The y coordinate of the top left corner of the allowed area
    `width` - The width of the allowed area
    `height` - The height of the allowed area

### clearWorldClip

    public void clearWorldClip()

  Clear world clipping setup. This does not effect screen clipping

### setWorldClip

    public void setWorldClip(Rectangle clip)

  Set the world clip to be applied

  Parameters:
    `clip` - The area still visible
  See Also:
    `setWorldClip(float, float, float, float)`

### getWorldClip

    public Rectangle getWorldClip()

  Get the last set world clip or null of the world clip isn't set

  Returns:
    The last set world clip rectangle

### setClip

    public void setClip(int x,
                        int y,
                        int width,
                        int height)

  Set the clipping to apply to the drawing. Note that this clipping takes no note of the transforms that have been applied to the context and is always in absolute screen space coordinates.

  Parameters:
    `x` - The x coordinate of the top left corner of the allowed area
    `y` - The y coordinate of the top left corner of the allowed area
    `width` - The width of the allowed area
    `height` - The height of the allowed area

### setClip

    public void setClip(Rectangle rect)

  Set the clipping to apply to the drawing. Note that this clipping takes no note of the transforms that have been applied to the context and is always in absolute screen space coordinates.

  Parameters:
    `rect` - The rectangle describing the clipped area in screen coordinates

### getClip

    public Rectangle getClip()

  Return the currently applied clipping rectangle

  Returns:
    The current applied clipping rectangle or null if no clipping is applied

### fillRect

    public void fillRect(float x,
                         float y,
                         float width,
                         float height,
                         Image pattern,
                         float offX,
                         float offY)

  Tile a rectangle with a pattern specifing the offset from the top corner that one tile should match

  Parameters:
    `x` - The x coordinate of the rectangle
    `y` - The y coordinate of the rectangle
    `width` - The width of the rectangle
    `height` - The height of the rectangle
    `pattern` - The image to tile across the rectangle
    `offX` - The offset on the x axis from the top left corner
    `offY` - The offset on the y axis from the top left corner

### fillRect

    public void fillRect(float x1,
                         float y1,
                         float width,
                         float height)

  Fill a rectangle on the canvas in the current color

  Parameters:
    `x1` - The x coordinate of the top left corner
    `y1` - The y coordinate of the top left corner
    `width` - The width of the rectangle to fill
    `height` - The height of the rectangle to fill

### drawOval

    public void drawOval(float x1,
                         float y1,
                         float width,
                         float height)

  Draw an oval to the canvas

  Parameters:
    `x1` - The x coordinate of the top left corner of a box containing the oval
    `y1` - The y coordinate of the top left corner of a box containing the oval
    `width` - The width of the oval
    `height` - The height of the oval

### drawOval

    public void drawOval(float x1,
                         float y1,
                         float width,
                         float height,
                         int segments)

  Draw an oval to the canvas

  Parameters:
    `x1` - The x coordinate of the top left corner of a box containing the oval
    `y1` - The y coordinate of the top left corner of a box containing the oval
    `width` - The width of the oval
    `height` - The height of the oval
    `segments` - The number of line segments to use when drawing the oval

### drawArc

    public void drawArc(float x1,
                        float y1,
                        float width,
                        float height,
                        float start,
                        float end)

  Draw an oval to the canvas

  Parameters:
    `x1` - The x coordinate of the top left corner of a box containing the arc
    `y1` - The y coordinate of the top left corner of a box containing the arc
    `width` - The width of the arc
    `height` - The height of the arc
    `start` - The angle the arc starts at
    `end` - The angle the arc ends at

### drawArc

    public void drawArc(float x1,
                        float y1,
                        float width,
                        float height,
                        int segments,
                        float start,
                        float end)

  Draw an oval to the canvas

  Parameters:
    `x1` - The x coordinate of the top left corner of a box containing the arc
    `y1` - The y coordinate of the top left corner of a box containing the arc
    `width` - The width of the arc
    `height` - The height of the arc
    `segments` - The number of line segments to use when drawing the arc
    `start` - The angle the arc starts at
    `end` - The angle the arc ends at

### fillOval

    public void fillOval(float x1,
                         float y1,
                         float width,
                         float height)

  Fill an oval to the canvas

  Parameters:
    `x1` - The x coordinate of the top left corner of a box containing the oval
    `y1` - The y coordinate of the top left corner of a box containing the oval
    `width` - The width of the oval
    `height` - The height of the oval

### fillOval

    public void fillOval(float x1,
                         float y1,
                         float width,
                         float height,
                         int segments)

  Fill an oval to the canvas

  Parameters:
    `x1` - The x coordinate of the top left corner of a box containing the oval
    `y1` - The y coordinate of the top left corner of a box containing the oval
    `width` - The width of the oval
    `height` - The height of the oval
    `segments` - The number of line segments to use when filling the oval

### fillArc

    public void fillArc(float x1,
                        float y1,
                        float width,
                        float height,
                        float start,
                        float end)

  Fill an arc to the canvas (a wedge)

  Parameters:
    `x1` - The x coordinate of the top left corner of a box containing the arc
    `y1` - The y coordinate of the top left corner of a box containing the arc
    `width` - The width of the arc
    `height` - The height of the arc
    `start` - The angle the arc starts at
    `end` - The angle the arc ends at

### fillArc

    public void fillArc(float x1,
                        float y1,
                        float width,
                        float height,
                        int segments,
                        float start,
                        float end)

  Fill an arc to the canvas (a wedge)

  Parameters:
    `x1` - The x coordinate of the top left corner of a box containing the arc
    `y1` - The y coordinate of the top left corner of a box containing the arc
    `width` - The width of the arc
    `height` - The height of the arc
    `segments` - The number of line segments to use when filling the arc
    `start` - The angle the arc starts at
    `end` - The angle the arc ends at

### drawRoundRect

    public void drawRoundRect(float x,
                              float y,
                              float width,
                              float height,
                              int cornerRadius)

  Draw a rounded rectangle

  Parameters:
    `x` - The x coordinate of the top left corner of the rectangle
    `y` - The y coordinate of the top left corner of the rectangle
    `width` - The width of the rectangle
    `height` - The height of the rectangle
    `cornerRadius` - The radius of the rounded edges on the corners

### drawRoundRect

    public void drawRoundRect(float x,
                              float y,
                              float width,
                              float height,
                              int cornerRadius,
                              int segs)

  Draw a rounded rectangle

  Parameters:
    `x` - The x coordinate of the top left corner of the rectangle
    `y` - The y coordinate of the top left corner of the rectangle
    `width` - The width of the rectangle
    `height` - The height of the rectangle
    `cornerRadius` - The radius of the rounded edges on the corners
    `segs` - The number of segments to make the corners out of

### fillRoundRect

    public void fillRoundRect(float x,
                              float y,
                              float width,
                              float height,
                              int cornerRadius)

  Fill a rounded rectangle

  Parameters:
    `x` - The x coordinate of the top left corner of the rectangle
    `y` - The y coordinate of the top left corner of the rectangle
    `width` - The width of the rectangle
    `height` - The height of the rectangle
    `cornerRadius` - The radius of the rounded edges on the corners

### fillRoundRect

    public void fillRoundRect(float x,
                              float y,
                              float width,
                              float height,
                              int cornerRadius,
                              int segs)

  Fill a rounded rectangle

  Parameters:
    `x` - The x coordinate of the top left corner of the rectangle
    `y` - The y coordinate of the top left corner of the rectangle
    `width` - The width of the rectangle
    `height` - The height of the rectangle
    `cornerRadius` - The radius of the rounded edges on the corners
    `segs` - The number of segments to make the corners out of

### setLineWidth

    public void setLineWidth(float width)

  Set the with of the line to be used when drawing line based primitives

  Parameters:
    `width` - The width of the line to be used when drawing line based primitives

### getLineWidth

    public float getLineWidth()

  Get the width of lines being drawn in this context

  Returns:
    The width of lines being draw in this context

### resetLineWidth

    public void resetLineWidth()

  Reset the line width in use to the default for this graphics context

### setAntiAlias

    public void setAntiAlias(boolean anti)

  Indicate if we should antialias as we draw primitives

  Parameters:
    `anti` - True if we should antialias

### isAntiAlias

    public boolean isAntiAlias()

  True if antialiasing has been turned on for this graphics context

  Returns:
    True if antialiasing has been turned on for this graphics context

### drawString

    public void drawString(java.lang.String str,
                           float x,
                           float y)

  Draw a string to the screen using the current font

  Parameters:
    `str` - The string to draw
    `x` - The x coordinate to draw the string at
    `y` - The y coordinate to draw the string at

### drawImage

    public void drawImage(Image image,
                          float x,
                          float y,
                          Color col)

  Draw an image to the screen

  Parameters:
    `image` - The image to draw to the screen
    `x` - The x location at which to draw the image
    `y` - The y location at which to draw the image
    `col` - The color to apply to the image as a filter

### drawAnimation

    public void drawAnimation(Animation anim,
                              float x,
                              float y)

  Draw an animation to this graphics context

  Parameters:
    `anim` - The animation to be drawn
    `x` - The x position to draw the animation at
    `y` - The y position to draw the animation at

### drawAnimation

    public void drawAnimation(Animation anim,
                              float x,
                              float y,
                              Color col)

  Draw an animation to this graphics context

  Parameters:
    `anim` - The animation to be drawn
    `x` - The x position to draw the animation at
    `y` - The y position to draw the animation at
    `col` - The color to apply to the animation as a filter

### drawImage

    public void drawImage(Image image,
                          float x,
                          float y)

  Draw an image to the screen

  Parameters:
    `image` - The image to draw to the screen
    `x` - The x location at which to draw the image
    `y` - The y location at which to draw the image

### drawImage

    public void drawImage(Image image,
                          float x,
                          float y,
                          float x2,
                          float y2,
                          float srcx,
                          float srcy,
                          float srcx2,
                          float srcy2)

  Draw a section of an image at a particular location and scale on the screen

  Parameters:
    `image` - The image to draw a section of
    `x` - The x position to draw the image
    `y` - The y position to draw the image
    `x2` - The x position of the bottom right corner of the drawn image
    `y2` - The y position of the bottom right corner of the drawn image
    `srcx` - The x position of the rectangle to draw from this image (i.e. relative to the image)
    `srcy` - The y position of the rectangle to draw from this image (i.e. relative to the image)
    `srcx2` - The x position of the bottom right cornder of rectangle to draw from this image (i.e. relative to the image)
    `srcy2` - The t position of the bottom right cornder of rectangle to draw from this image (i.e. relative to the image)

### drawImage

    public void drawImage(Image image,
                          float x,
                          float y,
                          float srcx,
                          float srcy,
                          float srcx2,
                          float srcy2)

  Draw a section of an image at a particular location and scale on the screen

  Parameters:
    `image` - The image to draw a section of
    `x` - The x position to draw the image
    `y` - The y position to draw the image
    `srcx` - The x position of the rectangle to draw from this image (i.e. relative to the image)
    `srcy` - The y position of the rectangle to draw from this image (i.e. relative to the image)
    `srcx2` - The x position of the bottom right cornder of rectangle to draw from this image (i.e. relative to the image)
    `srcy2` - The t position of the bottom right cornder of rectangle to draw from this image (i.e. relative to the image)

### copyArea

    public void copyArea(Image target,
                         int x,
                         int y)

  Copy an area of the rendered screen into an image. The width and height of the area are assumed to match that of the image

  Parameters:
    `target` - The target image
    `x` - The x position to copy from
    `y` - The y position to copy from

### getPixel

    public Color getPixel(int x,
                          int y)

  Get the colour of a single pixel in this graphics context

  Parameters:
    `x` - The x coordinate of the pixel to read
    `y` - The y coordinate of the pixel to read
  Returns:
    The colour of the pixel at the specified location

### getArea

    public void getArea(int x,
                        int y,
                        int width,
                        int height,
                        java.nio.ByteBuffer target)

  Get an ara of pixels as RGBA values into a buffer

  Parameters:
    `x` - The x position in the context to grab from
    `y` - The y position in the context to grab from
    `width` - The width of the area to grab from
    `height` - The hiehgt of the area to grab from
    `target` - The target buffer to grab into

### drawImage

    public void drawImage(Image image,
                          float x,
                          float y,
                          float x2,
                          float y2,
                          float srcx,
                          float srcy,
                          float srcx2,
                          float srcy2,
                          Color col)

  Draw a section of an image at a particular location and scale on the screen

  Parameters:
    `image` - The image to draw a section of
    `x` - The x position to draw the image
    `y` - The y position to draw the image
    `x2` - The x position of the bottom right corner of the drawn image
    `y2` - The y position of the bottom right corner of the drawn image
    `srcx` - The x position of the rectangle to draw from this image (i.e. relative to the image)
    `srcy` - The y position of the rectangle to draw from this image (i.e. relative to the image)
    `srcx2` - The x position of the bottom right cornder of rectangle to draw from this image (i.e. relative to the image)
    `srcy2` - The t position of the bottom right cornder of rectangle to draw from this image (i.e. relative to the image)
    `col` - The color to apply to the image as a filter

### drawImage

    public void drawImage(Image image,
                          float x,
                          float y,
                          float srcx,
                          float srcy,
                          float srcx2,
                          float srcy2,
                          Color col)

  Draw a section of an image at a particular location and scale on the screen

  Parameters:
    `image` - The image to draw a section of
    `x` - The x position to draw the image
    `y` - The y position to draw the image
    `srcx` - The x position of the rectangle to draw from this image (i.e. relative to the image)
    `srcy` - The y position of the rectangle to draw from this image (i.e. relative to the image)
    `srcx2` - The x position of the bottom right cornder of rectangle to draw from this image (i.e. relative to the image)
    `srcy2` - The t position of the bottom right cornder of rectangle to draw from this image (i.e. relative to the image)
    `col` - The color to apply to the image as a filter

### drawGradientLine

    public void drawGradientLine(float x1,
                                 float y1,
                                 float red1,
                                 float green1,
                                 float blue1,
                                 float alpha1,
                                 float x2,
                                 float y2,
                                 float red2,
                                 float green2,
                                 float blue2,
                                 float alpha2)

  Draw a line with a gradient between the two points.

  Parameters:
    `x1` - The starting x position to draw the line
    `y1` - The starting y position to draw the line
    `red1` - The starting position's shade of red
    `green1` - The starting position's shade of green
    `blue1` - The starting position's shade of blue
    `alpha1` - The starting position's alpha value
    `x2` - The ending x position to draw the line
    `y2` - The ending y position to draw the line
    `red2` - The ending position's shade of red
    `green2` - The ending position's shade of green
    `blue2` - The ending position's shade of blue
    `alpha2` - The ending position's alpha value

### drawGradientLine

    public void drawGradientLine(float x1,
                                 float y1,
                                 Color Color1,
                                 float x2,
                                 float y2,
                                 Color Color2)

  Draw a line with a gradient between the two points.

  Parameters:
    `x1` - The starting x position to draw the line
    `y1` - The starting y position to draw the line
    `Color1` - The starting position's color
    `x2` - The ending x position to draw the line
    `y2` - The ending y position to draw the line
    `Color2` - The ending position's color

### pushTransform

    public void pushTransform()

  Push the current state of the transform from this graphics contexts onto the underlying graphics stack's transform stack. An associated popTransform() must be performed to restore the state before the end of the rendering loop.

### popTransform

    public void popTransform()

  Pop a previously pushed transform from the stack to the current. This should only be called if a transform has been previously pushed.

### destroy

    public void destroy()

  Dispose this graphics context, this will release any underlying resourses. However this will also invalidate it's use

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006 New Dawn Software. All Rights Reserved.