Swiftray  1.0
bitmap-shape.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <QPainter>
4 #include <QPixmap>
5 #include <shape/shape.h>
6 
7 class BitmapShape : public Shape {
8 public:
9  BitmapShape();
10 
11  BitmapShape(QImage &image);
12 
13  BitmapShape(const BitmapShape &orig);
14 
15  ShapePtr clone() const override;
16 
17  bool hitTest(QPointF global_coord, qreal tolerance) const override;
18 
19  bool hitTest(QRectF global_coord_rect) const override;
20 
21  void paint(QPainter *painter) const override;
22 
23  Shape::Type type() const override;
24 
25  const QPixmap *pixmap() const;
26 
27  QImage &image() const;
28 
29  friend class DocumentSerializer;
30 
31 private:
32  void calcBoundingBox() const override;
33 
34  unique_ptr<QPixmap> bitmap_;
35  mutable QImage tinted_image_; // Cache object
36  mutable std::uintptr_t tinted_signature; // Cache object
37 };
Definition: bitmap-shape.h:7
Shape::Type type() const override
Definition: bitmap-shape.cpp:92
BitmapShape()
Definition: bitmap-shape.cpp:9
void paint(QPainter *painter) const override
Definition: bitmap-shape.cpp:77
const QPixmap * pixmap() const
Definition: bitmap-shape.cpp:94
ShapePtr clone() const override
Definition: bitmap-shape.cpp:87
QImage & image() const
Definition: bitmap-shape.cpp:53
bool hitTest(QPointF global_coord, qreal tolerance) const override
Definition: bitmap-shape.cpp:33
Save and load documents as binary format.
Definition: document-serializer.h:18
A base class for shape objects that contains transform and parent information.
Definition: shape.h:17
Type
Definition: shape.h:19
shared_ptr< Shape > ShapePtr
Definition: shape.h:137