org.ogre4j
Class Image

java.lang.Object
  extended by org.xbig.base.NativeObject
      extended by org.ogre4j.Image
All Implemented Interfaces:
IAllocatedObject<IGeneralAllocPolicy>, IGeneralAllocatedObject, IImage, INativeObject

public class Image
extends NativeObject
implements IImage


Nested Class Summary
static class Image.Filter
           
 
Field Summary
 
Fields inherited from class org.xbig.base.NativeObject
deleted, object, remote
 
Constructor Summary
  Image()
          Standard constructor.
  Image(IImage img)
          Copy-constructor - copies all the data from the target image.
  Image(InstancePointer p)
          This constructor is public for internal useage only!
protected Image(InstancePointer p, boolean remote)
          Creates a Java wrapper object for an existing C++ object.
  Image(WithoutNativeObject val)
          Allows creation of Java objects without C++ objects.
 
Method Summary
static void applyGamma(ShortPointer buffer, float gamma, int size, short bpp)
          Does gamma adjustment.
static int calculateSize(int mipmaps, int faces, int width, int height, int depth, PixelFormat format)
           
 void delete()
          Deletes the corresponding C++ object.
 void encode(IDataStreamPtr returnValue, java.lang.String formatextension)
          Encode the image and return a stream to the data.
 void finalize()
           
 IImage flipAroundX()
          Flips (mirrors) the image around the X-axis.
 IImage flipAroundY()
          Flips (mirrors) the image around the Y-axis.
 short getBPP()
          Returns the number of bits per pixel.
 void getColourAt(IColourValue returnValue, int x, int y, int z)
          Get colour value from a certain location in the image.
 ShortPointer getData_const()
           
 ShortPointer getData()
          Returns a pointer to the internal image buffer.
 int getDepth()
          Gets the depth of the image.
static java.lang.String getFileExtFromMagic(IDataStreamPtr stream)
           
 PixelFormat getFormat()
          Returns the image format.
 boolean getHasAlpha()
          Returns true if the image has an alpha component.
 int getHeight()
          Gets the height of the image in pixels.
 int getNumFaces()
          Get the number of faces of the image.
 int getNumMipmaps()
          Returns the number of mipmaps contained in the image.
 void getPixelBox(IPixelBox returnValue, int face, int mipmap)
          Get a encapsulating the image data of a mipmap
 int getRowSpan()
          Gets the physical width in bytes of each row of pixels.
 int getSize()
          Returns the size of the data buffer.
 int getWidth()
          Gets the width of the image in pixels.
 boolean hasFlag(ImageFlags imgFlag)
          Returns true if the image has the appropriate flag set.
 IImage load(IDataStreamPtr stream, java.lang.String type)
          Loads an image file from a stream.
 IImage load(java.lang.String strFileName, java.lang.String groupName)
          Loads an image file.
 IImage loadDynamicImage(ShortPointer pData, int uWidth, int uHeight, int depth, PixelFormat eFormat, boolean autoDelete, int numFaces, int numMipMaps)
          Stores a pointer to raw data in memory.
 IImage loadDynamicImage(ShortPointer pData, int uWidth, int uHeight, PixelFormat eFormat)
          Stores a pointer to raw data in memory.
 IImage loadRawData(IDataStreamPtr stream, int uWidth, int uHeight, int uDepth, PixelFormat eFormat, int numFaces, int numMipMaps)
          Loads raw data from a stream.
 IImage loadRawData(IDataStreamPtr stream, int uWidth, int uHeight, PixelFormat eFormat)
          Loads raw data from a stream.
 IImage operatorAssignment(IImage img)
          Assignment operator - copies all the data from the target image.
 void resize(int width, int height, Image.Filter filter)
          Resize a 2D image, applying the appropriate filter.
 void save(java.lang.String filename)
          Save the image as a file.
static void scale(IPixelBox src, IPixelBox dst, Image.Filter filter)
          Scale a 1D, 2D or 3D image volume.
 
Methods inherited from class org.xbig.base.NativeObject
disconnectFromNativeObject, equals, getInstancePointer, hashCode, setInstancePointer, setInstancePointer, setInstancePointer, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.xbig.base.INativeObject
disconnectFromNativeObject, getInstancePointer, setInstancePointer, setInstancePointer, setInstancePointer
 

Constructor Detail

Image

public Image(InstancePointer p)
This constructor is public for internal useage only! Do not use it!


Image

protected Image(InstancePointer p,
                boolean remote)
Creates a Java wrapper object for an existing C++ object. If remote is set to 'true' this object cannot be deleted in Java.


Image

public Image(WithoutNativeObject val)
Allows creation of Java objects without C++ objects.

See Also:
WithoutNativeObject, INativeObject.disconnectFromNativeObject()

Image

public Image()
Standard constructor.


Image

public Image(IImage img)
Copy-constructor - copies all the data from the target image.

Method Detail

delete

public void delete()
Description copied from interface: INativeObject
Deletes the corresponding C++ object.

Subclasses must implement this but if the native instance was created by the underlying library the native call to dispose must not happen!

Specified by:
delete in interface INativeObject
Specified by:
delete in class NativeObject
See Also:
#remote

finalize

public void finalize()
Overrides:
finalize in class NativeObject

operatorAssignment

public IImage operatorAssignment(IImage img)
Assignment operator - copies all the data from the target image.

Specified by:
operatorAssignment in interface IImage

flipAroundY

public IImage flipAroundY()
Flips (mirrors) the image around the Y-axis.

Specified by:
flipAroundY in interface IImage

flipAroundX

public IImage flipAroundX()
Flips (mirrors) the image around the X-axis.

Specified by:
flipAroundX in interface IImage

loadDynamicImage

public IImage loadDynamicImage(ShortPointer pData,
                               int uWidth,
                               int uHeight,
                               int depth,
                               PixelFormat eFormat,
                               boolean autoDelete,
                               int numFaces,
                               int numMipMaps)
Stores a pointer to raw data in memory. The pixel format has to be specified.

Specified by:
loadDynamicImage in interface IImage

loadDynamicImage

public IImage loadDynamicImage(ShortPointer pData,
                               int uWidth,
                               int uHeight,
                               PixelFormat eFormat)
Stores a pointer to raw data in memory. The pixel format has to be specified.

Specified by:
loadDynamicImage in interface IImage

loadRawData

public IImage loadRawData(IDataStreamPtr stream,
                          int uWidth,
                          int uHeight,
                          int uDepth,
                          PixelFormat eFormat,
                          int numFaces,
                          int numMipMaps)
Loads raw data from a stream. See the function loadDynamicImage for a description of the parameters.

Specified by:
loadRawData in interface IImage

loadRawData

public IImage loadRawData(IDataStreamPtr stream,
                          int uWidth,
                          int uHeight,
                          PixelFormat eFormat)
Loads raw data from a stream. The pixel format has to be specified.

Specified by:
loadRawData in interface IImage

load

public IImage load(java.lang.String strFileName,
                   java.lang.String groupName)
Loads an image file.

Specified by:
load in interface IImage

load

public IImage load(IDataStreamPtr stream,
                   java.lang.String type)
Loads an image file from a stream.

Specified by:
load in interface IImage

save

public void save(java.lang.String filename)
Save the image as a file.

Specified by:
save in interface IImage

encode

public void encode(IDataStreamPtr returnValue,
                   java.lang.String formatextension)
Encode the image and return a stream to the data.

Specified by:
encode in interface IImage

getData

public ShortPointer getData()
Returns a pointer to the internal image buffer.

Specified by:
getData in interface IImage

getData_const

public ShortPointer getData_const()
Specified by:
getData_const in interface IImage

getSize

public int getSize()
Returns the size of the data buffer.

Specified by:
getSize in interface IImage

getNumMipmaps

public int getNumMipmaps()
Returns the number of mipmaps contained in the image.

Specified by:
getNumMipmaps in interface IImage

hasFlag

public boolean hasFlag(ImageFlags imgFlag)
Returns true if the image has the appropriate flag set.

Specified by:
hasFlag in interface IImage

getWidth

public int getWidth()
Gets the width of the image in pixels.

Specified by:
getWidth in interface IImage

getHeight

public int getHeight()
Gets the height of the image in pixels.

Specified by:
getHeight in interface IImage

getDepth

public int getDepth()
Gets the depth of the image.

Specified by:
getDepth in interface IImage

getNumFaces

public int getNumFaces()
Get the number of faces of the image. This is usually 6 for a cubemap, and 1 for a normal image.

Specified by:
getNumFaces in interface IImage

getRowSpan

public int getRowSpan()
Gets the physical width in bytes of each row of pixels.

Specified by:
getRowSpan in interface IImage

getFormat

public PixelFormat getFormat()
Returns the image format.

Specified by:
getFormat in interface IImage

getBPP

public short getBPP()
Returns the number of bits per pixel.

Specified by:
getBPP in interface IImage

getHasAlpha

public boolean getHasAlpha()
Returns true if the image has an alpha component.

Specified by:
getHasAlpha in interface IImage

getColourAt

public void getColourAt(IColourValue returnValue,
                        int x,
                        int y,
                        int z)
Get colour value from a certain location in the image. The z coordinate is only valid for cubemaps and volume textures. This uses the first (largest) mipmap.

Specified by:
getColourAt in interface IImage

getPixelBox

public void getPixelBox(IPixelBox returnValue,
                        int face,
                        int mipmap)
Get a encapsulating the image data of a mipmap

Specified by:
getPixelBox in interface IImage

resize

public void resize(int width,
                   int height,
                   Image.Filter filter)
Resize a 2D image, applying the appropriate filter.

Specified by:
resize in interface IImage

applyGamma

public static void applyGamma(ShortPointer buffer,
                              float gamma,
                              int size,
                              short bpp)
Does gamma adjustment.


scale

public static void scale(IPixelBox src,
                         IPixelBox dst,
                         Image.Filter filter)
Scale a 1D, 2D or 3D image volume.


calculateSize

public static int calculateSize(int mipmaps,
                                int faces,
                                int width,
                                int height,
                                int depth,
                                PixelFormat format)

getFileExtFromMagic

public static java.lang.String getFileExtFromMagic(IDataStreamPtr stream)


Copyright © 2007 netAllied GmbH. All Rights Reserved.