LMMS
Loading...
Searching...
No Matches
juce_DrawableRectangle.cpp
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
31
39
40std::unique_ptr<Drawable> DrawableRectangle::createCopy() const
41{
42 return std::make_unique<DrawableRectangle> (*this);
43}
44
45//==============================================================================
47{
48 if (bounds != newBounds)
49 {
50 bounds = newBounds;
52 }
53}
54
56{
57 if (cornerSize != newSize)
58 {
59 cornerSize = newSize;
61 }
62}
63
65{
66 auto w = bounds.getWidth();
67 auto h = bounds.getHeight();
68
69 Path newPath;
70
71 if (cornerSize.x > 0 && cornerSize.y > 0)
72 newPath.addRoundedRectangle (0, 0, w, h, cornerSize.x, cornerSize.y);
73 else
74 newPath.addRectangle (0, 0, w, h);
75
77 Point<float> (w, 0), bounds.topRight,
78 Point<float> (0, h), bounds.bottomLeft));
79
80 if (path != newPath)
81 {
82 path.swapWithPath (newPath);
84 }
85}
86
87} // namespace juce
static AffineTransform fromTargetPoints(float x00, float y00, float x10, float y10, float x01, float y01) noexcept
Definition juce_AffineTransform.cpp:213
Parallelogram< float > bounds
Definition juce_DrawableRectangle.h:67
void setRectangle(Parallelogram< float > newBounds)
Definition juce_DrawableRectangle.cpp:46
DrawableRectangle()
Definition juce_DrawableRectangle.cpp:29
~DrawableRectangle() override
Definition juce_DrawableRectangle.cpp:30
Point< float > cornerSize
Definition juce_DrawableRectangle.h:68
void rebuildPath()
Definition juce_DrawableRectangle.cpp:64
std::unique_ptr< Drawable > createCopy() const override
Definition juce_DrawableRectangle.cpp:40
void setCornerSize(Point< float > newSize)
Definition juce_DrawableRectangle.cpp:55
void pathChanged()
Definition juce_DrawableShape.cpp:112
Path path
Definition juce_DrawableShape.h:118
DrawableShape()
Definition juce_DrawableShape.cpp:29
Definition juce_Parallelogram.h:38
Definition juce_Path.h:65
void addRoundedRectangle(float x, float y, float width, float height, float cornerSize)
Definition juce_Path.cpp:412
void addRectangle(float x, float y, float width, float height)
Definition juce_Path.cpp:323
void applyTransform(const AffineTransform &transform) noexcept
Definition juce_Path.cpp:821
Definition juce_Point.h:42
UINT_D64 w
Definition inflate.c:942
Definition carla_juce.cpp:31
uch h[RAND_HEAD_LEN]
Definition crypt.c:459