1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00
This commit is contained in:
jules 2007-06-20 15:27:21 +00:00
parent d00a1e4892
commit 76f8b86b99
12 changed files with 160 additions and 159 deletions

View file

@ -37,7 +37,7 @@ BEGIN_JUCE_NAMESPACE
//============================================================================== //==============================================================================
BorderSize::BorderSize() BorderSize::BorderSize() throw()
: top (0), : top (0),
left (0), left (0),
bottom (0), bottom (0),
@ -45,7 +45,7 @@ BorderSize::BorderSize()
{ {
} }
BorderSize::BorderSize (const BorderSize& other) BorderSize::BorderSize (const BorderSize& other) throw()
: top (other.top), : top (other.top),
left (other.left), left (other.left),
bottom (other.bottom), bottom (other.bottom),
@ -56,7 +56,7 @@ BorderSize::BorderSize (const BorderSize& other)
BorderSize::BorderSize (const int topGap, BorderSize::BorderSize (const int topGap,
const int leftGap, const int leftGap,
const int bottomGap, const int bottomGap,
const int rightGap) const int rightGap) throw()
: top (topGap), : top (topGap),
left (leftGap), left (leftGap),
bottom (bottomGap), bottom (bottomGap),
@ -64,7 +64,7 @@ BorderSize::BorderSize (const int topGap,
{ {
} }
BorderSize::BorderSize (const int allGaps) BorderSize::BorderSize (const int allGaps) throw()
: top (allGaps), : top (allGaps),
left (allGaps), left (allGaps),
bottom (allGaps), bottom (allGaps),
@ -72,7 +72,7 @@ BorderSize::BorderSize (const int allGaps)
{ {
} }
BorderSize::~BorderSize() BorderSize::~BorderSize() throw()
{ {
} }

View file

@ -52,22 +52,22 @@ public:
All sizes are left as 0. All sizes are left as 0.
*/ */
BorderSize(); BorderSize() throw();
/** Creates a copy of another border. */ /** Creates a copy of another border. */
BorderSize (const BorderSize& other); BorderSize (const BorderSize& other) throw();
/** Creates a border with the given gaps. */ /** Creates a border with the given gaps. */
BorderSize (const int topGap, BorderSize (const int topGap,
const int leftGap, const int leftGap,
const int bottomGap, const int bottomGap,
const int rightGap); const int rightGap) throw();
/** Creates a border with the given gap on all sides. */ /** Creates a border with the given gap on all sides. */
BorderSize (const int allGaps); BorderSize (const int allGaps) throw();
/** Destructor. */ /** Destructor. */
~BorderSize(); ~BorderSize() throw();
//============================================================================== //==============================================================================
/** Returns the gap that should be left at the top of the region. */ /** Returns the gap that should be left at the top of the region. */

View file

@ -39,12 +39,12 @@ BEGIN_JUCE_NAMESPACE
//============================================================================== //==============================================================================
bool juce_lineIntersection (const float x1, const float y1, static bool juce_lineIntersection (const float x1, const float y1,
const float x2, const float y2, const float x2, const float y2,
const float x3, const float y3, const float x3, const float y3,
const float x4, const float y4, const float x4, const float y4,
float& intersectionX, float& intersectionX,
float& intersectionY) float& intersectionY) throw()
{ {
if (x2 != x3 || y2 != y3) if (x2 != x3 || y2 != y3)
{ {
@ -122,7 +122,7 @@ bool juce_lineIntersection (const float x1, const float y1,
} }
//============================================================================== //==============================================================================
Line::Line() Line::Line() throw()
: startX (0.0f), : startX (0.0f),
startY (0.0f), startY (0.0f),
endX (0.0f), endX (0.0f),
@ -130,7 +130,7 @@ Line::Line()
{ {
} }
Line::Line (const Line& other) Line::Line (const Line& other) throw()
: startX (other.startX), : startX (other.startX),
startY (other.startY), startY (other.startY),
endX (other.endX), endX (other.endX),
@ -139,7 +139,7 @@ Line::Line (const Line& other)
} }
Line::Line (const float startX_, const float startY_, Line::Line (const float startX_, const float startY_,
const float endX_, const float endY_) const float endX_, const float endY_) throw()
: startX (startX_), : startX (startX_),
startY (startY_), startY (startY_),
endX (endX_), endX (endX_),
@ -148,7 +148,7 @@ Line::Line (const float startX_, const float startY_,
} }
Line::Line (const Point& start, Line::Line (const Point& start,
const Point& end) const Point& end) throw()
: startX (start.getX()), : startX (start.getX()),
startY (start.getY()), startY (start.getY()),
endX (end.getX()), endX (end.getX()),
@ -156,7 +156,7 @@ Line::Line (const Point& start,
{ {
} }
const Line& Line::operator= (const Line& other) const Line& Line::operator= (const Line& other) throw()
{ {
startX = other.startX; startX = other.startX;
startY = other.startY; startY = other.startY;
@ -166,42 +166,42 @@ const Line& Line::operator= (const Line& other)
return *this; return *this;
} }
Line::~Line() Line::~Line() throw()
{ {
} }
//============================================================================== //==============================================================================
const Point Line::getStart() const const Point Line::getStart() const throw()
{ {
return Point (startX, startY); return Point (startX, startY);
} }
const Point Line::getEnd() const const Point Line::getEnd() const throw()
{ {
return Point (endX, endY); return Point (endX, endY);
} }
void Line::setStart (const float newStartX, void Line::setStart (const float newStartX,
const float newStartY) const float newStartY) throw()
{ {
startX = newStartX; startX = newStartX;
startY = newStartY; startY = newStartY;
} }
void Line::setStart (const Point& newStart) void Line::setStart (const Point& newStart) throw()
{ {
startX = newStart.getX(); startX = newStart.getX();
startY = newStart.getY(); startY = newStart.getY();
} }
void Line::setEnd (const float newEndX, void Line::setEnd (const float newEndX,
const float newEndY) const float newEndY) throw()
{ {
endX = newEndX; endX = newEndX;
endY = newEndY; endY = newEndY;
} }
void Line::setEnd (const Point& newEnd) void Line::setEnd (const Point& newEnd) throw()
{ {
endX = newEnd.getX(); endX = newEnd.getX();
endY = newEnd.getY(); endY = newEnd.getY();
@ -224,26 +224,26 @@ bool Line::operator!= (const Line& other) const throw()
} }
//============================================================================== //==============================================================================
void Line::applyTransform (const AffineTransform& transform) void Line::applyTransform (const AffineTransform& transform) throw()
{ {
transform.transformPoint (startX, startY); transform.transformPoint (startX, startY);
transform.transformPoint (endX, endY); transform.transformPoint (endX, endY);
} }
//============================================================================== //==============================================================================
float Line::getLength() const float Line::getLength() const throw()
{ {
return (float) juce_hypot (startX - endX, return (float) juce_hypot (startX - endX,
startY - endY); startY - endY);
} }
float Line::getAngle() const float Line::getAngle() const throw()
{ {
return atan2f (endX - startX, return atan2f (endX - startX,
endY - startY); endY - startY);
} }
const Point Line::getPointAlongLine (const float distanceFromStart) const const Point Line::getPointAlongLine (const float distanceFromStart) const throw()
{ {
const float alpha = distanceFromStart / getLength(); const float alpha = distanceFromStart / getLength();
@ -252,7 +252,7 @@ const Point Line::getPointAlongLine (const float distanceFromStart) const
} }
const Point Line::getPointAlongLine (const float offsetX, const Point Line::getPointAlongLine (const float offsetX,
const float offsetY) const const float offsetY) const throw()
{ {
const float dx = endX - startX; const float dx = endX - startX;
const float dy = endY - startY; const float dy = endY - startY;
@ -265,14 +265,14 @@ const Point Line::getPointAlongLine (const float offsetX,
startY + (float) (((dy * offsetX) + (dx * offsetY)) / length)); startY + (float) (((dy * offsetX) + (dx * offsetY)) / length));
} }
const Point Line::getPointAlongLineProportionally (const float alpha) const const Point Line::getPointAlongLineProportionally (const float alpha) const throw()
{ {
return Point (startX + (endX - startX) * alpha, return Point (startX + (endX - startX) * alpha,
startY + (endY - startY) * alpha); startY + (endY - startY) * alpha);
} }
float Line::getDistanceFromLine (const float x, float Line::getDistanceFromLine (const float x,
const float y) const const float y) const throw()
{ {
const double dx = endX - startX; const double dx = endX - startX;
const double dy = endY - startY; const double dy = endY - startY;
@ -294,7 +294,7 @@ float Line::getDistanceFromLine (const float x,
} }
float Line::findNearestPointTo (const float x, float Line::findNearestPointTo (const float x,
const float y) const const float y) const throw()
{ {
const double dx = endX - startX; const double dx = endX - startX;
const double dy = endY - startY; const double dy = endY - startY;
@ -307,7 +307,7 @@ float Line::findNearestPointTo (const float x,
(float) (((x - startX) * dx + (y - startY) * dy) / length)); (float) (((x - startX) * dx + (y - startY) * dy) / length));
} }
const Line Line::withShortenedStart (const float distanceToShortenBy) const const Line Line::withShortenedStart (const float distanceToShortenBy) const throw()
{ {
const float length = getLength(); const float length = getLength();
@ -315,7 +315,7 @@ const Line Line::withShortenedStart (const float distanceToShortenBy) const
getEnd()); getEnd());
} }
const Line Line::withShortenedEnd (const float distanceToShortenBy) const const Line Line::withShortenedEnd (const float distanceToShortenBy) const throw()
{ {
const float length = getLength(); const float length = getLength();
@ -325,7 +325,7 @@ const Line Line::withShortenedEnd (const float distanceToShortenBy) const
//============================================================================== //==============================================================================
bool Line::clipToPath (const Path& path, bool Line::clipToPath (const Path& path,
const bool keepSectionOutsidePath) const bool keepSectionOutsidePath) throw()
{ {
const bool startInside = path.contains (startX, startY); const bool startInside = path.contains (startX, startY);
const bool endInside = path.contains (endX, endY); const bool endInside = path.contains (endX, endY);
@ -382,7 +382,7 @@ bool Line::clipToPath (const Path& path,
//============================================================================== //==============================================================================
bool Line::intersects (const Line& line, bool Line::intersects (const Line& line,
float& intersectionX, float& intersectionX,
float& intersectionY) const float& intersectionY) const throw()
{ {
return juce_lineIntersection (startX, startY, return juce_lineIntersection (startX, startY,
endX, endY, endX, endY,
@ -392,20 +392,21 @@ bool Line::intersects (const Line& line,
intersectionY); intersectionY);
} }
bool Line::isVertical() const bool Line::isVertical() const throw()
{ {
return startX == endX; return startX == endX;
} }
bool Line::isHorizontal() const bool Line::isHorizontal() const throw()
{ {
return startY == endY; return startY == endY;
} }
bool Line::isPointAbove (const float x, const float y) const bool Line::isPointAbove (const float x, const float y) const throw()
{ {
return startX != endX return startX != endX
&& y < ((endY - startY) * (x - startX)) / (endX - startX) + startY; && y < ((endY - startY) * (x - startX)) / (endX - startX) + startY;
} }
END_JUCE_NAMESPACE END_JUCE_NAMESPACE

View file

@ -50,79 +50,79 @@ class JUCE_API Line
public: public:
//============================================================================== //==============================================================================
/** Creates a line, using (0, 0) as its start and end points. */ /** Creates a line, using (0, 0) as its start and end points. */
Line(); Line() throw();
/** Creates a copy of another line. */ /** Creates a copy of another line. */
Line (const Line& other); Line (const Line& other) throw();
/** Creates a line based on the co-ordinates of its start and end points. */ /** Creates a line based on the co-ordinates of its start and end points. */
Line (const float startX, Line (const float startX,
const float startY, const float startY,
const float endX, const float endX,
const float endY); const float endY) throw();
/** Creates a line from its start and end points. */ /** Creates a line from its start and end points. */
Line (const Point& start, Line (const Point& start,
const Point& end); const Point& end) throw();
/** Copies a line from another one. */ /** Copies a line from another one. */
const Line& operator= (const Line& other); const Line& operator= (const Line& other) throw();
/** Destructor. */ /** Destructor. */
~Line(); ~Line() throw();
//============================================================================== //==============================================================================
/** Returns the x co-ordinate of the line's start point. */ /** Returns the x co-ordinate of the line's start point. */
inline float getStartX() const { return startX; } inline float getStartX() const throw() { return startX; }
/** Returns the y co-ordinate of the line's start point. */ /** Returns the y co-ordinate of the line's start point. */
inline float getStartY() const { return startY; } inline float getStartY() const throw() { return startY; }
/** Returns the x co-ordinate of the line's end point. */ /** Returns the x co-ordinate of the line's end point. */
inline float getEndX() const { return endX; } inline float getEndX() const throw() { return endX; }
/** Returns the y co-ordinate of the line's end point. */ /** Returns the y co-ordinate of the line's end point. */
inline float getEndY() const { return endY; } inline float getEndY() const throw() { return endY; }
/** Returns the line's start point. */ /** Returns the line's start point. */
const Point getStart() const; const Point getStart() const throw();
/** Returns the line's end point. */ /** Returns the line's end point. */
const Point getEnd() const; const Point getEnd() const throw();
/** Changes this line's start point */ /** Changes this line's start point */
void setStart (const float newStartX, void setStart (const float newStartX,
const float newStartY); const float newStartY) throw();
/** Changes this line's end point */ /** Changes this line's end point */
void setEnd (const float newEndX, void setEnd (const float newEndX,
const float newEndY); const float newEndY) throw();
/** Changes this line's start point */ /** Changes this line's start point */
void setStart (const Point& newStart); void setStart (const Point& newStart) throw();
/** Changes this line's end point */ /** Changes this line's end point */
void setEnd (const Point& newEnd); void setEnd (const Point& newEnd) throw();
/** Applies an affine transform to the line's start and end points. */ /** Applies an affine transform to the line's start and end points. */
void applyTransform (const AffineTransform& transform); void applyTransform (const AffineTransform& transform) throw();
//============================================================================== //==============================================================================
/** Returns the length of the line. */ /** Returns the length of the line. */
float getLength() const; float getLength() const throw();
/** Returns true if the line's start and end x co-ordinates are the same. */ /** Returns true if the line's start and end x co-ordinates are the same. */
bool isVertical() const; bool isVertical() const throw();
/** Returns true if the line's start and end y co-ordinates are the same. */ /** Returns true if the line's start and end y co-ordinates are the same. */
bool isHorizontal() const; bool isHorizontal() const throw();
/** Returns the line's angle. /** Returns the line's angle.
This value is the number of radians clockwise from the 3 o'clock direction, This value is the number of radians clockwise from the 3 o'clock direction,
where the line's start point is considered to be at the centre. where the line's start point is considered to be at the centre.
*/ */
float getAngle() const; float getAngle() const throw();
//============================================================================== //==============================================================================
/** Compares two lines. */ /** Compares two lines. */
@ -147,7 +147,7 @@ public:
*/ */
bool intersects (const Line& line, bool intersects (const Line& line,
float& intersectionX, float& intersectionX,
float& intersectionY) const; float& intersectionY) const throw();
//============================================================================== //==============================================================================
/** Returns the location of the point which is a given distance along this line. /** Returns the location of the point which is a given distance along this line.
@ -157,7 +157,7 @@ public:
than the line itself than the line itself
@see getPointAlongLineProportionally @see getPointAlongLineProportionally
*/ */
const Point getPointAlongLine (const float distanceFromStart) const; const Point getPointAlongLine (const float distanceFromStart) const throw();
/** Returns a point which is a certain distance along and to the side of this line. /** Returns a point which is a certain distance along and to the side of this line.
@ -173,7 +173,7 @@ public:
right, negative value move to the left. right, negative value move to the left.
*/ */
const Point getPointAlongLine (const float distanceFromStart, const Point getPointAlongLine (const float distanceFromStart,
const float perpendicularDistance) const; const float perpendicularDistance) const throw();
/** Returns the location of the point which is a given distance along this line /** Returns the location of the point which is a given distance along this line
proportional to the line's length. proportional to the line's length.
@ -185,7 +185,7 @@ public:
can be negative or greater than 1.0). can be negative or greater than 1.0).
@see getPointAlongLine @see getPointAlongLine
*/ */
const Point getPointAlongLineProportionally (const float proportionOfLength) const; const Point getPointAlongLineProportionally (const float proportionOfLength) const throw();
/** Returns the smallest distance between this line segment and a given point. /** Returns the smallest distance between this line segment and a given point.
@ -199,7 +199,7 @@ public:
@see getPositionAlongLineOfNearestPoint @see getPositionAlongLineOfNearestPoint
*/ */
float getDistanceFromLine (const float x, float getDistanceFromLine (const float x,
const float y) const; const float y) const throw();
/** Finds the point on this line which is nearest to a given point, and /** Finds the point on this line which is nearest to a given point, and
returns its position as a proportional position along the line. returns its position as a proportional position along the line.
@ -212,7 +212,7 @@ public:
@see getDistanceFromLine, getPointAlongLineProportionally @see getDistanceFromLine, getPointAlongLineProportionally
*/ */
float findNearestPointTo (const float x, float findNearestPointTo (const float x,
const float y) const; const float y) const throw();
/** Returns true if the given point lies above this line. /** Returns true if the given point lies above this line.
@ -220,7 +220,7 @@ public:
coordinate of this line at the given x (assuming the line extends infinitely coordinate of this line at the given x (assuming the line extends infinitely
in both directions). in both directions).
*/ */
bool isPointAbove (const float x, const float y) const; bool isPointAbove (const float x, const float y) const throw();
//============================================================================== //==============================================================================
/** Returns a shortened copy of this line. /** Returns a shortened copy of this line.
@ -228,14 +228,14 @@ public:
This will chop off part of the start of this line by a certain amount, (leaving the This will chop off part of the start of this line by a certain amount, (leaving the
end-point the same), and return the new line. end-point the same), and return the new line.
*/ */
const Line withShortenedStart (const float distanceToShortenBy) const; const Line withShortenedStart (const float distanceToShortenBy) const throw();
/** Returns a shortened copy of this line. /** Returns a shortened copy of this line.
This will chop off part of the end of this line by a certain amount, (leaving the This will chop off part of the end of this line by a certain amount, (leaving the
start-point the same), and return the new line. start-point the same), and return the new line.
*/ */
const Line withShortenedEnd (const float distanceToShortenBy) const; const Line withShortenedEnd (const float distanceToShortenBy) const throw();
/** Cuts off parts of this line to keep the parts that are either inside or /** Cuts off parts of this line to keep the parts that are either inside or
outside a path. outside a path.
@ -251,7 +251,7 @@ public:
@returns true if the line was changed. @returns true if the line was changed.
*/ */
bool clipToPath (const Path& path, bool clipToPath (const Path& path,
const bool keepSectionOutsidePath); const bool keepSectionOutsidePath) throw();
//============================================================================== //==============================================================================

View file

@ -51,7 +51,7 @@ static const float closePathMarker = 100005.0f;
//============================================================================== //==============================================================================
PathFlatteningIterator::PathFlatteningIterator (const Path& path_, PathFlatteningIterator::PathFlatteningIterator (const Path& path_,
const AffineTransform& transform_, const AffineTransform& transform_,
float tolerence_) float tolerence_) throw()
: x2 (0), : x2 (0),
y2 (0), y2 (0),
closesSubPath (false), closesSubPath (false),
@ -70,12 +70,12 @@ PathFlatteningIterator::PathFlatteningIterator (const Path& path_,
stackPos = stackBase; stackPos = stackBase;
} }
PathFlatteningIterator::~PathFlatteningIterator() PathFlatteningIterator::~PathFlatteningIterator() throw()
{ {
juce_free (stackBase); juce_free (stackBase);
} }
bool PathFlatteningIterator::next() bool PathFlatteningIterator::next() throw()
{ {
x1 = x2; x1 = x2;
y1 = y2; y1 = y2;

View file

@ -62,10 +62,10 @@ public:
*/ */
PathFlatteningIterator (const Path& path, PathFlatteningIterator (const Path& path,
const AffineTransform& transform = AffineTransform::identity, const AffineTransform& transform = AffineTransform::identity,
float tolerence = 9.0f); float tolerence = 9.0f) throw();
/** Destructor. */ /** Destructor. */
~PathFlatteningIterator(); ~PathFlatteningIterator() throw();
//============================================================================== //==============================================================================
/** Fetches the next line segment from the path. /** Fetches the next line segment from the path.
@ -75,7 +75,7 @@ public:
@returns false when there are no more lines to fetch. @returns false when there are no more lines to fetch.
*/ */
bool next(); bool next() throw();
/** The x position of the start of the current line segment. */ /** The x position of the start of the current line segment. */
float x1; float x1;

View file

@ -38,19 +38,19 @@ BEGIN_JUCE_NAMESPACE
//============================================================================== //==============================================================================
Point::Point() Point::Point() throw()
: x (0.0f), : x (0.0f),
y (0.0f) y (0.0f)
{ {
} }
Point::Point (const Point& other) Point::Point (const Point& other) throw()
: x (other.x), : x (other.x),
y (other.y) y (other.y)
{ {
} }
const Point& Point::operator= (const Point& other) const Point& Point::operator= (const Point& other) throw()
{ {
x = other.x; x = other.x;
y = other.y; y = other.y;
@ -59,24 +59,24 @@ const Point& Point::operator= (const Point& other)
} }
Point::Point (const float x_, Point::Point (const float x_,
const float y_) const float y_) throw()
: x (x_), : x (x_),
y (y_) y (y_)
{ {
} }
Point::~Point() Point::~Point() throw()
{ {
} }
void Point::setXY (const float x_, void Point::setXY (const float x_,
const float y_) const float y_) throw()
{ {
x = x_; x = x_;
y = y_; y = y_;
} }
void Point::applyTransform (const AffineTransform& transform) void Point::applyTransform (const AffineTransform& transform) throw()
{ {
transform.transformPoint (x, y); transform.transformPoint (x, y);
} }

View file

@ -48,38 +48,38 @@ class JUCE_API Point
public: public:
//============================================================================== //==============================================================================
/** Creates a point with co-ordinates (0, 0). */ /** Creates a point with co-ordinates (0, 0). */
Point(); Point() throw();
/** Creates a copy of another point. */ /** Creates a copy of another point. */
Point (const Point& other); Point (const Point& other) throw();
/** Creates a point from an (x, y) position. */ /** Creates a point from an (x, y) position. */
Point (const float x, const float y); Point (const float x, const float y) throw();
/** Copies this point from another one. /** Copies this point from another one.
@see setXY @see setXY
*/ */
const Point& operator= (const Point& other); const Point& operator= (const Point& other) throw();
/** Destructor. */ /** Destructor. */
~Point(); ~Point() throw();
//============================================================================== //==============================================================================
/** Returns the point's x co-ordinate. */ /** Returns the point's x co-ordinate. */
inline float getX() const { return x; } inline float getX() const throw() { return x; }
/** Returns the point's y co-ordinate. */ /** Returns the point's y co-ordinate. */
inline float getY() const { return y; } inline float getY() const throw() { return y; }
/** Changes the point's x and y co-ordinates. */ /** Changes the point's x and y co-ordinates. */
void setXY (const float x, void setXY (const float x,
const float y); const float y) throw();
/** Uses a transform to change the point's co-ordinates. /** Uses a transform to change the point's co-ordinates.
@see AffineTransform::transformPoint @see AffineTransform::transformPoint
*/ */
void applyTransform (const AffineTransform& transform); void applyTransform (const AffineTransform& transform) throw();
//============================================================================== //==============================================================================

View file

@ -42,18 +42,18 @@ RectangleList::RectangleList() throw()
{ {
} }
RectangleList::RectangleList (const Rectangle& rect) RectangleList::RectangleList (const Rectangle& rect) throw()
{ {
if (! rect.isEmpty()) if (! rect.isEmpty())
rects.add (rect); rects.add (rect);
} }
RectangleList::RectangleList (const RectangleList& other) RectangleList::RectangleList (const RectangleList& other) throw()
: rects (other.rects) : rects (other.rects)
{ {
} }
const RectangleList& RectangleList::operator= (const RectangleList& other) const RectangleList& RectangleList::operator= (const RectangleList& other) throw()
{ {
if (this != &other) if (this != &other)
rects = other.rects; rects = other.rects;
@ -66,7 +66,7 @@ RectangleList::~RectangleList() throw()
} }
//============================================================================== //==============================================================================
void RectangleList::clear() void RectangleList::clear() throw()
{ {
rects.clearQuick(); rects.clearQuick();
} }
@ -85,17 +85,17 @@ bool RectangleList::isEmpty() const throw()
} }
//============================================================================== //==============================================================================
RectangleList::Iterator::Iterator (const RectangleList& list) RectangleList::Iterator::Iterator (const RectangleList& list) throw()
: owner (list), : owner (list),
index (list.rects.size()) index (list.rects.size())
{ {
} }
RectangleList::Iterator::~Iterator() RectangleList::Iterator::~Iterator() throw()
{ {
} }
bool RectangleList::Iterator::next() bool RectangleList::Iterator::next() throw()
{ {
if (--index >= 0) if (--index >= 0)
{ {
@ -108,7 +108,7 @@ bool RectangleList::Iterator::next()
//============================================================================== //==============================================================================
void RectangleList::add (const Rectangle& rect) void RectangleList::add (const Rectangle& rect) throw()
{ {
if (! rect.isEmpty()) if (! rect.isEmpty())
{ {
@ -162,12 +162,12 @@ void RectangleList::add (const Rectangle& rect)
} }
} }
void RectangleList::addWithoutMerging (const Rectangle& rect) void RectangleList::addWithoutMerging (const Rectangle& rect) throw()
{ {
rects.add (rect); rects.add (rect);
} }
void RectangleList::add (const int x, const int y, const int w, const int h) void RectangleList::add (const int x, const int y, const int w, const int h) throw()
{ {
if (rects.size() == 0) if (rects.size() == 0)
{ {
@ -180,13 +180,13 @@ void RectangleList::add (const int x, const int y, const int w, const int h)
} }
} }
void RectangleList::add (const RectangleList& other) void RectangleList::add (const RectangleList& other) throw()
{ {
for (int i = 0; i < other.rects.size(); ++i) for (int i = 0; i < other.rects.size(); ++i)
add (other.rects.getReference (i)); add (other.rects.getReference (i));
} }
void RectangleList::subtract (const Rectangle& rect) void RectangleList::subtract (const Rectangle& rect) throw()
{ {
const int originalNumRects = rects.size(); const int originalNumRects = rects.size();
@ -272,13 +272,13 @@ void RectangleList::subtract (const Rectangle& rect)
} }
} }
void RectangleList::subtract (const RectangleList& otherList) void RectangleList::subtract (const RectangleList& otherList) throw()
{ {
for (int i = otherList.rects.size(); --i >= 0;) for (int i = otherList.rects.size(); --i >= 0;)
subtract (otherList.rects.getReference (i)); subtract (otherList.rects.getReference (i));
} }
bool RectangleList::clipTo (const Rectangle& rect) bool RectangleList::clipTo (const Rectangle& rect) throw()
{ {
bool notEmpty = false; bool notEmpty = false;
@ -302,7 +302,7 @@ bool RectangleList::clipTo (const Rectangle& rect)
return notEmpty; return notEmpty;
} }
bool RectangleList::clipTo (const RectangleList& other) bool RectangleList::clipTo (const RectangleList& other) throw()
{ {
if (rects.size() == 0) if (rects.size() == 0)
return false; return false;
@ -327,7 +327,7 @@ bool RectangleList::clipTo (const RectangleList& other)
return ! isEmpty(); return ! isEmpty();
} }
bool RectangleList::getIntersectionWith (const Rectangle& rect, RectangleList& destRegion) const bool RectangleList::getIntersectionWith (const Rectangle& rect, RectangleList& destRegion) const throw()
{ {
destRegion.clear(); destRegion.clear();
@ -345,14 +345,14 @@ bool RectangleList::getIntersectionWith (const Rectangle& rect, RectangleList& d
return destRegion.rects.size() > 0; return destRegion.rects.size() > 0;
} }
void RectangleList::swapWith (RectangleList& otherList) void RectangleList::swapWith (RectangleList& otherList) throw()
{ {
rects.swapWithArray (otherList.rects); rects.swapWithArray (otherList.rects);
} }
//============================================================================== //==============================================================================
void RectangleList::consolidate() void RectangleList::consolidate() throw()
{ {
int i; int i;
for (i = 0; i < getNumRectangles() - 1; ++i) for (i = 0; i < getNumRectangles() - 1; ++i)
@ -425,7 +425,7 @@ void RectangleList::consolidate()
} }
//============================================================================== //==============================================================================
bool RectangleList::containsPoint (const int x, const int y) const bool RectangleList::containsPoint (const int x, const int y) const throw()
{ {
for (int i = getNumRectangles(); --i >= 0;) for (int i = getNumRectangles(); --i >= 0;)
if (rects.getReference (i).contains (x, y)) if (rects.getReference (i).contains (x, y))
@ -434,7 +434,7 @@ bool RectangleList::containsPoint (const int x, const int y) const
return false; return false;
} }
bool RectangleList::containsRectangle (const Rectangle& rectangleToCheck) const bool RectangleList::containsRectangle (const Rectangle& rectangleToCheck) const throw()
{ {
if (rects.size() > 1) if (rects.size() > 1)
{ {
@ -456,7 +456,7 @@ bool RectangleList::containsRectangle (const Rectangle& rectangleToCheck) const
return false; return false;
} }
bool RectangleList::intersectsRectangle (const Rectangle& rectangleToCheck) const bool RectangleList::intersectsRectangle (const Rectangle& rectangleToCheck) const throw()
{ {
for (int i = rects.size(); --i >= 0;) for (int i = rects.size(); --i >= 0;)
if (rects.getReference (i).intersects (rectangleToCheck)) if (rects.getReference (i).intersects (rectangleToCheck))
@ -465,7 +465,7 @@ bool RectangleList::intersectsRectangle (const Rectangle& rectangleToCheck) cons
return false; return false;
} }
bool RectangleList::intersects (const RectangleList& other) const bool RectangleList::intersects (const RectangleList& other) const throw()
{ {
for (int i = rects.size(); --i >= 0;) for (int i = rects.size(); --i >= 0;)
if (other.intersectsRectangle (rects.getReference (i))) if (other.intersectsRectangle (rects.getReference (i)))
@ -474,7 +474,7 @@ bool RectangleList::intersects (const RectangleList& other) const
return false; return false;
} }
const Rectangle RectangleList::getBounds() const const Rectangle RectangleList::getBounds() const throw()
{ {
if (rects.size() <= 1) if (rects.size() <= 1)
{ {
@ -506,7 +506,7 @@ const Rectangle RectangleList::getBounds() const
} }
} }
void RectangleList::offsetAll (const int dx, const int dy) void RectangleList::offsetAll (const int dx, const int dy) throw()
{ {
for (int i = rects.size(); --i >= 0;) for (int i = rects.size(); --i >= 0;)
{ {
@ -518,7 +518,7 @@ void RectangleList::offsetAll (const int dx, const int dy)
} }
//============================================================================== //==============================================================================
const Path RectangleList::toPath() const const Path RectangleList::toPath() const throw()
{ {
Path p; Path p;

View file

@ -54,13 +54,13 @@ public:
RectangleList() throw(); RectangleList() throw();
/** Creates a copy of another list */ /** Creates a copy of another list */
RectangleList (const RectangleList& other); RectangleList (const RectangleList& other) throw();
/** Creates a list containing just one rectangle. */ /** Creates a list containing just one rectangle. */
RectangleList (const Rectangle& rect); RectangleList (const Rectangle& rect) throw();
/** Copies this list from another one. */ /** Copies this list from another one. */
const RectangleList& operator= (const RectangleList& other); const RectangleList& operator= (const RectangleList& other) throw();
/** Destructor. */ /** Destructor. */
~RectangleList() throw(); ~RectangleList() throw();
@ -82,7 +82,7 @@ public:
//============================================================================== //==============================================================================
/** Removes all rectangles to leave an empty region. */ /** Removes all rectangles to leave an empty region. */
void clear(); void clear() throw();
/** Merges a new rectangle into the list. /** Merges a new rectangle into the list.
@ -90,7 +90,7 @@ public:
that overlap existing rectangles in the list. that overlap existing rectangles in the list.
*/ */
void add (const int x, const int y, void add (const int x, const int y,
const int w, const int h); const int w, const int h) throw();
/** Merges a new rectangle into the list. /** Merges a new rectangle into the list.
@ -98,35 +98,35 @@ public:
that overlap existing rectangles in the list, and adjacent rectangles will be that overlap existing rectangles in the list, and adjacent rectangles will be
merged into it. merged into it.
*/ */
void add (const Rectangle& rect); void add (const Rectangle& rect) throw();
/** Dumbly adds a rectangle to the list without checking for overlaps. /** Dumbly adds a rectangle to the list without checking for overlaps.
This simply adds the rectangle to the end, it doesn't merge it or remove This simply adds the rectangle to the end, it doesn't merge it or remove
any overlapping bits. any overlapping bits.
*/ */
void addWithoutMerging (const Rectangle& rect); void addWithoutMerging (const Rectangle& rect) throw();
/** Merges another rectangle list into this one. /** Merges another rectangle list into this one.
Any overlaps between the two lists will be clipped, so that the result is Any overlaps between the two lists will be clipped, so that the result is
the union of both lists. the union of both lists.
*/ */
void add (const RectangleList& other); void add (const RectangleList& other) throw();
/** Removes a rectangular region from the list. /** Removes a rectangular region from the list.
Any rectangles in the list which overlap this will be clipped and subdivided Any rectangles in the list which overlap this will be clipped and subdivided
if necessary. if necessary.
*/ */
void subtract (const Rectangle& rect); void subtract (const Rectangle& rect) throw();
/** Removes all areas in another RectangleList from this one. /** Removes all areas in another RectangleList from this one.
Any rectangles in the list which overlap this will be clipped and subdivided Any rectangles in the list which overlap this will be clipped and subdivided
if necessary. if necessary.
*/ */
void subtract (const RectangleList& otherList); void subtract (const RectangleList& otherList) throw();
/** Removes any areas of the region that lie outside a given rectangle. /** Removes any areas of the region that lie outside a given rectangle.
@ -137,7 +137,7 @@ public:
@see getIntersectionWith @see getIntersectionWith
*/ */
bool clipTo (const Rectangle& rect); bool clipTo (const Rectangle& rect) throw();
/** Removes any areas of the region that lie outside a given rectangle list. /** Removes any areas of the region that lie outside a given rectangle list.
@ -148,7 +148,7 @@ public:
@see getIntersectionWith @see getIntersectionWith
*/ */
bool clipTo (const RectangleList& other); bool clipTo (const RectangleList& other) throw();
/** Creates a region which is the result of clipping this one to a given rectangle. /** Creates a region which is the result of clipping this one to a given rectangle.
@ -159,21 +159,21 @@ public:
@see clipTo @see clipTo
*/ */
bool getIntersectionWith (const Rectangle& rect, RectangleList& destRegion) const; bool getIntersectionWith (const Rectangle& rect, RectangleList& destRegion) const throw();
/** Swaps the contents of this and another list. /** Swaps the contents of this and another list.
This swaps their internal pointers, so is hugely faster than using copy-by-value This swaps their internal pointers, so is hugely faster than using copy-by-value
to swap them. to swap them.
*/ */
void swapWith (RectangleList& otherList); void swapWith (RectangleList& otherList) throw();
//============================================================================== //==============================================================================
/** Checks whether the region contains a given point. /** Checks whether the region contains a given point.
@returns true if the point lies within one of the rectangles in the list @returns true if the point lies within one of the rectangles in the list
*/ */
bool containsPoint (const int x, const int y) const; bool containsPoint (const int x, const int y) const throw();
/** Checks whether the region contains the whole of a given rectangle. /** Checks whether the region contains the whole of a given rectangle.
@ -181,7 +181,7 @@ public:
defined by this object defined by this object
@see intersectsRectangle, containsPoint @see intersectsRectangle, containsPoint
*/ */
bool containsRectangle (const Rectangle& rectangleToCheck) const; bool containsRectangle (const Rectangle& rectangleToCheck) const throw();
/** Checks whether the region contains any part of a given rectangle. /** Checks whether the region contains any part of a given rectangle.
@ -189,17 +189,17 @@ public:
defined by this object defined by this object
@see containsRectangle @see containsRectangle
*/ */
bool intersectsRectangle (const Rectangle& rectangleToCheck) const; bool intersectsRectangle (const Rectangle& rectangleToCheck) const throw();
/** Checks whether this region intersects any part of another one. /** Checks whether this region intersects any part of another one.
@see intersectsRectangle @see intersectsRectangle
*/ */
bool intersects (const RectangleList& other) const; bool intersects (const RectangleList& other) const throw();
//============================================================================== //==============================================================================
/** Returns the smallest rectangle that can enclose the whole of this region. */ /** Returns the smallest rectangle that can enclose the whole of this region. */
const Rectangle getBounds() const; const Rectangle getBounds() const throw();
/** Optimises the list into a minimum number of constituent rectangles. /** Optimises the list into a minimum number of constituent rectangles.
@ -207,14 +207,14 @@ public:
possible, to simplify lists that might have been fragmented by repeated possible, to simplify lists that might have been fragmented by repeated
add/subtract calls. add/subtract calls.
*/ */
void consolidate(); void consolidate() throw();
/** Adds an x and y value to all the co-ordinates. */ /** Adds an x and y value to all the co-ordinates. */
void offsetAll (const int dx, const int dy); void offsetAll (const int dx, const int dy) throw();
//============================================================================== //==============================================================================
/** Creates a Path object to represent this region. */ /** Creates a Path object to represent this region. */
const Path toPath() const; const Path toPath() const throw();
//============================================================================== //==============================================================================
@ -223,15 +223,15 @@ public:
{ {
public: public:
//============================================================================== //==============================================================================
Iterator (const RectangleList& list); Iterator (const RectangleList& list) throw();
~Iterator(); ~Iterator() throw();
//============================================================================== //==============================================================================
/** Advances to the next rectangle, and returns true if it's not finished. /** Advances to the next rectangle, and returns true if it's not finished.
Call this before using getRectangle() to find the rectangle that was returned. Call this before using getRectangle() to find the rectangle that was returned.
*/ */
bool next(); bool next() throw();
/** Returns the current rectangle. */ /** Returns the current rectangle. */
const Rectangle& getRectangle() const throw() { return current; } const Rectangle& getRectangle() const throw() { return current; }

View file

@ -37,7 +37,7 @@ BEGIN_JUCE_NAMESPACE
//============================================================================== //==============================================================================
ImageConvolutionKernel::ImageConvolutionKernel (const int size_) ImageConvolutionKernel::ImageConvolutionKernel (const int size_) throw()
: size (size_) : size (size_)
{ {
values = new float* [size]; values = new float* [size];
@ -48,7 +48,7 @@ ImageConvolutionKernel::ImageConvolutionKernel (const int size_)
clear(); clear();
} }
ImageConvolutionKernel::~ImageConvolutionKernel() ImageConvolutionKernel::~ImageConvolutionKernel() throw()
{ {
for (int i = size; --i >= 0;) for (int i = size; --i >= 0;)
delete[] values[i]; delete[] values[i];
@ -59,7 +59,7 @@ ImageConvolutionKernel::~ImageConvolutionKernel()
//============================================================================== //==============================================================================
void ImageConvolutionKernel::setKernelValue (const int x, void ImageConvolutionKernel::setKernelValue (const int x,
const int y, const int y,
const float value) const float value) throw()
{ {
if (x >= 0 && x < size if (x >= 0 && x < size
&& y >= 0 && y < size) && y >= 0 && y < size)
@ -72,14 +72,14 @@ void ImageConvolutionKernel::setKernelValue (const int x,
} }
} }
void ImageConvolutionKernel::clear() void ImageConvolutionKernel::clear() throw()
{ {
for (int y = size; --y >= 0;) for (int y = size; --y >= 0;)
for (int x = size; --x >= 0;) for (int x = size; --x >= 0;)
values[x][y] = 0; values[x][y] = 0;
} }
void ImageConvolutionKernel::setOverallSum (const float desiredTotalSum) void ImageConvolutionKernel::setOverallSum (const float desiredTotalSum) throw()
{ {
double currentTotal = 0.0; double currentTotal = 0.0;
@ -90,7 +90,7 @@ void ImageConvolutionKernel::setOverallSum (const float desiredTotalSum)
rescaleAllValues ((float) (desiredTotalSum / currentTotal)); rescaleAllValues ((float) (desiredTotalSum / currentTotal));
} }
void ImageConvolutionKernel::rescaleAllValues (const float multiplier) void ImageConvolutionKernel::rescaleAllValues (const float multiplier) throw()
{ {
for (int y = size; --y >= 0;) for (int y = size; --y >= 0;)
for (int x = size; --x >= 0;) for (int x = size; --x >= 0;)
@ -98,7 +98,7 @@ void ImageConvolutionKernel::rescaleAllValues (const float multiplier)
} }
//============================================================================== //==============================================================================
void ImageConvolutionKernel::createGaussianBlur (const float radius) void ImageConvolutionKernel::createGaussianBlur (const float radius) throw()
{ {
const double radiusFactor = -1.0 / (radius * radius * 2); const double radiusFactor = -1.0 / (radius * radius * 2);
const int centre = size >> 1; const int centre = size >> 1;

View file

@ -50,10 +50,10 @@ public:
@param size the length of each dimension of the kernel, so e.g. if the size @param size the length of each dimension of the kernel, so e.g. if the size
is 5, it will create a 5x5 kernel is 5, it will create a 5x5 kernel
*/ */
ImageConvolutionKernel (const int size); ImageConvolutionKernel (const int size) throw();
/** Destructor. */ /** Destructor. */
~ImageConvolutionKernel(); ~ImageConvolutionKernel() throw();
//============================================================================== //==============================================================================
/** Resets all values in the kernel to zero. /** Resets all values in the kernel to zero.
@ -68,16 +68,16 @@ public:
*/ */
void setKernelValue (const int x, void setKernelValue (const int x,
const int y, const int y,
const float value); const float value) throw();
/** Rescales all values in the kernel to make the total add up to a fixed value. /** Rescales all values in the kernel to make the total add up to a fixed value.
This will multiply all values in the kernel by (desiredTotalSum / currentTotalSum). This will multiply all values in the kernel by (desiredTotalSum / currentTotalSum).
*/ */
void setOverallSum (const float desiredTotalSum); void setOverallSum (const float desiredTotalSum) throw();
/** Multiplies all values in the kernel by a value. */ /** Multiplies all values in the kernel by a value. */
void rescaleAllValues (const float multiplier); void rescaleAllValues (const float multiplier) throw();
/** Intialises the kernel for a gaussian blur. /** Intialises the kernel for a gaussian blur.
@ -86,7 +86,7 @@ public:
edges. Ideally the kernel should be just larger than edges. Ideally the kernel should be just larger than
(blurRadius * 2). (blurRadius * 2).
*/ */
void createGaussianBlur (const float blurRadius); void createGaussianBlur (const float blurRadius) throw();
//============================================================================== //==============================================================================
/** Returns the size of the kernel. /** Returns the size of the kernel.