org.ogre4j
Class HardwarePixelBuffer

java.lang.Object
  extended by org.xbig.base.NativeObject
      extended by org.ogre4j.HardwarePixelBuffer
All Implemented Interfaces:
IAllocatedObject<IRenderSysAllocPolicy>, IHardwareBuffer, IHardwarePixelBuffer, IRenderSysAllocatedObject, INativeObject

public class HardwarePixelBuffer
extends NativeObject
implements IHardwarePixelBuffer


Field Summary
 
Fields inherited from class org.xbig.base.NativeObject
deleted, object, remote
 
Constructor Summary
  HardwarePixelBuffer(InstancePointer p)
          This constructor is public for internal useage only!
protected HardwarePixelBuffer(InstancePointer p, boolean remote)
          Creates a Java wrapper object for an existing C++ object.
  HardwarePixelBuffer(WithoutNativeObject val)
          Allows creation of Java objects without C++ objects.
 
Method Summary
 void _updateFromShadow()
           
 void blit(IHardwarePixelBufferSharedPtr src)
          Convenience function that blits the entire source pixel buffer to this buffer.
 void blit(IHardwarePixelBufferSharedPtr src, IBox srcBox, IBox dstBox)
          Copies a box from another PixelBuffer to a region of the this PixelBuffer.
 void blitFromMemory(IPixelBox src)
          Convenience function that blits a pixelbox from memory to the entire buffer.
 void blitFromMemory(IPixelBox src, IBox dstBox)
          Copies a region from normal memory to a region of this pixelbuffer.
 void blitToMemory(IBox srcBox, IPixelBox dst)
          Copies a region of this pixelbuffer to normal memory.
 void blitToMemory(IPixelBox dst)
          Convience function that blits this entire buffer to a pixelbox.
 void copyData(IHardwareBuffer srcBuffer, int srcOffset, int dstOffset, int length, boolean discardWholeBuffer)
          Copy data from another buffer into this one.
 void delete()
          Deletes the corresponding C++ object.
 void finalize()
           
 IPixelBox getCurrentLock()
          Get the current locked region.
 int getDepth()
           
 PixelFormat getFormat()
           
 int getHeight()
           
 IRenderTexture getRenderTarget(int slice)
          Get a render target for this PixelBuffer, or a slice of it.
 int getSizeInBytes()
           
 HardwareBuffer.Usage getUsage()
           
 int getWidth()
           
 boolean hasShadowBuffer()
           
 boolean isLocked()
           
 boolean isSystemMemory()
           
 VoidPointer lock(HardwareBuffer.LockOptions options)
          Lock the entire buffer for (potentially) reading / writing.
 IPixelBox lock(IBox lockBox, HardwareBuffer.LockOptions options)
          Lock the buffer for (potentially) reading / writing.
 VoidPointer lock(int offset, int length, HardwareBuffer.LockOptions options)
          Lock the buffer for (potentially) reading / writing.
 void readData(int offset, int length, VoidPointer pDest)
          Reads data from the buffer and places it in the memory pointed to by pDest.
 void suppressHardwareUpdate(boolean suppress)
           
 void unlock()
          Releases the lock on this buffer.
 void writeData(int offset, int length, VoidPointer pSource, boolean discardWholeBuffer)
          Writes data to the buffer from an area of system memory; note that you must ensure that your buffer is big enough.
 
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

HardwarePixelBuffer

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


HardwarePixelBuffer

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


HardwarePixelBuffer

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

See Also:
WithoutNativeObject, INativeObject.disconnectFromNativeObject()
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

lock

public IPixelBox lock(IBox lockBox,
                      HardwareBuffer.LockOptions options)
Lock the buffer for (potentially) reading / writing.

Specified by:
lock in interface IHardwarePixelBuffer

lock

public VoidPointer lock(int offset,
                        int length,
                        HardwareBuffer.LockOptions options)
Description copied from interface: IHardwareBuffer
Lock the buffer for (potentially) reading / writing.

Specified by:
lock in interface IHardwareBuffer
Specified by:
lock in interface IHardwarePixelBuffer

getCurrentLock

public IPixelBox getCurrentLock()
Get the current locked region. This is the same value as returned by lock(const Image::Box, LockOptions)

Specified by:
getCurrentLock in interface IHardwarePixelBuffer

readData

public void readData(int offset,
                     int length,
                     VoidPointer pDest)
Description copied from interface: IHardwareBuffer
Reads data from the buffer and places it in the memory pointed to by pDest.

Specified by:
readData in interface IHardwareBuffer
Specified by:
readData in interface IHardwarePixelBuffer

writeData

public void writeData(int offset,
                      int length,
                      VoidPointer pSource,
                      boolean discardWholeBuffer)
Description copied from interface: IHardwareBuffer
Writes data to the buffer from an area of system memory; note that you must ensure that your buffer is big enough.

Specified by:
writeData in interface IHardwareBuffer
Specified by:
writeData in interface IHardwarePixelBuffer

blit

public void blit(IHardwarePixelBufferSharedPtr src,
                 IBox srcBox,
                 IBox dstBox)
Copies a box from another PixelBuffer to a region of the this PixelBuffer.

Specified by:
blit in interface IHardwarePixelBuffer

blit

public void blit(IHardwarePixelBufferSharedPtr src)
Convenience function that blits the entire source pixel buffer to this buffer. If source and destination dimensions don't match, scaling is done.

Specified by:
blit in interface IHardwarePixelBuffer

blitFromMemory

public void blitFromMemory(IPixelBox src,
                           IBox dstBox)
Copies a region from normal memory to a region of this pixelbuffer. The source image can be in any pixel format supported by OGRE, and in any size.

Specified by:
blitFromMemory in interface IHardwarePixelBuffer

blitFromMemory

public void blitFromMemory(IPixelBox src)
Convenience function that blits a pixelbox from memory to the entire buffer. The source image is scaled as needed.

Specified by:
blitFromMemory in interface IHardwarePixelBuffer

blitToMemory

public void blitToMemory(IBox srcBox,
                         IPixelBox dst)
Copies a region of this pixelbuffer to normal memory.

Specified by:
blitToMemory in interface IHardwarePixelBuffer

blitToMemory

public void blitToMemory(IPixelBox dst)
Convience function that blits this entire buffer to a pixelbox. The image is scaled as needed.

Specified by:
blitToMemory in interface IHardwarePixelBuffer

getRenderTarget

public IRenderTexture getRenderTarget(int slice)
Get a render target for this PixelBuffer, or a slice of it. The texture this was acquired from must have TU_RENDERTARGET set, otherwise it is possible to render to it and this method will throw an ERR_RENDERSYSTEM exception.

Specified by:
getRenderTarget in interface IHardwarePixelBuffer

getWidth

public int getWidth()
Specified by:
getWidth in interface IHardwarePixelBuffer

getHeight

public int getHeight()
Specified by:
getHeight in interface IHardwarePixelBuffer

getDepth

public int getDepth()
Specified by:
getDepth in interface IHardwarePixelBuffer

getFormat

public PixelFormat getFormat()
Specified by:
getFormat in interface IHardwarePixelBuffer

lock

public VoidPointer lock(HardwareBuffer.LockOptions options)
Lock the entire buffer for (potentially) reading / writing.

Specified by:
lock in interface IHardwareBuffer

unlock

public void unlock()
Releases the lock on this buffer.

Specified by:
unlock in interface IHardwareBuffer

copyData

public void copyData(IHardwareBuffer srcBuffer,
                     int srcOffset,
                     int dstOffset,
                     int length,
                     boolean discardWholeBuffer)
Copy data from another buffer into this one.

Specified by:
copyData in interface IHardwareBuffer

_updateFromShadow

public void _updateFromShadow()
Specified by:
_updateFromShadow in interface IHardwareBuffer

getSizeInBytes

public int getSizeInBytes()
Specified by:
getSizeInBytes in interface IHardwareBuffer

getUsage

public HardwareBuffer.Usage getUsage()
Specified by:
getUsage in interface IHardwareBuffer

isSystemMemory

public boolean isSystemMemory()
Specified by:
isSystemMemory in interface IHardwareBuffer

hasShadowBuffer

public boolean hasShadowBuffer()
Specified by:
hasShadowBuffer in interface IHardwareBuffer

isLocked

public boolean isLocked()
Specified by:
isLocked in interface IHardwareBuffer

suppressHardwareUpdate

public void suppressHardwareUpdate(boolean suppress)
Specified by:
suppressHardwareUpdate in interface IHardwareBuffer


Copyright © 2007 netAllied GmbH. All Rights Reserved.