@@ -38,7 +38,7 @@ namespace | |||||
&& (int) h >= 0 && (int) h <= maxVal); | && (int) h >= 0 && (int) h <= maxVal); | ||||
#endif | #endif | ||||
return Rectangle<Type> (x, y, w, h); | |||||
return { x, y, w, h }; | |||||
} | } | ||||
} | } | ||||
@@ -49,15 +49,13 @@ LowLevelGraphicsContext::~LowLevelGraphicsContext() {} | |||||
//============================================================================== | //============================================================================== | ||||
Graphics::Graphics (const Image& imageToDrawOnto) | Graphics::Graphics (const Image& imageToDrawOnto) | ||||
: context (*imageToDrawOnto.createLowLevelContext()), | : context (*imageToDrawOnto.createLowLevelContext()), | ||||
contextToDelete (&context), | |||||
saveStatePending (false) | |||||
contextToDelete (&context) | |||||
{ | { | ||||
jassert (imageToDrawOnto.isValid()); // Can't draw into a null image! | jassert (imageToDrawOnto.isValid()); // Can't draw into a null image! | ||||
} | } | ||||
Graphics::Graphics (LowLevelGraphicsContext& internalContext) noexcept | Graphics::Graphics (LowLevelGraphicsContext& internalContext) noexcept | ||||
: context (internalContext), | |||||
saveStatePending (false) | |||||
: context (internalContext) | |||||
{ | { | ||||
} | } | ||||
@@ -85,7 +83,7 @@ bool Graphics::reduceClipRegion (Rectangle<int> area) | |||||
return context.clipToRectangle (area); | return context.clipToRectangle (area); | ||||
} | } | ||||
bool Graphics::reduceClipRegion (const int x, const int y, const int w, const int h) | |||||
bool Graphics::reduceClipRegion (int x, int y, int w, int h) | |||||
{ | { | ||||
return reduceClipRegion (coordsToRectangle (x, y, w, h)); | return reduceClipRegion (coordsToRectangle (x, y, w, h)); | ||||
} | } | ||||
@@ -157,7 +155,7 @@ void Graphics::setOrigin (Point<int> newOrigin) | |||||
void Graphics::setOrigin (int x, int y) | void Graphics::setOrigin (int x, int y) | ||||
{ | { | ||||
setOrigin (Point<int> (x, y)); | |||||
setOrigin ({ x, y }); | |||||
} | } | ||||
void Graphics::addTransform (const AffineTransform& transform) | void Graphics::addTransform (const AffineTransform& transform) | ||||
@@ -239,23 +237,20 @@ void Graphics::drawSingleLineText (const String& text, const int startX, const i | |||||
// Don't pass any vertical placement flags to this method - they'll be ignored. | // Don't pass any vertical placement flags to this method - they'll be ignored. | ||||
jassert (justification.getOnlyVerticalFlags() == 0); | jassert (justification.getOnlyVerticalFlags() == 0); | ||||
const int flags = justification.getOnlyHorizontalFlags(); | |||||
auto flags = justification.getOnlyHorizontalFlags(); | |||||
if (flags == Justification::right) | |||||
{ | |||||
if (startX < context.getClipBounds().getX()) | |||||
return; | |||||
} | |||||
else if (flags == Justification::left) | |||||
if (startX > context.getClipBounds().getRight()) | |||||
return; | |||||
if (flags == Justification::right && startX < context.getClipBounds().getX()) | |||||
return; | |||||
if (flags == Justification::left && startX > context.getClipBounds().getRight()) | |||||
return; | |||||
GlyphArrangement arr; | GlyphArrangement arr; | ||||
arr.addLineOfText (context.getFont(), text, (float) startX, (float) baselineY); | arr.addLineOfText (context.getFont(), text, (float) startX, (float) baselineY); | ||||
if (flags != Justification::left) | if (flags != Justification::left) | ||||
{ | { | ||||
float w = arr.getBoundingBox (0, -1, true).getWidth(); | |||||
auto w = arr.getBoundingBox (0, -1, true).getWidth(); | |||||
if ((flags & (Justification::horizontallyCentred | Justification::horizontallyJustified)) != 0) | if ((flags & (Justification::horizontallyCentred | Justification::horizontallyJustified)) != 0) | ||||
w /= 2.0f; | w /= 2.0f; | ||||
@@ -371,11 +366,6 @@ void Graphics::fillRectList (const RectangleList<int>& rects) const | |||||
context.fillRect (r, false); | context.fillRect (r, false); | ||||
} | } | ||||
void Graphics::setPixel (int x, int y) const | |||||
{ | |||||
context.fillRect (coordsToRectangle (x, y, 1, 1), false); | |||||
} | |||||
void Graphics::fillAll() const | void Graphics::fillAll() const | ||||
{ | { | ||||
fillRect (context.getClipBounds()); | fillRect (context.getClipBounds()); | ||||
@@ -385,7 +375,7 @@ void Graphics::fillAll (Colour colourToUse) const | |||||
{ | { | ||||
if (! colourToUse.isTransparent()) | if (! colourToUse.isTransparent()) | ||||
{ | { | ||||
const Rectangle<int> clip (context.getClipBounds()); | |||||
auto clip = context.getClipBounds(); | |||||
context.saveState(); | context.saveState(); | ||||
context.setFill (colourToUse); | context.setFill (colourToUse); | ||||
@@ -507,7 +497,7 @@ void Graphics::drawRoundedRectangle (Rectangle<float> r, float cornerSize, float | |||||
strokePath (p, PathStrokeType (lineThickness)); | strokePath (p, PathStrokeType (lineThickness)); | ||||
} | } | ||||
void Graphics::drawArrow (const Line<float>& line, float lineThickness, float arrowheadWidth, float arrowheadLength) const | |||||
void Graphics::drawArrow (Line<float> line, float lineThickness, float arrowheadWidth, float arrowheadLength) const | |||||
{ | { | ||||
Path p; | Path p; | ||||
p.addArrow (line, lineThickness, arrowheadWidth, arrowheadLength); | p.addArrow (line, lineThickness, arrowheadWidth, arrowheadLength); | ||||
@@ -531,7 +521,7 @@ void Graphics::fillCheckerBoard (Rectangle<int> area, | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
const Rectangle<int> clipped (context.getClipBounds().getIntersection (area)); | |||||
auto clipped = context.getClipBounds().getIntersection (area); | |||||
if (! clipped.isEmpty()) | if (! clipped.isEmpty()) | ||||
{ | { | ||||
@@ -573,7 +563,7 @@ void Graphics::drawHorizontalLine (const int y, float left, float right) const | |||||
context.fillRect (Rectangle<float> (left, (float) y, right - left, 1.0f)); | context.fillRect (Rectangle<float> (left, (float) y, right - left, 1.0f)); | ||||
} | } | ||||
void Graphics::drawLine (const Line<float>& line) const | |||||
void Graphics::drawLine (Line<float> line) const | |||||
{ | { | ||||
context.drawLine (line); | context.drawLine (line); | ||||
} | } | ||||
@@ -588,15 +578,15 @@ void Graphics::drawLine (float x1, float y1, float x2, float y2, float lineThick | |||||
drawLine (Line<float> (x1, y1, x2, y2), lineThickness); | drawLine (Line<float> (x1, y1, x2, y2), lineThickness); | ||||
} | } | ||||
void Graphics::drawLine (const Line<float>& line, const float lineThickness) const | |||||
void Graphics::drawLine (Line<float> line, const float lineThickness) const | |||||
{ | { | ||||
Path p; | Path p; | ||||
p.addLineSegment (line, lineThickness); | p.addLineSegment (line, lineThickness); | ||||
fillPath (p); | fillPath (p); | ||||
} | } | ||||
void Graphics::drawDashedLine (const Line<float>& line, const float* const dashLengths, | |||||
const int numDashLengths, const float lineThickness, int n) const | |||||
void Graphics::drawDashedLine (Line<float> line, const float* dashLengths, | |||||
int numDashLengths, float lineThickness, int n) const | |||||
{ | { | ||||
jassert (n >= 0 && n < numDashLengths); // your start index must be valid! | jassert (n >= 0 && n < numDashLengths); // your start index must be valid! | ||||
@@ -338,12 +338,6 @@ public: | |||||
void drawRoundedRectangle (Rectangle<float> rectangle, | void drawRoundedRectangle (Rectangle<float> rectangle, | ||||
float cornerSize, float lineThickness) const; | float cornerSize, float lineThickness) const; | ||||
/** Fills a 1x1 pixel using the current colour or brush. | |||||
Note that because the context may be transformed, this is effectively the same as | |||||
calling fillRect (x, y, 1, 1), and the actual result may involve multiple pixels. | |||||
*/ | |||||
void setPixel (int x, int y) const; | |||||
//============================================================================== | //============================================================================== | ||||
/** Fills an ellipse with the current colour or brush. | /** Fills an ellipse with the current colour or brush. | ||||
The ellipse is drawn to fit inside the given rectangle. | The ellipse is drawn to fit inside the given rectangle. | ||||
@@ -388,14 +382,14 @@ public: | |||||
TIP: If you're trying to draw horizontal or vertical lines, don't use this - | TIP: If you're trying to draw horizontal or vertical lines, don't use this - | ||||
it's better to use fillRect() instead unless you really need an angled line. | it's better to use fillRect() instead unless you really need an angled line. | ||||
*/ | */ | ||||
void drawLine (const Line<float>& line) const; | |||||
void drawLine (Line<float> line) const; | |||||
/** Draws a line between two points with a given thickness. | /** Draws a line between two points with a given thickness. | ||||
@see Path::addLineSegment | @see Path::addLineSegment | ||||
TIP: If you're trying to draw horizontal or vertical lines, don't use this - | TIP: If you're trying to draw horizontal or vertical lines, don't use this - | ||||
it's better to use fillRect() instead unless you really need an angled line. | it's better to use fillRect() instead unless you really need an angled line. | ||||
*/ | */ | ||||
void drawLine (const Line<float>& line, float lineThickness) const; | |||||
void drawLine (Line<float> line, float lineThickness) const; | |||||
/** Draws a dashed line using a custom set of dash-lengths. | /** Draws a dashed line using a custom set of dash-lengths. | ||||
@@ -408,7 +402,7 @@ public: | |||||
@param dashIndexToStartFrom the index in the dash-length array to use for the first segment | @param dashIndexToStartFrom the index in the dash-length array to use for the first segment | ||||
@see PathStrokeType::createDashedStroke | @see PathStrokeType::createDashedStroke | ||||
*/ | */ | ||||
void drawDashedLine (const Line<float>& line, | |||||
void drawDashedLine (Line<float> line, | |||||
const float* dashLengths, int numDashLengths, | const float* dashLengths, int numDashLengths, | ||||
float lineThickness = 1.0f, | float lineThickness = 1.0f, | ||||
int dashIndexToStartFrom = 0) const; | int dashIndexToStartFrom = 0) const; | ||||
@@ -441,7 +435,7 @@ public: | |||||
/** Draws a path's outline using the currently selected colour or brush. */ | /** Draws a path's outline using the currently selected colour or brush. */ | ||||
void strokePath (const Path& path, | void strokePath (const Path& path, | ||||
const PathStrokeType& strokeType, | const PathStrokeType& strokeType, | ||||
const AffineTransform& transform = AffineTransform()) const; | |||||
const AffineTransform& transform = {}) const; | |||||
/** Draws a line with an arrowhead at its end. | /** Draws a line with an arrowhead at its end. | ||||
@@ -450,7 +444,7 @@ public: | |||||
@param arrowheadWidth the width of the arrow head (perpendicular to the line) | @param arrowheadWidth the width of the arrow head (perpendicular to the line) | ||||
@param arrowheadLength the length of the arrow head (along the length of the line) | @param arrowheadLength the length of the arrow head (along the length of the line) | ||||
*/ | */ | ||||
void drawArrow (const Line<float>& line, | |||||
void drawArrow (Line<float> line, | |||||
float lineThickness, | float lineThickness, | ||||
float arrowheadWidth, | float arrowheadWidth, | ||||
float arrowheadLength) const; | float arrowheadLength) const; | ||||
@@ -743,7 +737,7 @@ private: | |||||
LowLevelGraphicsContext& context; | LowLevelGraphicsContext& context; | ||||
ScopedPointer<LowLevelGraphicsContext> contextToDelete; | ScopedPointer<LowLevelGraphicsContext> contextToDelete; | ||||
bool saveStatePending; | |||||
bool saveStatePending = false; | |||||
void saveStateIfPending(); | void saveStateIfPending(); | ||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Graphics) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Graphics) | ||||
@@ -280,7 +280,7 @@ void Path::startNewSubPath (const float x, const float y) | |||||
data.elements[numElements++] = y; | data.elements[numElements++] = y; | ||||
} | } | ||||
void Path::startNewSubPath (const Point<float> start) | |||||
void Path::startNewSubPath (Point<float> start) | |||||
{ | { | ||||
startNewSubPath (start.x, start.y); | startNewSubPath (start.x, start.y); | ||||
} | } | ||||
@@ -301,7 +301,7 @@ void Path::lineTo (const float x, const float y) | |||||
bounds.extend (x, y); | bounds.extend (x, y); | ||||
} | } | ||||
void Path::lineTo (const Point<float> end) | |||||
void Path::lineTo (Point<float> end) | |||||
{ | { | ||||
lineTo (end.x, end.y); | lineTo (end.x, end.y); | ||||
} | } | ||||
@@ -326,8 +326,7 @@ void Path::quadraticTo (const float x1, const float y1, | |||||
bounds.extend (x1, y1, x2, y2); | bounds.extend (x1, y1, x2, y2); | ||||
} | } | ||||
void Path::quadraticTo (const Point<float> controlPoint, | |||||
const Point<float> endPoint) | |||||
void Path::quadraticTo (Point<float> controlPoint, Point<float> endPoint) | |||||
{ | { | ||||
quadraticTo (controlPoint.x, controlPoint.y, | quadraticTo (controlPoint.x, controlPoint.y, | ||||
endPoint.x, endPoint.y); | endPoint.x, endPoint.y); | ||||
@@ -358,9 +357,9 @@ void Path::cubicTo (const float x1, const float y1, | |||||
bounds.extend (x3, y3); | bounds.extend (x3, y3); | ||||
} | } | ||||
void Path::cubicTo (const Point<float> controlPoint1, | |||||
const Point<float> controlPoint2, | |||||
const Point<float> endPoint) | |||||
void Path::cubicTo (Point<float> controlPoint1, | |||||
Point<float> controlPoint2, | |||||
Point<float> endPoint) | |||||
{ | { | ||||
cubicTo (controlPoint1.x, controlPoint1.y, | cubicTo (controlPoint1.x, controlPoint1.y, | ||||
controlPoint2.x, controlPoint2.y, | controlPoint2.x, controlPoint2.y, | ||||
@@ -675,7 +674,7 @@ void Path::addPieSegment (Rectangle<float> segmentBounds, | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
void Path::addLineSegment (const Line<float>& line, float lineThickness) | |||||
void Path::addLineSegment (Line<float> line, float lineThickness) | |||||
{ | { | ||||
auto reversed = line.reversed(); | auto reversed = line.reversed(); | ||||
lineThickness *= 0.5f; | lineThickness *= 0.5f; | ||||
@@ -687,7 +686,7 @@ void Path::addLineSegment (const Line<float>& line, float lineThickness) | |||||
closeSubPath(); | closeSubPath(); | ||||
} | } | ||||
void Path::addArrow (const Line<float>& line, float lineThickness, | |||||
void Path::addArrow (Line<float> line, float lineThickness, | |||||
float arrowheadWidth, float arrowheadLength) | float arrowheadWidth, float arrowheadLength) | ||||
{ | { | ||||
auto reversed = line.reversed(); | auto reversed = line.reversed(); | ||||
@@ -705,8 +704,8 @@ void Path::addArrow (const Line<float>& line, float lineThickness, | |||||
closeSubPath(); | closeSubPath(); | ||||
} | } | ||||
void Path::addPolygon (const Point<float> centre, const int numberOfSides, | |||||
const float radius, const float startAngle) | |||||
void Path::addPolygon (Point<float> centre, int numberOfSides, | |||||
float radius, float startAngle) | |||||
{ | { | ||||
jassert (numberOfSides > 1); // this would be silly. | jassert (numberOfSides > 1); // this would be silly. | ||||
@@ -729,8 +728,8 @@ void Path::addPolygon (const Point<float> centre, const int numberOfSides, | |||||
} | } | ||||
} | } | ||||
void Path::addStar (const Point<float> centre, const int numberOfPoints, | |||||
const float innerRadius, const float outerRadius, const float startAngle) | |||||
void Path::addStar (Point<float> centre, int numberOfPoints, float innerRadius, | |||||
float outerRadius, float startAngle) | |||||
{ | { | ||||
jassert (numberOfPoints > 1); // this would be silly. | jassert (numberOfPoints > 1); // this would be silly. | ||||
@@ -755,9 +754,9 @@ void Path::addStar (const Point<float> centre, const int numberOfPoints, | |||||
} | } | ||||
} | } | ||||
void Path::addBubble (const Rectangle<float>& bodyArea, | |||||
const Rectangle<float>& maximumArea, | |||||
const Point<float> arrowTip, | |||||
void Path::addBubble (Rectangle<float> bodyArea, | |||||
Rectangle<float> maximumArea, | |||||
Point<float> arrowTip, | |||||
const float cornerSize, | const float cornerSize, | ||||
const float arrowBaseWidth) | const float arrowBaseWidth) | ||||
{ | { | ||||
@@ -968,8 +967,8 @@ void Path::applyTransform (const AffineTransform& transform) noexcept | |||||
//============================================================================== | //============================================================================== | ||||
AffineTransform Path::getTransformToScaleToFit (const Rectangle<float>& area, | |||||
bool preserveProportions, Justification justification) const | |||||
AffineTransform Path::getTransformToScaleToFit (Rectangle<float> area, bool preserveProportions, | |||||
Justification justification) const | |||||
{ | { | ||||
return getTransformToScaleToFit (area.getX(), area.getY(), area.getWidth(), area.getHeight(), | return getTransformToScaleToFit (area.getX(), area.getY(), area.getWidth(), area.getHeight(), | ||||
preserveProportions, justification); | preserveProportions, justification); | ||||
@@ -1059,7 +1058,7 @@ bool Path::contains (const float x, const float y, const float tolerance) const | |||||
: ((negativeCrossings + positiveCrossings) & 1) != 0; | : ((negativeCrossings + positiveCrossings) & 1) != 0; | ||||
} | } | ||||
bool Path::contains (const Point<float> point, const float tolerance) const | |||||
bool Path::contains (Point<float> point, const float tolerance) const | |||||
{ | { | ||||
return contains (point.x, point.y, tolerance); | return contains (point.x, point.y, tolerance); | ||||
} | } | ||||
@@ -1138,7 +1137,7 @@ Point<float> Path::getPointAlongPath (float distanceFromStart, | |||||
return { i.x2, i.y2 }; | return { i.x2, i.y2 }; | ||||
} | } | ||||
float Path::getNearestPoint (const Point<float> targetPoint, Point<float>& pointOnPath, | |||||
float Path::getNearestPoint (Point<float> targetPoint, Point<float>& pointOnPath, | |||||
const AffineTransform& transform, | const AffineTransform& transform, | ||||
float tolerance) const | float tolerance) const | ||||
{ | { | ||||
@@ -129,7 +129,7 @@ public: | |||||
@see closeSubPath, setUsingNonZeroWinding | @see closeSubPath, setUsingNonZeroWinding | ||||
*/ | */ | ||||
bool contains (const Point<float> point, | |||||
bool contains (Point<float> point, | |||||
float tolerance = defaultToleranceForTesting) const; | float tolerance = defaultToleranceForTesting) const; | ||||
/** Checks whether a line crosses the path. | /** Checks whether a line crosses the path. | ||||
@@ -211,7 +211,7 @@ public: | |||||
@see lineTo, quadraticTo, cubicTo, closeSubPath | @see lineTo, quadraticTo, cubicTo, closeSubPath | ||||
*/ | */ | ||||
void startNewSubPath (const Point<float> start); | |||||
void startNewSubPath (Point<float> start); | |||||
/** Closes a the current sub-path with a line back to its start-point. | /** Closes a the current sub-path with a line back to its start-point. | ||||
@@ -247,7 +247,7 @@ public: | |||||
@see startNewSubPath, quadraticTo, cubicTo, closeSubPath | @see startNewSubPath, quadraticTo, cubicTo, closeSubPath | ||||
*/ | */ | ||||
void lineTo (const Point<float> end); | |||||
void lineTo (Point<float> end); | |||||
/** Adds a quadratic bezier curve from the shape's last position to a new position. | /** Adds a quadratic bezier curve from the shape's last position to a new position. | ||||
@@ -272,8 +272,8 @@ public: | |||||
@see startNewSubPath, lineTo, cubicTo, closeSubPath | @see startNewSubPath, lineTo, cubicTo, closeSubPath | ||||
*/ | */ | ||||
void quadraticTo (const Point<float> controlPoint, | |||||
const Point<float> endPoint); | |||||
void quadraticTo (Point<float> controlPoint, | |||||
Point<float> endPoint); | |||||
/** Adds a cubic bezier curve from the shape's last position to a new position. | /** Adds a cubic bezier curve from the shape's last position to a new position. | ||||
@@ -300,9 +300,9 @@ public: | |||||
@see startNewSubPath, lineTo, quadraticTo, closeSubPath | @see startNewSubPath, lineTo, quadraticTo, closeSubPath | ||||
*/ | */ | ||||
void cubicTo (const Point<float> controlPoint1, | |||||
const Point<float> controlPoint2, | |||||
const Point<float> endPoint); | |||||
void cubicTo (Point<float> controlPoint1, | |||||
Point<float> controlPoint2, | |||||
Point<float> endPoint); | |||||
/** Returns the last point that was added to the path by one of the drawing methods. | /** Returns the last point that was added to the path by one of the drawing methods. | ||||
*/ | */ | ||||
@@ -320,7 +320,7 @@ public: | |||||
@see addRoundedRectangle, addTriangle | @see addRoundedRectangle, addTriangle | ||||
*/ | */ | ||||
template <typename ValueType> | template <typename ValueType> | ||||
void addRectangle (const Rectangle<ValueType>& rectangle) | |||||
void addRectangle (Rectangle<ValueType> rectangle) | |||||
{ | { | ||||
addRectangle (static_cast<float> (rectangle.getX()), static_cast<float> (rectangle.getY()), | addRectangle (static_cast<float> (rectangle.getX()), static_cast<float> (rectangle.getY()), | ||||
static_cast<float> (rectangle.getWidth()), static_cast<float> (rectangle.getHeight())); | static_cast<float> (rectangle.getWidth()), static_cast<float> (rectangle.getHeight())); | ||||
@@ -355,7 +355,7 @@ public: | |||||
@see addRectangle, addTriangle | @see addRectangle, addTriangle | ||||
*/ | */ | ||||
template <typename ValueType> | template <typename ValueType> | ||||
void addRoundedRectangle (const Rectangle<ValueType>& rectangle, float cornerSizeX, float cornerSizeY) | |||||
void addRoundedRectangle (Rectangle<ValueType> rectangle, float cornerSizeX, float cornerSizeY) | |||||
{ | { | ||||
addRoundedRectangle (static_cast<float> (rectangle.getX()), static_cast<float> (rectangle.getY()), | addRoundedRectangle (static_cast<float> (rectangle.getX()), static_cast<float> (rectangle.getY()), | ||||
static_cast<float> (rectangle.getWidth()), static_cast<float> (rectangle.getHeight()), | static_cast<float> (rectangle.getWidth()), static_cast<float> (rectangle.getHeight()), | ||||
@@ -367,7 +367,7 @@ public: | |||||
@see addRectangle, addTriangle | @see addRectangle, addTriangle | ||||
*/ | */ | ||||
template <typename ValueType> | template <typename ValueType> | ||||
void addRoundedRectangle (const Rectangle<ValueType>& rectangle, float cornerSize) | |||||
void addRoundedRectangle (Rectangle<ValueType> rectangle, float cornerSize) | |||||
{ | { | ||||
addRoundedRectangle (rectangle, cornerSize, cornerSize); | addRoundedRectangle (rectangle, cornerSize, cornerSize); | ||||
} | } | ||||
@@ -534,13 +534,13 @@ public: | |||||
@see addArrow | @see addArrow | ||||
*/ | */ | ||||
void addLineSegment (const Line<float>& line, float lineThickness); | |||||
void addLineSegment (Line<float> line, float lineThickness); | |||||
/** Adds a line with an arrowhead on the end. | /** Adds a line with an arrowhead on the end. | ||||
The arrow is added as a new closed sub-path. (Any currently open paths will be left open). | The arrow is added as a new closed sub-path. (Any currently open paths will be left open). | ||||
@see PathStrokeType::createStrokeWithArrowheads | @see PathStrokeType::createStrokeWithArrowheads | ||||
*/ | */ | ||||
void addArrow (const Line<float>& line, | |||||
void addArrow (Line<float> line, | |||||
float lineThickness, | float lineThickness, | ||||
float arrowheadWidth, | float arrowheadWidth, | ||||
float arrowheadLength); | float arrowheadLength); | ||||
@@ -548,7 +548,7 @@ public: | |||||
/** Adds a polygon shape to the path. | /** Adds a polygon shape to the path. | ||||
@see addStar | @see addStar | ||||
*/ | */ | ||||
void addPolygon (const Point<float> centre, | |||||
void addPolygon (Point<float> centre, | |||||
int numberOfSides, | int numberOfSides, | ||||
float radius, | float radius, | ||||
float startAngle = 0.0f); | float startAngle = 0.0f); | ||||
@@ -556,7 +556,7 @@ public: | |||||
/** Adds a star shape to the path. | /** Adds a star shape to the path. | ||||
@see addPolygon | @see addPolygon | ||||
*/ | */ | ||||
void addStar (const Point<float> centre, | |||||
void addStar (Point<float> centre, | |||||
int numberOfPoints, | int numberOfPoints, | ||||
float innerRadius, | float innerRadius, | ||||
float outerRadius, | float outerRadius, | ||||
@@ -572,8 +572,8 @@ public: | |||||
@param cornerSize the size of the rounded corners | @param cornerSize the size of the rounded corners | ||||
@param arrowBaseWidth the width of the base of the arrow where it joins the main rectangle | @param arrowBaseWidth the width of the base of the arrow where it joins the main rectangle | ||||
*/ | */ | ||||
void addBubble (const Rectangle<float>& bodyArea, | |||||
const Rectangle<float>& maximumArea, | |||||
void addBubble (Rectangle<float> bodyArea, | |||||
Rectangle<float> maximumArea, | |||||
const Point<float> arrowTipPosition, | const Point<float> arrowTipPosition, | ||||
const float cornerSize, | const float cornerSize, | ||||
const float arrowBaseWidth); | const float arrowBaseWidth); | ||||
@@ -677,7 +677,7 @@ public: | |||||
@see applyTransform, scaleToFit | @see applyTransform, scaleToFit | ||||
*/ | */ | ||||
AffineTransform getTransformToScaleToFit (const Rectangle<float>& area, | |||||
AffineTransform getTransformToScaleToFit (Rectangle<float> area, | |||||
bool preserveProportions, | bool preserveProportions, | ||||
Justification justificationType = Justification::centred) const; | Justification justificationType = Justification::centred) const; | ||||
@@ -2295,11 +2295,11 @@ public: | |||||
} | } | ||||
} | } | ||||
void drawLine (const Line<float>& line) | |||||
void drawLine (Line<float> line) | |||||
{ | { | ||||
Path p; | Path p; | ||||
p.addLineSegment (line, 1.0f); | p.addLineSegment (line, 1.0f); | ||||
fillPath (p, AffineTransform()); | |||||
fillPath (p, {}); | |||||
} | } | ||||
void drawImage (const Image& sourceImage, const AffineTransform& trans) | void drawImage (const Image& sourceImage, const AffineTransform& trans) | ||||
@@ -2319,7 +2319,7 @@ public: | |||||
void renderImage (const Image& sourceImage, const AffineTransform& trans, | void renderImage (const Image& sourceImage, const AffineTransform& trans, | ||||
const BaseRegionType* const tiledFillClipRegion) | const BaseRegionType* const tiledFillClipRegion) | ||||
{ | { | ||||
const AffineTransform t (transform.getTransformWith (trans)); | |||||
auto t = transform.getTransformWith (trans); | |||||
const int alpha = fillType.colour.getAlpha(); | const int alpha = fillType.colour.getAlpha(); | ||||
@@ -2356,18 +2356,17 @@ public: | |||||
{ | { | ||||
if (tiledFillClipRegion != nullptr) | if (tiledFillClipRegion != nullptr) | ||||
{ | { | ||||
tiledFillClipRegion->renderImageTransformed (getThis(), sourceImage, alpha, t, interpolationQuality, true); | |||||
tiledFillClipRegion->renderImageTransformed (getThis(), sourceImage, alpha, | |||||
t, interpolationQuality, true); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
Path p; | Path p; | ||||
p.addRectangle (sourceImage.getBounds()); | p.addRectangle (sourceImage.getBounds()); | ||||
typename BaseRegionType::Ptr c (clip->clone()); | |||||
c = c->clipToPath (p, t); | |||||
if (c != nullptr) | |||||
c->renderImageTransformed (getThis(), sourceImage, alpha, t, interpolationQuality, false); | |||||
if (auto c = clip->clone()->clipToPath (p, t)) | |||||
c->renderImageTransformed (getThis(), sourceImage, alpha, | |||||
t, interpolationQuality, false); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -2386,7 +2385,7 @@ public: | |||||
ColourGradient g2 (*(fillType.gradient)); | ColourGradient g2 (*(fillType.gradient)); | ||||
g2.multiplyOpacity (fillType.getOpacity()); | g2.multiplyOpacity (fillType.getOpacity()); | ||||
AffineTransform t (transform.getTransformWith (fillType.transform).translated (-0.5f, -0.5f)); | |||||
auto t = transform.getTransformWith (fillType.transform).translated (-0.5f, -0.5f); | |||||
const bool isIdentity = t.isOnlyTranslation(); | const bool isIdentity = t.isOnlyTranslation(); | ||||