org.ogre4j
Class PixelUtil

java.lang.Object
  extended by org.xbig.base.NativeObject
      extended by org.ogre4j.PixelUtil
All Implemented Interfaces:
IPixelUtil, INativeObject

public class PixelUtil
extends NativeObject
implements IPixelUtil


Field Summary
 
Fields inherited from class org.xbig.base.NativeObject
deleted, object, remote
 
Constructor Summary
  PixelUtil()
           
  PixelUtil(InstancePointer p)
          This constructor is public for internal useage only!
protected PixelUtil(InstancePointer p, boolean remote)
          Creates a Java wrapper object for an existing C++ object.
  PixelUtil(WithoutNativeObject val)
          Allows creation of Java objects without C++ objects.
 
Method Summary
static void bulkPixelConversion(IPixelBox src, IPixelBox dst)
          Convert pixels from one format to another.
static void bulkPixelConversion(VoidPointer src, PixelFormat srcFormat, VoidPointer dest, PixelFormat dstFormat, long count)
          Convert consecutive pixels from one format to another.
 void delete()
          Deletes the corresponding C++ object.
 void finalize()
           
static java.lang.String getBNFExpressionOfPixelFormats(boolean accessibleOnly)
          Gets the BNF expression of the pixel-formats.
static int getComponentCount(PixelFormat fmt)
          Returns the component count for a certain pixel format.
static PixelComponentType getComponentType(PixelFormat fmt)
          Returns the component type for a certain pixel format.
static long getFlags(PixelFormat format)
          Returns the property flags for this pixel format
static PixelFormat getFormatForBitDepths(PixelFormat fmt, int integerBits, int floatBits)
          Returns the similar format but acoording with given bit depths.
static PixelFormat getFormatFromName(java.lang.String name, boolean accessibleOnly, boolean caseSensitive)
          Gets the format from given name.
static java.lang.String getFormatName(PixelFormat srcformat)
          Gets the name of an image format
static int getMemorySize(int width, int height, int depth, PixelFormat format)
          Returns the size in memory of a region with the given extents and pixel format with consecutive memory layout.
static int getNumElemBits(PixelFormat format)
          Returns the size in bits of an element of the given pixel format.
static int getNumElemBytes(PixelFormat format)
          Returns the size in bytes of an element of the given pixel format.
static boolean hasAlpha(PixelFormat format)
          Shortcut method to determine if the format has an alpha component
static boolean isAccessible(PixelFormat srcformat)
          Returns wether the format can be packed or unpacked with the and functions.
static boolean isCompressed(PixelFormat format)
          Shortcut method to determine if the format is compressed
static boolean isDepth(PixelFormat format)
          Shortcut method to determine if the format is a depth format.
static boolean isFloatingPoint(PixelFormat format)
          Shortcut method to determine if the format is floating point
static boolean isLuminance(PixelFormat format)
          Shortcut method to determine if the format is a luminance format.
static boolean isNativeEndian(PixelFormat format)
          Shortcut method to determine if the format is in native endian format.
static boolean isValidExtent(int width, int height, int depth, PixelFormat format)
          Return wether a certain image extent is valid for this image format.
static void packColour(float r, float g, float b, float a, PixelFormat pf, VoidPointer dest)
          Pack a colour value to memory
static void packColour(IColourValue colour, PixelFormat pf, VoidPointer dest)
          Pack a colour value to memory
static void packColour(short r, short g, short b, short a, PixelFormat pf, VoidPointer dest)
          Pack a colour value to memory
static void unpackColour(FloatPointer r, FloatPointer g, FloatPointer b, FloatPointer a, PixelFormat pf, VoidPointer src)
          Unpack a colour value from memory
static void unpackColour(IColourValue colour, PixelFormat pf, VoidPointer src)
          Unpack a colour value from memory
static void unpackColour(ShortPointer r, ShortPointer g, ShortPointer b, ShortPointer a, PixelFormat pf, VoidPointer src)
          Unpack a colour value from memory
 
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

PixelUtil

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


PixelUtil

protected PixelUtil(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.


PixelUtil

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

See Also:
WithoutNativeObject, INativeObject.disconnectFromNativeObject()

PixelUtil

public PixelUtil()
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

getNumElemBytes

public static int getNumElemBytes(PixelFormat format)
Returns the size in bytes of an element of the given pixel format.


getNumElemBits

public static int getNumElemBits(PixelFormat format)
Returns the size in bits of an element of the given pixel format.


getMemorySize

public static int getMemorySize(int width,
                                int height,
                                int depth,
                                PixelFormat format)
Returns the size in memory of a region with the given extents and pixel format with consecutive memory layout.


getFlags

public static long getFlags(PixelFormat format)
Returns the property flags for this pixel format


hasAlpha

public static boolean hasAlpha(PixelFormat format)
Shortcut method to determine if the format has an alpha component


isFloatingPoint

public static boolean isFloatingPoint(PixelFormat format)
Shortcut method to determine if the format is floating point


isCompressed

public static boolean isCompressed(PixelFormat format)
Shortcut method to determine if the format is compressed


isDepth

public static boolean isDepth(PixelFormat format)
Shortcut method to determine if the format is a depth format.


isNativeEndian

public static boolean isNativeEndian(PixelFormat format)
Shortcut method to determine if the format is in native endian format.


isLuminance

public static boolean isLuminance(PixelFormat format)
Shortcut method to determine if the format is a luminance format.


isValidExtent

public static boolean isValidExtent(int width,
                                    int height,
                                    int depth,
                                    PixelFormat format)
Return wether a certain image extent is valid for this image format.


getFormatName

public static java.lang.String getFormatName(PixelFormat srcformat)
Gets the name of an image format


isAccessible

public static boolean isAccessible(PixelFormat srcformat)
Returns wether the format can be packed or unpacked with the and functions. This is generally not true for compressed and depth formats as they are special. It can only be true for formats with a fixed element size.


getComponentType

public static PixelComponentType getComponentType(PixelFormat fmt)
Returns the component type for a certain pixel format. Returns PCT_BYTE in case there is no clear component type like with compressed formats. This is one of PCT_BYTE, PCT_SHORT, PCT_FLOAT16, PCT_FLOAT32.


getComponentCount

public static int getComponentCount(PixelFormat fmt)
Returns the component count for a certain pixel format. Returns 3(no alpha) or 4 (has alpha) in case there is no clear component type like with compressed formats.


getFormatFromName

public static PixelFormat getFormatFromName(java.lang.String name,
                                            boolean accessibleOnly,
                                            boolean caseSensitive)
Gets the format from given name.


getBNFExpressionOfPixelFormats

public static java.lang.String getBNFExpressionOfPixelFormats(boolean accessibleOnly)
Gets the BNF expression of the pixel-formats.


getFormatForBitDepths

public static PixelFormat getFormatForBitDepths(PixelFormat fmt,
                                                int integerBits,
                                                int floatBits)
Returns the similar format but acoording with given bit depths.


packColour

public static void packColour(IColourValue colour,
                              PixelFormat pf,
                              VoidPointer dest)
Pack a colour value to memory


packColour

public static void packColour(short r,
                              short g,
                              short b,
                              short a,
                              PixelFormat pf,
                              VoidPointer dest)
Pack a colour value to memory


packColour

public static void packColour(float r,
                              float g,
                              float b,
                              float a,
                              PixelFormat pf,
                              VoidPointer dest)
Pack a colour value to memory


unpackColour

public static void unpackColour(IColourValue colour,
                                PixelFormat pf,
                                VoidPointer src)
Unpack a colour value from memory


unpackColour

public static void unpackColour(ShortPointer r,
                                ShortPointer g,
                                ShortPointer b,
                                ShortPointer a,
                                PixelFormat pf,
                                VoidPointer src)
Unpack a colour value from memory


unpackColour

public static void unpackColour(FloatPointer r,
                                FloatPointer g,
                                FloatPointer b,
                                FloatPointer a,
                                PixelFormat pf,
                                VoidPointer src)
Unpack a colour value from memory


bulkPixelConversion

public static void bulkPixelConversion(VoidPointer src,
                                       PixelFormat srcFormat,
                                       VoidPointer dest,
                                       PixelFormat dstFormat,
                                       long count)
Convert consecutive pixels from one format to another. No dithering or filtering is being done. Converting from RGB to luminance takes the R channel. In case the source and destination format match, just a copy is done.


bulkPixelConversion

public static void bulkPixelConversion(IPixelBox src,
                                       IPixelBox dst)
Convert pixels from one format to another. No dithering or filtering is being done. Converting from RGB to luminance takes the R channel.



Copyright © 2007 netAllied GmbH. All Rights Reserved.