| 1 |
// Copyright (C) 2016 The Qt Company Ltd. |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause |
| 3 |
|
| 4 |
#ifndef BUBBLE_H |
| 5 |
#define BUBBLE_H |
| 6 |
|
| 7 |
#include <QBrush> |
| 8 |
#include <QColor> |
| 9 |
#include <QPointF> |
| 10 |
#include <QRect> |
| 11 |
#include <QRectF> |
| 12 |
|
| 13 |
QT_FORWARD_DECLARE_CLASS(QPainter) |
| 14 |
|
| 15 |
class Bubble |
| 16 |
{ |
| 17 |
public: |
| 18 |
Bubble(const QPointF &position, qreal radius, const QPointF &velocity); |
| 19 |
~Bubble(); |
| 20 |
|
| 21 |
void drawBubble(QPainter *painter); |
| 22 |
void updateBrush(); |
| 23 |
void move(const QRect &bbox); |
| 24 |
void updateCache(); |
| 25 |
QRectF rect(); |
| 26 |
|
| 27 |
private: |
| 28 |
QColor randomColor(); |
| 29 |
|
| 30 |
QBrush brush; |
| 31 |
QPointF position; |
| 32 |
QPointF vel; |
| 33 |
qreal radius; |
| 34 |
QColor innerColor; |
| 35 |
QColor outerColor; |
| 36 |
QImage *cache = nullptr; |
| 37 |
}; |
| 38 |
|
| 39 |
#endif |