crystalspace.jbind.interfaces.igraphic.image
Interface iImage

All Superinterfaces:
iBase, iPointer
All Known Implementing Classes:
csImage

public interface iImage
extends iBase

The iImage interface is used to work with image files (what did you expect?). Crystal Space supports loading of images in GIF, JPEG, PNG, SGI etc formats, you can work with any image through this interface.

Author:
Java wrapper - Quentin Anciaux, c++ version - http://crystal.sourceforge.net/docs/online/pubapi/structiImage.php

Method Summary
 void checkAlpha()
          Check if all alpha values are "non-transparent" and if so, discard alpha.
 iImage Clone()
          Create yet another image and copy this one into the new image.
 iImage crop(int x, int y, int width, int height)
          Create a new image and copy a subpart of the actual image into the new image.
 byte getAlpha()
          Get alpha map for 8-bit paletted image.
 int getFormat()
          Qyery image format (see CS_IMGFMT_XXX above);.
 int getHeight()
          Query image height.
 java.lang.Object[] getImageData()
          Get image data: returns either (csRGBpixel []); or (Byte []); depending on format.
 int[] getKeycolor()
          Get the keycolour stored with the image.
 java.lang.String getName()
          Get image file name.
 csRGBpixel getPalette()
          Get image palette (or 0 if no palette);.
 int getSize()
          Query image size in bytes.
 int getWidth()
          Query image width.
 boolean hasKeycolor()
          check if image has a keycolour stored with it Implemented in csImageFile.
 int hasMipmaps()
          Returns the number of mipmaps contained in the image (in case there exist any precalculated mipmaps.
 iImage mipMap(int step, csRGBpixel transp)
          Create a new iImage which is a mipmapped version of this one.
 void rescale(int NewWidth, int NewHeight)
          Rescale the image to the given size.
 void setFormat(int iFormat)
          Convert the image to another format.
 void setName(java.lang.String iName)
          Set image file name.
 iImage sharpen(csRGBpixel transp, int strength)
          Create a sharpened copy of the image.
 
Methods inherited from interface crystalspace.jbind.interfaces.iutil.scf.iBase
decRef, getRefCount, getVersion, incRef, queryInterface, queryInterfaceSafe
 
Methods inherited from interface crystalspace.jbind.interfaces.iPointer
changePointer, getPointer, isMemoryOwner, setMemoryOwner
 

Method Detail

checkAlpha

public void checkAlpha()
Check if all alpha values are "non-transparent" and if so, discard alpha. Implemented in csImageFile.


Clone

public iImage Clone()
Create yet another image and copy this one into the new image. Implemented in csImageFile.

Returns:

crop

public iImage crop(int x,
                   int y,
                   int width,
                   int height)
Create a new image and copy a subpart of the actual image into the new image. Implemented in csImageFile.

Parameters:
x -
y -
width -
height -
Returns:

getAlpha

public byte getAlpha()
Get alpha map for 8-bit paletted image. RGBA images contains alpha within themself. If image has no alpha map, or the image is in RGBA format, this function will return 0. Implemented in csImageFile.

Returns:

getFormat

public int getFormat()
Qyery image format (see CS_IMGFMT_XXX above);. Implemented in csImageFile.

Returns:

getHeight

public int getHeight()
Query image height. Implemented in csImageFile.

Returns:

getImageData

public java.lang.Object[] getImageData()
Get image data: returns either (csRGBpixel []); or (Byte []); depending on format. Note that for RGBA images the csRGBpixel structure contains the alpha channel as well, so GetAlpha (see below); method will return 0 (because alpha is not stored separately, as for paletted images);. Implemented in csImageFile.

Returns:

getKeycolor

public int[] getKeycolor()
Get the keycolour stored with the image. Implemented in csImageFile.

Returns:

getName

public java.lang.String getName()
Get image file name. Implemented in csImageFile.

Specified by:
getName in interface iBase
Returns:
See Also:
iBase.getName()

getPalette

public csRGBpixel getPalette()
Get image palette (or 0 if no palette);. Implemented in csImageFile.

Returns:

getSize

public int getSize()
Query image size in bytes. Implemented in csImageFile.

Returns:

getWidth

public int getWidth()
Query image width. Implemented in csImageFile.

Returns:

hasKeycolor

public boolean hasKeycolor()
check if image has a keycolour stored with it Implemented in csImageFile.

Returns:

hasMipmaps

public int hasMipmaps()
Returns the number of mipmaps contained in the image (in case there exist any precalculated mipmaps. Implemented in csImageFile.

Returns:

mipMap

public iImage mipMap(int step,
                     csRGBpixel transp)
Create a new iImage which is a mipmapped version of this one. 'step' indicates how much the mipmap should be scaled down. Step 0 returns a blurred version of the image without image being scaled down. Step 1 scales the image down to 1/2. Steps > 1 repeat this 'step' times. The new image will have same format as the original one. If you pass a pointer to a transparent color, the texels of that color are handled differently. Implemented in csImageFile.

Parameters:
step -
transp -
Returns:

rescale

public void rescale(int NewWidth,
                    int NewHeight)
Rescale the image to the given size. Implemented in csImageFile, and csImageMemory.

Parameters:
NewWidth -
NewHeight -

setFormat

public void setFormat(int iFormat)
Convert the image to another format. This method will allocate a respective color component if it was not allocated before. For example, you can use this method to add alpha channel to paletted images, to allocate a image for CS_IMGFMT_NONE alphamaps or vice versa, to remove the image and leave alphamap alone. This routine may be used as well for removing alpha channel. Implemented in csImageFile.

Parameters:
iFormat -

setName

public void setName(java.lang.String iName)
Set image file name. Implemented in csImageFile.

Parameters:
iName -

sharpen

public iImage sharpen(csRGBpixel transp,
                      int strength)
Create a sharpened copy of the image. The effect of 'strength' differs from image to image. Values around 128-512 give good results. On really blurry images values up to 1024 or 2048 can be used. Implemented in csImageFile.

Parameters:
transp -
strength -
Returns: