crystalspace.jbind.impl.graphic.image
Class csImage

java.lang.Object
  extended bycrystalspace.jbind.impl.csNativeObject
      extended bycrystalspace.jbind.impl.csutil.scf.csBase
          extended bycrystalspace.jbind.impl.graphic.image.csImage
All Implemented Interfaces:
iBase, iImage, iPointer

public class csImage
extends csBase
implements iImage

Author:
Quentin Anciaux

Field Summary
 
Fields inherited from class crystalspace.jbind.impl.csNativeObject
ImplFactory, nPointer
 
Constructor Summary
csImage(iPointer nPointer)
           
 
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 getVersion()
          Return the version of the interface
 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.
protected  boolean isNativePointerValidSafe(long pointer)
           
 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 class crystalspace.jbind.impl.csutil.scf.csBase
decRef, equals, finalize, getRefCount, incRef, nDelete, queryInterface, queryInterfaceSafe
 
Methods inherited from class crystalspace.jbind.impl.csNativeObject
changePointer, getPointer, getPointer, getPointerArray, hashCode, isMemoryOwner, isNativePointerValid, newNativeObject, setMemoryOwner, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface crystalspace.jbind.interfaces.iutil.scf.iBase
decRef, getRefCount, incRef, queryInterface, queryInterfaceSafe
 
Methods inherited from interface crystalspace.jbind.interfaces.iPointer
changePointer, getPointer, isMemoryOwner, setMemoryOwner
 

Constructor Detail

csImage

public csImage(iPointer nPointer)
Parameters:
nPointer -
Method Detail

getVersion

public int getVersion()
Description copied from interface: iBase
Return the version of the interface

Specified by:
getVersion in interface iBase
Specified by:
getVersion in class csBase
See Also:
iBase.getVersion()

getName

public java.lang.String getName()
Description copied from interface: iImage
Get image file name. Implemented in csImageFile.

Specified by:
getName in interface iImage
Specified by:
getName in class csBase
See Also:
iBase.getName()

isNativePointerValidSafe

protected boolean isNativePointerValidSafe(long pointer)
Specified by:
isNativePointerValidSafe in class csNativeObject
See Also:
csNativeObject.isNativePointerValidSafe(long)

checkAlpha

public void checkAlpha()
Description copied from interface: iImage
Check if all alpha values are "non-transparent" and if so, discard alpha. Implemented in csImageFile.

Specified by:
checkAlpha in interface iImage
See Also:
iImage.checkAlpha()

Clone

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

Specified by:
Clone in interface iImage
Returns:
See Also:
iImage.Clone()

crop

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

Specified by:
crop in interface iImage
Parameters:
x -
y -
width -
height -
Returns:
See Also:
iImage.crop(int, int, int, int)

getAlpha

public byte getAlpha()
Description copied from interface: iImage
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.

Specified by:
getAlpha in interface iImage
Returns:
See Also:
iImage.getAlpha()

getFormat

public int getFormat()
Description copied from interface: iImage
Qyery image format (see CS_IMGFMT_XXX above);. Implemented in csImageFile.

Specified by:
getFormat in interface iImage
Returns:
See Also:
iImage.getFormat()

getHeight

public int getHeight()
Description copied from interface: iImage
Query image height. Implemented in csImageFile.

Specified by:
getHeight in interface iImage
Returns:
See Also:
iImage.getHeight()

getImageData

public java.lang.Object[] getImageData()
Description copied from interface: iImage
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.

Specified by:
getImageData in interface iImage
Returns:
See Also:
iImage.getImageData()

getKeycolor

public int[] getKeycolor()
Description copied from interface: iImage
Get the keycolour stored with the image. Implemented in csImageFile.

Specified by:
getKeycolor in interface iImage
Returns:
See Also:
iImage.getKeycolor()

getPalette

public csRGBpixel getPalette()
Description copied from interface: iImage
Get image palette (or 0 if no palette);. Implemented in csImageFile.

Specified by:
getPalette in interface iImage
Returns:
See Also:
iImage.getPalette()

getSize

public int getSize()
Description copied from interface: iImage
Query image size in bytes. Implemented in csImageFile.

Specified by:
getSize in interface iImage
Returns:
See Also:
iImage.getSize()

getWidth

public int getWidth()
Description copied from interface: iImage
Query image width. Implemented in csImageFile.

Specified by:
getWidth in interface iImage
Returns:
See Also:
iImage.getWidth()

hasKeycolor

public boolean hasKeycolor()
Description copied from interface: iImage
check if image has a keycolour stored with it Implemented in csImageFile.

Specified by:
hasKeycolor in interface iImage
Returns:
See Also:
iImage.hasKeycolor()

hasMipmaps

public int hasMipmaps()
Description copied from interface: iImage
Returns the number of mipmaps contained in the image (in case there exist any precalculated mipmaps. Implemented in csImageFile.

Specified by:
hasMipmaps in interface iImage
Returns:
See Also:
iImage.hasMipmaps()

mipMap

public iImage mipMap(int step,
                     csRGBpixel transp)
Description copied from interface: iImage
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.

Specified by:
mipMap in interface iImage
Parameters:
step -
transp -
Returns:
See Also:
iImage.mipMap(int, crystalspace.jbind.impl.csgfx.rgbpixel.csRGBpixel)

rescale

public void rescale(int NewWidth,
                    int NewHeight)
Description copied from interface: iImage
Rescale the image to the given size. Implemented in csImageFile, and csImageMemory.

Specified by:
rescale in interface iImage
Parameters:
NewWidth -
NewHeight -
See Also:
iImage.rescale(int, int)

setFormat

public void setFormat(int iFormat)
Description copied from interface: iImage
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.

Specified by:
setFormat in interface iImage
Parameters:
iFormat -
See Also:
iImage.setFormat(int)

setName

public void setName(java.lang.String iName)
Description copied from interface: iImage
Set image file name. Implemented in csImageFile.

Specified by:
setName in interface iImage
Parameters:
iName -
See Also:
iImage.setName(java.lang.String)

sharpen

public iImage sharpen(csRGBpixel transp,
                      int strength)
Description copied from interface: iImage
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.

Specified by:
sharpen in interface iImage
Parameters:
transp -
strength -
Returns:
See Also:
iImage.sharpen(crystalspace.jbind.impl.csgfx.rgbpixel.csRGBpixel, int)