Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef LAYERPAINTERREQUEST_H
00029 #define LAYERPAINTERREQUEST_H
00030
00031 #include <QtGui>
00032
00033 #include "GraphContent.h"
00034
00035 namespace SciFigs {
00036
00037 class LayerPainterRequest: public QObject
00038 {
00039 Q_OBJECT
00040 public:
00041 LayerPainterRequest();
00042
00043 void setGraphContent(GraphContent * gc) {_gc=gc;}
00044 GraphContent * graphContent() const {return _gc;}
00045 void setLayers(const QList<GraphContentLayer *>& layers) {_layers=layers;}
00046
00047 void setSize(int w, int h) {_size=QSize(w, h);}
00048 void setSize(const QSize& s) {_size=s;}
00049 QSize size() const {return _size;}
00050
00051 void setOptions(const QSharedDataPointer<GraphContentOptions> & o) {_options=o;}
00052 const GraphContentOptions& options() const {return *_options;}
00053
00054 void setLayerImages(const LayerImages& li) {_layerImages=li;}
00055 const LayerImages& layerImages() const {return _layerImages;}
00056
00057 void setDepth(int depth);
00058 int depth() const {return _depth;}
00059
00060 void paint();
00061 void paintText();
00062 void terminate() {_terminate.fetchAndStoreOrdered(true);}
00063 bool terminated() const {return _terminate.testAndSetOrdered(true, true);}
00064 signals:
00065 void finished(QImage im, LayerImages li);
00066 private:
00067 inline void paintLayers(QPainter& p);
00068 inline void paintLayers(int fromIndex, QPainter& p);
00069
00070 mutable QAtomicInt _terminate;
00071 QImage _image;
00072 QSize _size;
00073 GraphContent * _gc;
00074 QList<GraphContentLayer *> _layers;
00075 QSharedDataPointer<GraphContentOptions> _options;
00076 LayerImages _layerImages;
00077 int _depth;
00078 };
00079
00080 }
00081
00082 #endif // LAYERPAINTERREQUEST_H