|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.newdawn.slick.Image
org.newdawn.slick.BigImage
public class BigImage
An image implementation that handles loaded images that are larger than the maximum texture size supported by the card. In most cases it makes sense to make sure all of your image resources are less than 512x512 in size when using OpenGL. However, in the rare circumstances where this isn't possible this implementation can be used to draw a tiled version of the image built from several smaller textures. This implementation does come with limitations and some performance impact however - so use only when absolutely required. TODO: The code in here isn't pretty, really needs revisiting with a comment stick.
| Field Summary | |
|---|---|
protected static SGL |
GL
The renderer to use for all GL operations |
| Fields inherited from class org.newdawn.slick.Image |
|---|
alpha, angle, BOTTOM_LEFT, BOTTOM_RIGHT, centerX, centerY, corners, destroyed, FILTER_LINEAR, FILTER_NEAREST, height, inited, inUse, name, pixelData, ref, texture, textureHeight, textureOffsetX, textureOffsetY, textureWidth, TOP_LEFT, TOP_RIGHT, width |
| Constructor Summary | |
|---|---|
BigImage(LoadableImageData data,
java.nio.ByteBuffer imageBuffer,
int filter)
Create a new big image by loading it from the specified image data |
|
BigImage(LoadableImageData data,
java.nio.ByteBuffer imageBuffer,
int filter,
int tileSize)
Create a new big image by loading it from the specified image data |
|
BigImage(java.lang.String ref)
Create a new big image by loading it from the specified reference |
|
BigImage(java.lang.String ref,
int filter)
Create a new big image by loading it from the specified reference |
|
BigImage(java.lang.String ref,
int filter,
int tileSize)
Create a new big image by loading it from the specified reference |
|
| Method Summary | |
|---|---|
void |
bind()
Not supported in BigImage |
Image |
copy()
Not supported in BigImage |
void |
destroy()
Destroy the image and release any native resources. |
void |
draw()
Draw this image at the current location |
void |
draw(float x,
float y)
Draw this image at the specified location |
void |
draw(float x,
float y,
Color filter)
Draw this image at the specified location |
void |
draw(float x,
float y,
float scale)
Draw the image with a given scale |
void |
draw(float x,
float y,
float scale,
Color filter)
Draw the image with a given scale |
void |
draw(float x,
float y,
float width,
float height)
Draw this image at a specified location and size |
void |
draw(float x,
float y,
float width,
float height,
Color filter)
Draw this image at a specified location and size |
void |
draw(float x,
float y,
float srcx,
float srcy,
float srcx2,
float srcy2)
Draw a section of this image at a particular location and scale on the screen |
void |
draw(float x,
float y,
float x2,
float y2,
float srcx,
float srcy,
float srcx2,
float srcy2)
Draw a section of this image at a particular location and scale on the screen |
void |
draw(float x,
float y,
float x2,
float y2,
float srcx,
float srcy,
float srcx2,
float srcy2,
Color filter)
Draw a section of this image at a particular location and scale on the screen |
void |
drawCentered(float x,
float y)
Draw the image based on it's center |
void |
drawEmbedded(float x,
float y,
float width,
float height)
Draw this image as part of a collection of images |
void |
drawEmbedded(float x,
float y,
float x2,
float y2,
float srcx,
float srcy,
float srcx2,
float srcy2)
Draw a section of this image at a particular location and scale on the screen, while this is image is "in use", i.e. |
void |
drawEmbedded(float x,
float y,
float x2,
float y2,
float srcx,
float srcy,
float srcx2,
float srcy2,
Color filter)
Draw a section of this image at a particular location and scale on the screen, while this is image is "in use", i.e. |
void |
drawFlash(float x,
float y)
Draw this image at a specified location and size in a white silohette |
void |
drawFlash(float x,
float y,
float width,
float height)
Draw this image at a specified location and size as a silohette |
void |
drawFlash(float x,
float y,
float width,
float height,
Color col)
Draw this image at a specified location and size as a silohette |
void |
drawSheared(float x,
float y,
float hshear,
float vshear)
Draw this image at a specified location and size |
void |
endUse()
Not supported in BigImage |
void |
ensureInverted()
Not supported in BigImage |
Color |
getColor(int x,
int y)
Not supported in BigImage |
Image |
getFlippedCopy(boolean flipHorizontal,
boolean flipVertical)
Get a copy image flipped on potentially two axis |
Graphics |
getGraphics()
Not supported in BigImage |
int |
getHorizontalImageCount()
Get a count of the number images that build this image up horizontally |
static int |
getMaxSingleImageSize()
Get the maximum size of an image supported by the underlying hardware. |
Image |
getScaledCopy(float scale)
Get a scaled copy of this image with a uniform scale |
Image |
getScaledCopy(int width,
int height)
Get a scaled copy of this image |
Image |
getSubImage(int offsetX,
int offsetY)
Get a sub-image that builds up this image. |
Image |
getSubImage(int x,
int y,
int width,
int height)
Get a sub-part of this image. |
Texture |
getTexture()
Not supported in BigImage |
Image |
getTile(int x,
int y)
Get a sub tile of this big image. |
int |
getVerticalImageCount()
Get a count of the number images that build this image up vertically |
protected void |
initImpl()
Hook for subclasses to perform initialisation |
protected void |
reinit()
Reinitialise internal data |
void |
setTexture(Texture texture)
Not supported in BigImage |
void |
startUse()
Not supported in BigImage |
java.lang.String |
toString()
|
| Methods inherited from class org.newdawn.slick.Image |
|---|
clampTexture, drawSheared, drawWarped, flushPixelData, getAlpha, getCenterOfRotationX, getCenterOfRotationY, getFilter, getHeight, getName, getResourceReference, getRotation, getTextureHeight, getTextureOffsetX, getTextureOffsetY, getTextureWidth, getWidth, init, isDestroyed, rotate, setAlpha, setCenterOfRotation, setColor, setColor, setFilter, setImageColor, setImageColor, setName, setRotation |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static SGL GL
| Constructor Detail |
|---|
public BigImage(java.lang.String ref)
throws SlickException
ref - The reference to the image to load
SlickException - Indicates we were unable to locate the resource
public BigImage(java.lang.String ref,
int filter)
throws SlickException
ref - The reference to the image to loadfilter - The image filter to apply (@see #Image.FILTER_NEAREST)
SlickException - Indicates we were unable to locate the resource
public BigImage(java.lang.String ref,
int filter,
int tileSize)
throws SlickException
ref - The reference to the image to loadfilter - The image filter to apply (@see #Image.FILTER_NEAREST)tileSize - The maximum size of the tiles to use to build the bigger image
SlickException - Indicates we were unable to locate the resource
public BigImage(LoadableImageData data,
java.nio.ByteBuffer imageBuffer,
int filter)
data - The pixelData to use to create the imageimageBuffer - The buffer containing texture datafilter - The image filter to apply (@see #Image.FILTER_NEAREST)
public BigImage(LoadableImageData data,
java.nio.ByteBuffer imageBuffer,
int filter,
int tileSize)
data - The pixelData to use to create the imageimageBuffer - The buffer containing texture datafilter - The image filter to apply (@see #Image.FILTER_NEAREST)tileSize - The maximum size of the tiles to use to build the bigger image| Method Detail |
|---|
public static final int getMaxSingleImageSize()
public Image getTile(int x,
int y)
x - The x tile indexy - The y tile index
public void bind()
bind in class ImageImage.bind()public Image copy()
copy in class ImageImage.copy()public void draw()
Image
draw in class ImageImage.draw()
public void draw(float x,
float y,
Color filter)
Image
draw in class Imagex - The x location to draw the image aty - The y location to draw the image atfilter - The color to filter with when drawingImage.draw(float, float, org.newdawn.slick.Color)
public void draw(float x,
float y,
float scale,
Color filter)
Image
draw in class Imagex - The x position to draw the image aty - The y position to draw the image atscale - The scaling to applyfilter - The colour filter to adapt the image withImage.draw(float, float, float, org.newdawn.slick.Color)
public void draw(float x,
float y,
float width,
float height,
Color filter)
Image
draw in class Imagex - The x location to draw the image aty - The y location to draw the image atwidth - The width to render the image atheight - The height to render the image atfilter - The color to filter with while drawingImage.draw(float, float, float, float, org.newdawn.slick.Color)
public void draw(float x,
float y,
float x2,
float y2,
float srcx,
float srcy,
float srcx2,
float srcy2)
Image
draw in class Imagex - The x position to draw the imagey - The y position to draw the imagex2 - The x position of the bottom right corner of the drawn imagey2 - The y position of the bottom right corner of the drawn imagesrcx - The x position of the rectangle to draw from this image (i.e. relative to this image)srcy - The y position of the rectangle to draw from this image (i.e. relative to this image)srcx2 - The x position of the bottom right cornder of rectangle to draw from this image (i.e. relative to this image)srcy2 - The t position of the bottom right cornder of rectangle to draw from this image (i.e. relative to this image)Image.draw(float, float, float, float, float, float, float, float)
public void draw(float x,
float y,
float srcx,
float srcy,
float srcx2,
float srcy2)
Image
draw in class Imagex - The x position to draw the imagey - The y position to draw the imagesrcx - The x position of the rectangle to draw from this image (i.e. relative to this image)srcy - The y position of the rectangle to draw from this image (i.e. relative to this image)srcx2 - The x position of the bottom right cornder of rectangle to draw from this image (i.e. relative to this image)srcy2 - The t position of the bottom right cornder of rectangle to draw from this image (i.e. relative to this image)Image.draw(float, float, float, float, float, float)
public void draw(float x,
float y,
float width,
float height)
Image
draw in class Imagex - The x location to draw the image aty - The y location to draw the image atwidth - The width to render the image atheight - The height to render the image atImage.draw(float, float, float, float)
public void draw(float x,
float y,
float scale)
Image
draw in class Imagex - The x position to draw the image aty - The y position to draw the image atscale - The scaling to applyImage.draw(float, float, float)
public void draw(float x,
float y)
Image
draw in interface Renderabledraw in class Imagex - The x location to draw the image aty - The y location to draw the image atImage.draw(float, float)
public void drawEmbedded(float x,
float y,
float width,
float height)
Image
drawEmbedded in class Imagex - The x location to draw the image aty - The y location to draw the image atwidth - The width to render the image atheight - The height to render the image atImage.drawEmbedded(float, float, float, float)
public void drawFlash(float x,
float y,
float width,
float height)
Image
drawFlash in class Imagex - The x location to draw the image aty - The y location to draw the image atwidth - The width to render the image atheight - The height to render the image atImage.drawFlash(float, float, float, float)
public void drawFlash(float x,
float y)
Image
drawFlash in class Imagex - The x location to draw the image aty - The y location to draw the image atImage.drawFlash(float, float)public void endUse()
endUse in class ImageImage.endUse()public void startUse()
startUse in class ImageImage.startUse()public void ensureInverted()
ensureInverted in class ImageImage.ensureInverted()
public Color getColor(int x,
int y)
getColor in class Imagex - The x coordinate of the pixely - The y coordinate of the pixel
Image.getColor(int, int)
public Image getFlippedCopy(boolean flipHorizontal,
boolean flipVertical)
Image
getFlippedCopy in class ImageflipHorizontal - True if we want to flip the image horizontallyflipVertical - True if we want to flip the image vertically
Image.getFlippedCopy(boolean, boolean)
public Graphics getGraphics()
throws SlickException
getGraphics in class ImageSlickException - Indicates a failure to create a graphics contextImage.getGraphics()public Image getScaledCopy(float scale)
Image
getScaledCopy in class Imagescale - The scale to apply
Image.getScaledCopy(float)
public Image getScaledCopy(int width,
int height)
Image
getScaledCopy in class Imagewidth - The width of the copyheight - The height of the copy
Image.getScaledCopy(int, int)
public Image getSubImage(int x,
int y,
int width,
int height)
Image
getSubImage in class Imagex - The x coordinate of the sub-imagey - The y coordinate of the sub-imagewidth - The width of the sub-imageheight - The height of the sub-image
Image.getSubImage(int, int, int, int)public Texture getTexture()
getTexture in class ImageImage.getTexture()protected void initImpl()
Image
initImpl in class ImageImage.initImpl()protected void reinit()
Image
reinit in class ImageImage.reinit()public void setTexture(Texture texture)
setTexture in class Imagetexture - The texture used by this imageImage.setTexture(org.newdawn.slick.opengl.Texture)
public Image getSubImage(int offsetX,
int offsetY)
offsetX - The x position of the image to returnoffsetY - The y position of the image to return
public int getHorizontalImageCount()
public int getVerticalImageCount()
public java.lang.String toString()
toString in class ImageImage.toString()
public void destroy()
throws SlickException
destroy in class ImageSlickException - Indicates a failure to release resources on the graphics card
public void draw(float x,
float y,
float x2,
float y2,
float srcx,
float srcy,
float srcx2,
float srcy2,
Color filter)
Image
draw in class Imagex - The x position to draw the imagey - The y position to draw the imagex2 - The x position of the bottom right corner of the drawn imagey2 - The y position of the bottom right corner of the drawn imagesrcx - The x position of the rectangle to draw from this image (i.e. relative to this image)srcy - The y position of the rectangle to draw from this image (i.e. relative to this image)srcx2 - The x position of the bottom right cornder of rectangle to draw from this image (i.e. relative to this image)srcy2 - The t position of the bottom right cornder of rectangle to draw from this image (i.e. relative to this image)filter - The colour filter to apply when drawingImage.draw(float, float, float, float, float, float, float, float, org.newdawn.slick.Color)
public void drawCentered(float x,
float y)
Image
drawCentered in class Imagex - The x coordinate to place the image's center aty - The y coordinate to place the image's center atImage.drawCentered(float, float)
public void drawEmbedded(float x,
float y,
float x2,
float y2,
float srcx,
float srcy,
float srcx2,
float srcy2,
Color filter)
Image
drawEmbedded in class Imagex - The x position to draw the imagey - The y position to draw the imagex2 - The x position of the bottom right corner of the drawn imagey2 - The y position of the bottom right corner of the drawn imagesrcx - The x position of the rectangle to draw from this image (i.e. relative to this image)srcy - The y position of the rectangle to draw from this image (i.e. relative to this image)srcx2 - The x position of the bottom right cornder of rectangle to draw from this image (i.e. relative to this image)srcy2 - The t position of the bottom right cornder of rectangle to draw from this image (i.e. relative to this image)filter - The colour filter to apply when drawingImage.drawEmbedded(float, float, float, float, float, float, float, float, org.newdawn.slick.Color)
public void drawEmbedded(float x,
float y,
float x2,
float y2,
float srcx,
float srcy,
float srcx2,
float srcy2)
Image
drawEmbedded in class Imagex - The x position to draw the imagey - The y position to draw the imagex2 - The x position of the bottom right corner of the drawn imagey2 - The y position of the bottom right corner of the drawn imagesrcx - The x position of the rectangle to draw from this image (i.e. relative to this image)srcy - The y position of the rectangle to draw from this image (i.e. relative to this image)srcx2 - The x position of the bottom right cornder of rectangle to draw from this image (i.e. relative to this image)srcy2 - The t position of the bottom right cornder of rectangle to draw from this image (i.e. relative to this image)Image.drawEmbedded(float, float, float, float, float, float, float, float)
public void drawFlash(float x,
float y,
float width,
float height,
Color col)
Image
drawFlash in class Imagex - The x location to draw the image aty - The y location to draw the image atwidth - The width to render the image atheight - The height to render the image atcol - The color for the sillohetteImage.drawFlash(float, float, float, float, org.newdawn.slick.Color)
public void drawSheared(float x,
float y,
float hshear,
float vshear)
Image
drawSheared in class Imagex - The x location to draw the image aty - The y location to draw the image athshear - The amount to shear the bottom points by horizontallyvshear - The amount to shear the right points by verticallyImage.drawSheared(float, float, float, float)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||