107 public: |
107 public: |
108 CompositionRenderer(QWidget *parent); |
108 CompositionRenderer(QWidget *parent); |
109 |
109 |
110 void paint(QPainter *); |
110 void paint(QPainter *); |
111 |
111 |
112 void mousePressEvent(QMouseEvent *); |
|
113 void mouseMoveEvent(QMouseEvent *); |
|
114 void mouseReleaseEvent(QMouseEvent *); |
|
115 |
|
116 void setCirclePos(const QPointF &pos); |
112 void setCirclePos(const QPointF &pos); |
117 |
113 |
118 QSize sizeHint() const { return QSize(500, 400); } |
114 QSize sizeHint() const { return QSize(500, 400); } |
119 |
115 |
120 bool animationEnabled() const { return m_animation_enabled; } |
116 bool animationEnabled() const { return m_animation_enabled; } |
121 int circleColor() const { return m_circle_hue; } |
117 int circleColor() const { return m_circle_hue; } |
122 int circleAlpha() const { return m_circle_alpha; } |
118 int circleAlpha() const { return m_circle_alpha; } |
|
119 |
|
120 protected: |
|
121 void mousePressEvent(QMouseEvent *); |
|
122 void mouseMoveEvent(QMouseEvent *); |
|
123 void mouseReleaseEvent(QMouseEvent *); |
|
124 void timerEvent(QTimerEvent *); |
123 |
125 |
124 public slots: |
126 public slots: |
125 void setClearMode() { m_composition_mode = QPainter::CompositionMode_Clear; update(); } |
127 void setClearMode() { m_composition_mode = QPainter::CompositionMode_Clear; update(); } |
126 void setSourceMode() { m_composition_mode = QPainter::CompositionMode_Source; update(); } |
128 void setSourceMode() { m_composition_mode = QPainter::CompositionMode_Source; update(); } |
127 void setDestMode() { m_composition_mode = QPainter::CompositionMode_Destination; update(); } |
129 void setDestMode() { m_composition_mode = QPainter::CompositionMode_Destination; update(); } |
148 void setDifferenceMode() { m_composition_mode = QPainter::CompositionMode_Difference; update(); } |
150 void setDifferenceMode() { m_composition_mode = QPainter::CompositionMode_Difference; update(); } |
149 void setExclusionMode() { m_composition_mode = QPainter::CompositionMode_Exclusion; update(); } |
151 void setExclusionMode() { m_composition_mode = QPainter::CompositionMode_Exclusion; update(); } |
150 |
152 |
151 void setCircleAlpha(int alpha) { m_circle_alpha = alpha; update(); } |
153 void setCircleAlpha(int alpha) { m_circle_alpha = alpha; update(); } |
152 void setCircleColor(int hue) { m_circle_hue = hue; update(); } |
154 void setCircleColor(int hue) { m_circle_hue = hue; update(); } |
153 void setAnimationEnabled(bool enabled) { m_animation_enabled = enabled; update(); } |
155 void setAnimationEnabled(bool enabled); |
154 |
156 |
155 private: |
157 private: |
156 void updateCirclePos(); |
158 void updateCirclePos(); |
157 void drawBase(QPainter &p); |
159 void drawBase(QPainter &p); |
158 void drawSource(QPainter &p); |
160 void drawSource(QPainter &p); |
175 QPointF m_circle_pos; |
177 QPointF m_circle_pos; |
176 QPointF m_offset; |
178 QPointF m_offset; |
177 |
179 |
178 ObjectType m_current_object; |
180 ObjectType m_current_object; |
179 bool m_animation_enabled; |
181 bool m_animation_enabled; |
|
182 int m_animationTimer; |
180 |
183 |
181 #ifdef QT_OPENGL_SUPPORT |
184 #ifdef QT_OPENGL_SUPPORT |
182 QGLPixelBuffer *m_pbuffer; |
185 QGLPixelBuffer *m_pbuffer; |
183 GLuint m_base_tex; |
186 GLuint m_base_tex; |
184 GLuint m_compositing_tex; |
187 GLuint m_compositing_tex; |