27 #ifndef QTPIXELCANVAS_H
28 #define QTPIXELCANVAS_H
54 class QtPixelCanvas :
public QWidget,
public PixelCanvas {
68 QtPixelCanvas(QWidget *parent=0);
69 QtPixelCanvas(
const QtPixelCanvas *, QWidget *parent=0 );
72 void beginLabelAndAxisCaching( ) {
73 cache_label_and_axis =
true;
75 void endLabelAndAxisCaching( QPainter &qp );
79 std::list<q_draw*> label_and_axis_cache;
83 void paintEvent(QPaintEvent*
e);
84 void resizeEvent(QResizeEvent*
e);
85 void mouseMoveEvent(QMouseEvent*
e);
86 void mousePressEvent(QMouseEvent*
e);
87 void mouseReleaseEvent(QMouseEvent*
e);
88 void keyPressEvent(QKeyEvent*
e );
89 void enterEvent( QEvent*
e );
92 bool cache_label_and_axis;
101 virtual QSize sizeHint()
const {
102 return QSize(400, 300);
118 const bool &explicitrequest =
true);
120 static void colorTableResizeCB(PixelCanvasColorTable *,
casacore::uInt,
121 QtPixelCanvas * qtpc,
138 virtual void copyBackBufferToFrontBuffer();
139 virtual void copyFrontBufferToBackBuffer();
140 virtual void swapBuffers();
145 virtual void copyBackBufferToFrontBuffer(
int x1,
int y1,
int x2,
int y2);
146 virtual void copyFrontBufferToBackBuffer(
int x1,
int y1,
int x2,
int y2);
147 virtual void swapBuffers(
int x1,
int y1,
int x2,
int y2);
160 virtual void clear();
161 virtual void clear(
int x1,
int y1,
int x2,
int y2);
174 virtual void drawImage(
const int &x,
const int &y,
177 bool opaqueMask=
false) ;
182 virtual void drawRectangle(
int x1,
int y1,
int x2,
int y2);
184 virtual void drawFilledRectangle(
int x1,
int y1,
int x2,
int y2);
262 virtual void setRGBColor(
float r,
float g,
float b);
268 virtual void setClipWindow(
int x1,
int y1,
int x2,
int y2);
290 return itspcctbl->depth();
294 virtual void pixelDensity(
float &xdpi,
float &ydpi)
const;
305 virtual PixelCanvasColorTable * pcctbl()
const {
315 virtual bool supportsLists();
317 virtual void endList();
320 virtual void deleteLists();
332 virtual QPixmap* contents() {
333 return new QPixmap(*frontBuffer_);
335 virtual QPixmap* getBackBuffer() {
363 virtual void setAllowBackToFront(
bool allowed=
true) {
364 allowBackToFront_ = allowed;
367 virtual void setUpdateAllowed(
bool allowed=
true) {
373 }
else if(saveBuf_==0) saveBuf_ = contents();
382 void resizing(QResizeEvent* ev);
408 return QWidget::height()-1 - pY;
411 return QWidget::height()-1 - pY;
413 double q_(
double pY) {
414 return QWidget::height()-1 - pY;
418 void qFromPC_(
int x1,
int y1,
int x2,
int y2,
419 int& qx,
int& qy,
int& qw,
int& qh) {
427 QRect qrect_(
int x1,
int y1,
int x2,
int y2) {
429 qFromPC_(x1,y1,x2,y2, qx,qy,qw,qh);
430 return QRect(qx,qy,qw,qh);
436 int clrByte_(
float f) {
444 QPixmap* currentBuffer_() {
446 frontBuffer_ : backBuffer_;
449 void clearBuffer_() {
450 p_.eraseRect(0,0, currentBuffer_()->width(),
451 currentBuffer_()->height());
454 QPaintDevice* currentPaintDevice_() {
455 if(inDrawMode_())
return currentBuffer_();
456 else return drawList_;
474 QPixmap* frontBuffer_;
475 QPixmap* backBuffer_;
493 std::map<casacore::uInt, void*> drawlists_;
509 QtPCColorTable* itspcctbl;
523 bool allowBackToFront_;
582 virtual void flushComponentBuffers() { }
596 bool refreshActive()
const;
599 virtual bool refreshAllowed()
const;
615 virtual void flush();
617 static void drawText(QPainter& painter,
const QPoint& p,
const QFont& font,
620 virtual void drawText(
int x,
int y,
const casacore::String &text,
const float& angle,
629 virtual void setHSVColor(
float ,
float ,
float ) { }
634 virtual void drawPoint(
int x1,
int y1);
635 virtual void drawPoint(
float x1,
float y1);
636 virtual void drawPoint(
double x1,
double y1);
658 virtual void drawLine(
int x1,
int y1,
660 virtual void drawLine(
float x1,
float y1,
662 virtual void drawLine(
double x1,
double y1,
663 double x2,
double y2);
749 virtual void drawRectangle(
float x1,
float y1,
751 virtual void drawRectangle(
double x1,
double y1,
752 double x2,
double y2);
757 virtual void drawFilledRectangle(
float x1,
float y1,
759 virtual void drawFilledRectangle(
double x1,
double y1,
760 double x2,
double y2);
792 virtual void setLineWidth(
float width);
802 virtual void setQtLineStyle(Qt::PenStyle style);
803 virtual void setQtPenColor( QColor
c ) {
806 virtual QColor getQtPenColor( )
const {
807 return itsPen.color( );
815 virtual float getLineWidth()
const;
836 virtual void setClearColor(
float r,
float g,
float b);
841 virtual void getClearColor(
float &r,
float &g,
float &b)
const;
843 virtual void enableMotionEvents() { }
844 virtual void disableMotionEvents() { }
845 virtual void enablePositionEvents() { }
846 virtual void disablePositionEvents() { }
848 virtual void translateAllLists(
int ,
int ) { }
852 virtual bool setFont(DLFont* ) {
859 virtual bool setFont(
const casacore::String& fontName,
bool bold,
bool italic);
860 virtual bool setFont(
const casacore::String& fontName,
const int fontSize,
bool bold,
890 virtual void getColor(
float &r,
float &g,
float &b)
const;
895 virtual bool getRGBColor(
int x,
int y,
896 float &r,
float &g,
float &b);
897 virtual bool getHSVColor(
int x,
int y,
898 float &h,
float &s,
float &v);
917 virtual void pushMatrix() { }
918 virtual void popMatrix() { }
921 virtual void loadIdentity() { }
928 virtual void translate(
int ,
int ) { }
929 virtual void getTranslation(
int &,
int &)
const { }
930 virtual int xTranslation()
const {
933 virtual int yTranslation()
const {
948 const float & = 1.0,
const bool & =
true) { }
964 virtual void getClipWindow(
int &,
int &,
int &,
int &) { }
966 virtual void setPcctbl(PixelCanvasColorTable * ) { }
Vector< T > column(size_t j)
Returns a reference to the j'th column.
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
Option
PixelCanvas Options.
LatticeExprNode max(const LatticeExprNode &left, const LatticeExprNode &right)
DrawBuffer
PixelCanvas target drawing destination.
FillRule
Fill Rule Xlib programming guide, pg.132.
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of data
CapStyle
Controls the appearance of thick lines near their endpoints.
reference point aligned to center of text
ColorComponent
Color components.
LatticeExprNode min(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode abs(const LatticeExprNode &expr)
Numerical 1-argument functions which result in a real number regardless of input expression type...
Draw only to front buffer.
Draw only to back buffer.
FillStyle
Controls fill style.
RefreshReason
Callback reasons for PCRefreshEvent and WCRefreshEvent.
const Double e
e and functions thereof:
const Double c
Fundamental physical constants (SI units):
String: the storage and methods of handling collections of characters.
ImageCacheStrategy
How to cache images when displaying them on client-server graphics systems.
DrawFunction
PixelCanvas Drawing Logical Functions.
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the color(i.e.,"000000"for black) and
JoinStyle
Controls the appearance of two joined lines.
ColorModel
Different ways of handling color on the display.
User told PixelCanvas to refresh via PixelCanvas refresh()
LineStyle
Style of line to use.