diff --git a/src/juce_appframework/gui/graphics/contexts/juce_Graphics.cpp b/src/juce_appframework/gui/graphics/contexts/juce_Graphics.cpp index cf3110af87..d8359d6d8c 100644 --- a/src/juce_appframework/gui/graphics/contexts/juce_Graphics.cpp +++ b/src/juce_appframework/gui/graphics/contexts/juce_Graphics.cpp @@ -455,6 +455,14 @@ void Graphics::drawRect (const int x, b.paintRectangle (*context, x, y + height - lineThickness, width, lineThickness); } +void Graphics::drawRect (const Rectangle& r, + const int lineThickness) const throw() +{ + drawRect (r.getX(), r.getY(), + r.getWidth(), r.getHeight(), + lineThickness); +} + void Graphics::drawBevel (const int x, const int y, const int width, @@ -527,6 +535,14 @@ void Graphics::fillRoundedRectangle (const float x, fillPath (p); } +void Graphics::fillRoundedRectangle (const Rectangle& r, + const float cornerSize) const throw() +{ + fillRoundedRectangle (r.getX(), r.getY(), + r.getWidth(), r.getHeight(), + cornerSize); +} + void Graphics::drawRoundedRectangle (const float x, const float y, const float width, @@ -542,6 +558,16 @@ void Graphics::drawRoundedRectangle (const float x, strokePath (p, PathStrokeType (lineThickness)); } +void Graphics::drawRoundedRectangle (const Rectangle& r, + const float cornerSize, + const float lineThickness) const throw() +{ + drawRoundedRectangle (r.getX(), r.getY(), + r.getWidth(), r.getHeight(), + cornerSize, lineThickness); +} + + void Graphics::drawArrow (const float startX, const float startY, const float endX, diff --git a/src/juce_appframework/gui/graphics/contexts/juce_Graphics.h b/src/juce_appframework/gui/graphics/contexts/juce_Graphics.h index b3139c13ad..02995cb19e 100644 --- a/src/juce_appframework/gui/graphics/contexts/juce_Graphics.h +++ b/src/juce_appframework/gui/graphics/contexts/juce_Graphics.h @@ -275,6 +275,13 @@ public: const float height, const float cornerSize) const throw(); + /** Uses the current colour or brush to fill a rectangle with rounded corners. + + @see drawRoundedRectangle, Path::addRoundedRectangle + */ + void fillRoundedRectangle (const Rectangle& rectangle, + const float cornerSize) const throw(); + /** Fills a rectangle with a checkerboard pattern, alternating between two colours. */ void fillCheckerBoard (int x, int y, @@ -297,6 +304,16 @@ public: const int height, const int lineThickness = 1) const throw(); + /** Draws four lines to form a rectangular outline, using the current colour or brush. + + The lines are drawn inside the given rectangle, and greater line thicknesses + extend inwards. + + @see fillRect + */ + void drawRect (const Rectangle& rectangle, + const int lineThickness = 1) const throw(); + /** Uses the current colour or brush to draw the outline of a rectangle with rounded corners. @see fillRoundedRectangle, Path::addRoundedRectangle @@ -308,6 +325,14 @@ public: const float cornerSize, const float lineThickness) const throw(); + /** Uses the current colour or brush to draw the outline of a rectangle with rounded corners. + + @see fillRoundedRectangle, Path::addRoundedRectangle + */ + void drawRoundedRectangle (const Rectangle& rectangle, + const float cornerSize, + const float lineThickness) const throw(); + /** Draws a 3D raised (or indented) bevel using two colours. The bevel is drawn inside the given rectangle, and greater bevel thicknesses