#include <HxImageRepRgbSource.h>
Inheritance diagram for HxImageRepRgbSource::
Public Methods | |
HxImageRepRgbSource (const HxImageRep &img) | |
~HxImageRepRgbSource () | |
virtual HxCorba::RgbSeq * | getRgb () throw (CORBA::SystemException) |
virtual void | fillRgb (HxCorba::RgbBuffer_ptr buf) throw (CORBA::SystemException) |
virtual void | setDisplayMode (const char *displayMode) throw (CORBA::SystemException) |
virtual char * | getDisplayMode () throw (CORBA::SystemException) |
virtual void | setSize (const HxCorba::Sizes &newSize) throw (CORBA::SystemException) |
virtual void | setMaxSize (const HxCorba::Sizes &maxSize) throw (CORBA::SystemException) |
virtual void | scale (CORBA::Float factor) throw (CORBA::SystemException) |
virtual void | setTransferSize (CORBA::Long nLines) throw (CORBA::SystemException) |
virtual CORBA::Long | getTransferSize () throw (CORBA::SystemException) |
virtual void | setTransferPos (CORBA::Long line) throw (CORBA::SystemException) |
virtual CORBA::Long | getTransferPos () throw (CORBA::SystemException) |
virtual HxCorba::Sizes | getSizes () throw (CORBA::SystemException) |
virtual HxCorba::Sizes | getOriginalSizes () throw (CORBA::SystemException) |
virtual void | close () throw (CORBA::SystemException) |
|
00017 : _img(img), _displayMode("Direct"), _resWidth(-1), _resHeight(-1) 00018 { 00019 _nPixels = _img.numberOfPixels(); 00020 _data = new CORBA::Long[_nPixels]; 00021 00022 _transPos = 0; //for partial transfer 00023 _transSize = -1; //for partial transfer 00024 } |
|
00027 { 00028 delete [] _data; 00029 } |
|
Reimplemented from POA_HxCorba::RgbSource.
00043 { 00044 if(_transSize == -1) { 00045 _img.getRgbPixels2d((int*)_data, _displayMode, _resWidth, _resHeight); 00046 return new HxCorba::RgbSeq(_nPixels, _nPixels, _data, false); 00047 } 00048 else if(_transPos >= getSizes().y) { // exceeded end 00049 return new HxCorba::RgbSeq(); 00050 } 00051 else { 00052 int remainingLines = (getSizes().y - _transPos); 00053 int nLines = (remainingLines > _transSize)? _transSize : remainingLines; 00054 int nPixels = nLines * getSizes().x; 00055 CORBA::Long* dataPiece = _data + (_transPos * getSizes().x); 00056 _transPos += _transSize; 00057 00058 return new HxCorba::RgbSeq(nPixels, nPixels, dataPiece, false); 00059 } 00060 } |
|
00065 { 00066 if(_transSize == -1) { 00067 HxRgbBuffer tmpBuf(buf, _nPixels); 00068 _img.getRgbPixels2d(tmpBuf.getBuffer(), _displayMode, _resWidth, _resHeight); 00069 } 00070 else if(_transPos >= getSizes().y) { // exceeded end 00071 } 00072 else { 00073 int remainingLines = (getSizes().y - _transPos); 00074 int nLines = (remainingLines > _transSize)? _transSize : remainingLines; 00075 int nPixels = nLines * getSizes().x; 00076 CORBA::Long* dataPiece = _data + (_transPos * getSizes().x); 00077 _transPos += _transSize; 00078 00079 HxRgbBuffer tmpBuf(buf, nPixels); 00080 int n = nPixels * sizeof(CORBA::Long); 00081 memcpy(tmpBuf.getBuffer(), dataPiece, n); 00082 } 00083 } |
|
00088 { 00089 _displayMode = displayMode; 00090 00091 if(_transSize != -1) 00092 _img.getRgbPixels2d((int*)_data, _displayMode, _resWidth, _resHeight); 00093 } |
|
Reimplemented from POA_HxCorba::ImageRepRgbSource.
00098 { 00099 return CORBA::string_dup(_displayMode.c_str()); 00100 } |
|
00105 { 00106 _nPixels = newSize.x * newSize.y; 00107 00108 _resWidth = (newSize.x == _img.dimensionSize(1))? -1 : newSize.x; 00109 _resHeight = (newSize.y == _img.dimensionSize(2))? -1 : newSize.y; 00110 00111 delete [] _data; 00112 _data = new CORBA::Long[_nPixels]; 00113 00114 if(_transSize != -1) 00115 _img.getRgbPixels2d((int*)_data, _displayMode, _resWidth, _resHeight); 00116 } |
|
00121 { 00122 double factorX = (double)maxSize.x / (double)_img.dimensionSize(1); 00123 double factorY = (double)maxSize.y / (double)_img.dimensionSize(2); 00124 double factor = (factorX < factorY)? factorX : factorY; 00125 00126 HxCorba::Sizes sizes = { _img.dimensionSize(1)*factor, 00127 _img.dimensionSize(2)*factor, 1 }; 00128 00129 setSize(sizes); 00130 } |
|
00135 { 00136 } |
|
00161 { 00162 _transPos = 0; 00163 if((nLines < 0) || (nLines > getSizes().y)) 00164 _transSize = -1; 00165 else { 00166 _transSize = nLines; 00167 // Retrieve data 00168 _img.getRgbPixels2d((int*)_data, _displayMode, _resWidth, _resHeight); 00169 } 00170 00171 } |
|
Reimplemented from POA_HxCorba::ImageRepRgbSource.
|
|
00183 { 00184 _transPos = (line < 0)? 0 : line; 00185 } |
|
Reimplemented from POA_HxCorba::ImageRepRgbSource.
00190 { 00191 return _transPos; 00192 } |
|
Reimplemented from POA_HxCorba::ImageRepRgbSource.
00142 { 00143 HxCorba::Sizes result = { _resWidth, _resHeight, 1 }; 00144 if(result.x == -1) result.x = _img.dimensionSize(1); 00145 if(result.y == -1) result.y = _img.dimensionSize(2); 00146 00147 return result; 00148 } |
|
Reimplemented from POA_HxCorba::ImageRepRgbSource.
00153 { 00154 HxCorba::Sizes result = { _img.dimensionSize(1), _img.dimensionSize(2), 1}; 00155 return result; 00156 } |
|
Reimplemented from POA_HxCorba::ImageRepRgbSource.
00034 { 00035 PortableServer::ObjectId_var myOid = 00036 HxServer::instance()->getCurrentObjectId(); 00037 HxServer::instance()->unregisterServant(myOid); 00038 } |