Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
canvas-item-rect.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2#ifndef SEEN_CANVAS_ITEM_RECT_H
3#define SEEN_CANVAS_ITEM_RECT_H
4
9/*
10 * Author:
11 * Tavmjong Bah
12 *
13 * Copyright (C) 2020 Tavmjong Bah
14 *
15 * Rewrite of CtrlRect
16 *
17 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
18 */
19
20#include <cstdint>
21#include <memory>
22#include <2geom/path.h>
23
24#include "canvas-item.h"
25
26namespace Inkscape {
27
28class CanvasItemRect final : public CanvasItem
29{
30public:
32 CanvasItemRect(CanvasItemGroup *group, Geom::Rect const &rect);
33
34 // Geometry
35 void set_rect(Geom::Rect const &rect);
36 void visit_page_rects(std::function<void(Geom::Rect const &)> const &) const override;
37
38 // Selection
39 bool contains(Geom::Point const &p, double tolerance = 0) override;
40
41 // Properties
42 void set_is_page(bool is_page);
43 void set_fill(uint32_t color) override;
44 void set_dashed(bool dash = true);
45 void set_inverted(bool inverted = false);
46 void set_shadow(uint32_t color, int width);
47protected:
48 ~CanvasItemRect() override = default;
49
50 void _update(bool propagate) override;
51 void _render(Inkscape::CanvasItemBuffer &buf) const override;
52
53 // Geometry
54 double get_shadow_size() const;
55
57 bool _is_page = false;
58 bool _dashed = false;
59 bool _inverted = false;
61 uint32_t _shadow_color = 0x0;
62};
63
64} // namespace Inkscape
65
66#endif // SEEN_CANVAS_ITEM_RECT_H
67
68/*
69 Local Variables:
70 mode:c++
71 c-file-style:"stroustrup"
72 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
73 indent-tabs-mode:nil
74 fill-column:99
75 End:
76*/
77// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
Path - a sequence of contiguous curves.
Two-dimensional point that doubles as a vector.
Definition point.h:66
Axis aligned, non-empty rectangle.
Definition rect.h:92
void set_rect(Geom::Rect const &rect)
Set a control rect.
void set_is_page(bool is_page)
void set_dashed(bool dash=true)
void _render(Inkscape::CanvasItemBuffer &buf) const override
Render rect to screen via Cairo.
void set_fill(uint32_t color) override
~CanvasItemRect() override=default
void visit_page_rects(std::function< void(Geom::Rect const &)> const &) const override
Run a callback for each rectangle that should be filled and painted in the background.
bool contains(Geom::Point const &p, double tolerance=0) override
Returns true if point p (in canvas units) is within tolerance (canvas units) distance of rect.
void set_inverted(bool inverted=false)
void _update(bool propagate) override
Update and redraw control rect.
void set_shadow(uint32_t color, int width)
Helper class to stream background task notifications as a series of messages.
int buf
Class used when rendering canvas items.
double width