1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Added a version of Path::addEllipse that takes a Rectangle

This commit is contained in:
jules 2014-05-16 17:41:43 +01:00
parent 549b08312e
commit 1a2a50f71d
4 changed files with 24 additions and 21 deletions

View file

@ -436,9 +436,7 @@ void Path::addRectangle (const float x, const float y,
data.elements [numElements++] = closeSubPathMarker;
}
void Path::addRoundedRectangle (const float x, const float y,
const float w, const float h,
float csx, float csy)
void Path::addRoundedRectangle (float x, float y, float w, float h, float csx, float csy)
{
addRoundedRectangle (x, y, w, h, csx, csy, true, true, true, true);
}
@ -498,9 +496,7 @@ void Path::addRoundedRectangle (const float x, const float y, const float w, con
closeSubPath();
}
void Path::addRoundedRectangle (const float x, const float y,
const float w, const float h,
float cs)
void Path::addRoundedRectangle (float x, float y, float w, float h, float cs)
{
addRoundedRectangle (x, y, w, h, cs, cs);
}
@ -527,15 +523,19 @@ void Path::addQuadrilateral (const float x1, const float y1,
closeSubPath();
}
void Path::addEllipse (const float x, const float y,
const float w, const float h)
void Path::addEllipse (float x, float y, float w, float h)
{
const float hw = w * 0.5f;
addEllipse (Rectangle<float> (x, y, w, h));
}
void Path::addEllipse (Rectangle<float> area)
{
const float hw = area.getWidth() * 0.5f;
const float hw55 = hw * 0.55f;
const float hh = h * 0.5f;
const float hh = area.getHeight() * 0.5f;
const float hh55 = hh * 0.55f;
const float cx = x + hw;
const float cy = y + hh;
const float cx = area.getX() + hw;
const float cy = area.getY() + hh;
startNewSubPath (cx, cy - hh);
cubicTo (cx + hw55, cy - hh, cx + hw, cy - hh55, cx + hw, cy);

View file

@ -391,13 +391,17 @@ public:
float x4, float y4);
/** Adds an ellipse to the path.
The shape is added as a new sub-path. (Any currently open paths will be left open).
@see addArc
*/
void addEllipse (float x, float y, float width, float height);
/** Adds an ellipse to the path.
The shape is added as a new sub-path. (Any currently open paths will be left open).
@see addArc
*/
void addEllipse (Rectangle<float> area);
/** Adds an elliptical arc to the current path.
Note that when specifying the start and end angles, the curve will be drawn either clockwise