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.