Horus Doc || Java GUI Reference || Doxygen's quick Index  

RGB data transfer

javRgb.gif

RGB data transfer

For display of image-like data we need to transfer the pixel data in RGB format from the server to the Java GUI. We have implemented several mechanisms to accomplish this task, basically to be able to introduce optimizations in the process of transferring RGB data from the server to the GUI where possible.

The preferred way to obtain RGB data from a Corba object is via an HxCorba.RgbBuffer that is filled by an HxCorba.RgbSource (via HxCorba.RgbSourceOperations). The Corba object, e.g. an HxCorba.ImageRep or a HxCorba.ImageSeq, provides (a specialization of) an HxCorba.RgbSource, typically via a member function like ImageDataOperations.getRgbSource. The purpose of the HxCorba.RgbSource is to accomodate parameters used to prepare the RGB data and do potential buffering for partial display purposes.

The HxCorba.RgbSource can be asked to deliver the RGB data as an array (via RgbSourceOperations.getRgb) or to put the RGB data in an HxCorba.RgbBuffer (via RgbSourceOperations.fillRgb). The purpose of the HxCorba.RgbBuffer is to prevent array allocation and copying overhead, e.g. by wrapping it around the true destination of the RGB data.

At the heart of the display mechanism resides a CorbaBufferedImage. As this is a specialization of a BufferImage from Java itself the "clients" of this class, e.g. CanvasCorbaImage, can ask it to display itself in a part of the GUI using the standard Java procedure, i.e. by calling Graphics.drawImage (see e.g. CanvasCorbaImage.draw). Another class that employs the same mechanism is CanvasCorbaBlob2d.

CanvasCorbaSequence uses a different mechanism as it uses an HxCorba.ImageSeqDisplayer that has not been updated to be an RgbSource yet. So, it uses a protected class SequenceBufferImage to make the connections.

In principle, the CorbaBufferedImage uses an HxCorba.RgbSourceOperations object to obtain the pixels to be shown in the GUI and puts them into its internal buffer (an array of integers from its base class BufferedImage). However, since there are multiple ways to transfer RGB data from the RgbSource to the internal buffer we use an abstract class to hide this. So, transfer of RGB data is done via a member function of RgbTransferManager:

public abstract void
transferData(HxCorba.RgbSourceOperations src, int[] dest, int offset);

The operation is implemented by specializations of RgbTransferManager, each implementing a different strategy to transfer the RGB data. Which transfer manager to use is decided by the CorbaMediator in createRgbTxMgr.

NoBufferTxManager
Used when "src" is not a real Corba object but a local Java image. Transfer of data is done by asking src to produce an array of ints and copying the array to "dest". The src is typically an ImageRgbSource (private class in CanvasCorbaImage).
ServerBufferTxManager
Used when "src" is a Corba object and the GUI is an Applet. Creates an RgbBuffer in the server. Transfer of data is done by asking src to fill the buffer, asking the buffer to produce an array of ints, and copying the array to "dest".
InProcBufferTxManager
Used when "src" is a Corba object residing in a server that runs in the same process as the GUI. Creates an RgbBuffer servant in the Horus server via the native function createInProcRgbBuffer and asks the CorbaMediator for an RgbBuffer reference to it. Transfer of data is done by calling the native function doTransfer. "dest" now acts as a pointer so the C++ function writes directly into the Java image and there is no need to copy the RGB data afterwards.
LocalBufferTxManager
Used when "src" is a Corba object and the GUI is an application. Creates an RgbBufferServant (private class in LocalBufferTxManager) and asks the CorbaMediator to activate it (so the servant/buffer resides in the Java "client" application, not the Horus "server"). Transfer of data is done by giving the servant "dest" and asking "src" to fill the buffer. The fill operation thus writes directly into the Java image so there is no need to copy the RGB data afterwards.


Go to the next section or return to the index.


Generated on Mon Jan 27 15:11:30 2003 for JavaReference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001