- report imageOnly boolean in copyToPrinter function as an optional argument

- adding the RainbowColorScale
This commit is contained in:
Damien Dupuis 2009-02-04 16:11:53 +00:00
parent 00e01d50c8
commit b3aeaa5a6f
6 changed files with 66 additions and 8 deletions

View File

@ -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;

View File

@ -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.

View File

@ -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 );
}

View File

@ -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

View File

@ -84,6 +84,16 @@ namespace Hurricane {
};
// -------------------------------------------------------------------
// Class : "Hurricane::RainbowColorScale"
class RainbowColorScale : public ColorScale {
public:
RainbowColorScale ();
};
// Functions.
inline const Name& ColorScale::getName () const { return _name; }

View File

@ -84,6 +84,7 @@ namespace Hurricane {
vector<DisplayStyle*> _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;