diff --git a/hurricane/src/hviewer/CellWidget.cpp b/hurricane/src/hviewer/CellWidget.cpp index 19b89295..db6e84e1 100644 --- a/hurricane/src/hviewer/CellWidget.cpp +++ b/hurricane/src/hviewer/CellWidget.cpp @@ -492,9 +492,8 @@ namespace Hurricane { } - void CellWidget::DrawingPlanes::copyToPrinter ( int sx, int sy, int w, int h, QPrinter* printer ) + void CellWidget::DrawingPlanes::copyToPrinter ( int sx, int sy, int w, int h, QPrinter* printer, bool imageOnly ) { - bool imageOnly = false; int ximage = 0; int yimage = 0; diff --git a/hurricane/src/hviewer/ColorScale.cpp b/hurricane/src/hviewer/ColorScale.cpp index b9a33c1e..8768051d 100644 --- a/hurricane/src/hviewer/ColorScale.cpp +++ b/hurricane/src/hviewer/ColorScale.cpp @@ -103,4 +103,44 @@ namespace Hurricane { } +// ------------------------------------------------------------------- +// Class : "Hurricane::RainbowColorScale" + + + RainbowColorScale::RainbowColorScale () + : ColorScale("Rainbow") + { + size_t slice = 51; + for ( size_t i=0 ; i<256 ; i++ ) { + switch ( i / slice ) { + case 0: // Red --> Yellow. + _red [i] = 255; + _green[i] = ( 255 * i ) / slice; + _blue [i] = 0; + break; + case 1: // Yellow --> Green. + _red [i] = 510 - ( 255 * i ) / slice; + _green[i] = 255; + _blue [i] = 0; + break; + case 2: // Green --> Cyan. + _red [i] = 0; + _green[i] = 255; + _blue [i] = ( 255 * i ) / slice - 510; + break; + case 3: // Cyan --> Blue. + _red [i] = 0; + _green[i] = 1020 - ( 255 * i ) / slice; + _blue [i] = 255; + break; + default: // Blue --> Magenta. + _red [i] = ( 255 * i ) / slice - 1020; + _green[i] = 0; + _blue [i] = 255; + break; + } + } + } + + } // End of Hurricane namespace. diff --git a/hurricane/src/hviewer/Graphics.cpp b/hurricane/src/hviewer/Graphics.cpp index be09d4b0..b4afc183 100644 --- a/hurricane/src/hviewer/Graphics.cpp +++ b/hurricane/src/hviewer/Graphics.cpp @@ -48,6 +48,7 @@ namespace Hurricane { : _styles() , _active(NULL) , _fireColorScale() + , _rainbowColorScale() , _qtEnabled(false) { } @@ -104,6 +105,7 @@ namespace Hurricane { _styles[si]->qtAllocate (); _fireColorScale.qtAllocate (); + _rainbowColorScale.qtAllocate (); Breakpoint::setStopCb ( Graphics::breakpointStopCb ); } diff --git a/hurricane/src/hviewer/hurricane/viewer/CellWidget.h b/hurricane/src/hviewer/hurricane/viewer/CellWidget.h index 826be6e6..b6b5bc30 100644 --- a/hurricane/src/hviewer/hurricane/viewer/CellWidget.h +++ b/hurricane/src/hviewer/hurricane/viewer/CellWidget.h @@ -143,7 +143,7 @@ namespace Hurricane { inline void addDrawExtensionGo ( const Name&, InitExtensionGo_t*, DrawExtensionGo_t* ); inline QPainter& getPainter ( size_t plane=PlaneId::Working ); inline int getDarkening () const; - inline void copyToPrinter ( QPrinter* ); + inline void copyToPrinter ( QPrinter*, bool imageOnly = false ); inline const float& getScale () const; inline const QPoint& getMousePosition () const; void setLayerVisible ( const Name& layer, bool visible ); @@ -366,8 +366,10 @@ namespace Hurricane { void copyToSelect ( int sx, int sy, int h, int w ); inline void copyToScreen (); void copyToScreen ( int sx, int sy, int h, int w ); - inline void copyToPrinter ( QPrinter* ); - void copyToPrinter ( int sx, int sy, int h, int w, QPrinter* ); + inline void copyToPrinter ( QPrinter*, bool imageOnly ); + void copyToPrinter ( int sx, int sy, int h, int w, QPrinter*, bool imageOnly ); + inline void copyToImage ( QImage* ); + void copyToImage ( int sx, int sy, int h, int w, QImage* ); private: CellWidget* _cellWidget; QPrinter* _printer; @@ -749,13 +751,14 @@ namespace Hurricane { { copyToScreen ( 0, 0, width(), height() ); } - inline void CellWidget::DrawingPlanes::copyToPrinter ( QPrinter* printer ) + inline void CellWidget::DrawingPlanes::copyToPrinter ( QPrinter* printer, bool imageOnly ) { copyToPrinter ( 0 , 0 , _cellWidget->geometry().width() , _cellWidget->geometry().height() , printer + , imageOnly ); } @@ -969,8 +972,8 @@ namespace Hurricane { { redrawSelection ( QRect(QPoint(0,0),_drawingPlanes.size()) ); } - inline void CellWidget::copyToPrinter ( QPrinter* printer ) - { _drawingPlanes.copyToPrinter ( printer ); } + inline void CellWidget::copyToPrinter ( QPrinter* printer, bool imageOnly ) + { _drawingPlanes.copyToPrinter ( printer, imageOnly ); } inline int CellWidget::dbuToDisplayX ( DbU::Unit x ) const diff --git a/hurricane/src/hviewer/hurricane/viewer/ColorScale.h b/hurricane/src/hviewer/hurricane/viewer/ColorScale.h index 35071b32..3de4d7f7 100644 --- a/hurricane/src/hviewer/hurricane/viewer/ColorScale.h +++ b/hurricane/src/hviewer/hurricane/viewer/ColorScale.h @@ -84,6 +84,16 @@ namespace Hurricane { }; +// ------------------------------------------------------------------- +// Class : "Hurricane::RainbowColorScale" + + + class RainbowColorScale : public ColorScale { + public: + RainbowColorScale (); + }; + + // Functions. inline const Name& ColorScale::getName () const { return _name; } diff --git a/hurricane/src/hviewer/hurricane/viewer/Graphics.h b/hurricane/src/hviewer/hurricane/viewer/Graphics.h index 7283f8d3..64b4d843 100644 --- a/hurricane/src/hviewer/hurricane/viewer/Graphics.h +++ b/hurricane/src/hviewer/hurricane/viewer/Graphics.h @@ -84,6 +84,7 @@ namespace Hurricane { vector _styles; DisplayStyle* _active; FireColorScale _fireColorScale; + RainbowColorScale _rainbowColorScale; bool _qtEnabled; // Internals - Constructors & Destructors. @@ -139,7 +140,10 @@ namespace Hurricane { switch ( id ) { case ColorScale::Grey: case ColorScale::Fire: + return _fireColorScale; + break; case ColorScale::Rainbow: + return _rainbowColorScale; break; } return _fireColorScale;