skia2/docs/SkRect_Reference.bmh
Cary Clark bc5697d3b1 starting next gaggle of docs
starting next gaggle of docs

Docs-Preview: https://skia.org/?cl=50264
Bug: skia:6898
Change-Id: I639795b55c0c96b2efccac13cb67592f055a75a2
Reviewed-on: https://skia-review.googlesource.com/50264
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
2017-10-04 18:50:33 +00:00

1321 lines
22 KiB
Plaintext

#Topic Rect
#Alias Rects
#Alias Rect_Reference
#Struct SkRect
#Topic Overview
#Subtopic Subtopics
#ToDo manually add subtopics ##
#Table
#Legend
# topics # description ##
#Legend ##
#Table ##
##
#Subtopic Operators
#Table
#Legend
# description # function ##
#Legend ##
# friend bool operator!=(const SkRect& a, const SkRect& b) # ##
# friend bool operator==(const SkRect& a, const SkRect& b) # ##
#Table ##
#Subtopic ##
#Subtopic Member_Functions
#Table
#Legend
# description # function ##
#Legend ##
# Make # ##
# MakeEmpty # ##
# MakeFromIRect # ##
# MakeIWH # ##
# MakeLTRB # ##
# MakeLargest # ##
# MakeSize # ##
# MakeWH # ##
# MakeXYWH # ##
# bottom # ##
# centerX # ##
# centerY # ##
# height # ##
# inset # ##
# intersect # ##
# isEmpty # ##
# isFinite # ##
# isLargest # ##
# isSorted # ##
# iset # ##
# isetWH # ##
# left # ##
# makeInset # ##
# makeOffset # ##
# makeOutset # ##
# offset # ##
# offsetTo # ##
# outset # ##
# right # ##
# set # ##
# setBounds # ##
# setBoundsCheck # ##
# setEmpty # ##
# setLTRB # ##
# setLargest # ##
# setLargestInverted # ##
# setWH # ##
# setXYWH # ##
# toQuad # ##
# top # ##
# width # ##
# x # ##
# y # ##
#Table ##
#Subtopic ##
#Topic ##
#Member SkScalar fLeft
##
#Member SkScalar fTop
##
#Member SkScalar fRight
##
#Member SkScalar fBottom
##
# ------------------------------------------------------------------------------
#Method static constexpr SkRect SK_WARN_UNUSED_RESULT MakeEmpty()
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method static SkRect SK_WARN_UNUSED_RESULT MakeLargest()
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method static SkRect SK_WARN_UNUSED_RESULT MakeWH(SkScalar w, SkScalar h)
#Param w incomplete ##
#Param h incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method static SkRect SK_WARN_UNUSED_RESULT MakeIWH(int w, int h)
#Param w incomplete ##
#Param h incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method static SkRect SK_WARN_UNUSED_RESULT MakeSize(const SkSize& size)
#Param size incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method static constexpr SkRect SK_WARN_UNUSED_RESULT MakeLTRB(SkScalar l, SkScalar t, SkScalar r,
SkScalar b)
#Param l incomplete ##
#Param t incomplete ##
#Param r incomplete ##
#Param b incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method static SkRect SK_WARN_UNUSED_RESULT MakeXYWH(SkScalar x, SkScalar y, SkScalar w, SkScalar h)
#Param x incomplete ##
#Param y incomplete ##
#Param w incomplete ##
#Param h incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method static SkRect SK_WARN_UNUSED_RESULT MakeFromIRect(const SkIRect& irect)
#Param irect incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method static SkRect Make(const SkISize& size)
#Param size incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method static SkRect SK_WARN_UNUSED_RESULT Make(const SkIRect& irect)
#Param irect incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method bool isEmpty() const
Return true if the rectangle width or height are <= 0
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method bool isSorted() const
Return true if the rectangle width and height are >= 0
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method bool isLargest() const
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method bool isFinite() const
Returns true if and only if all values in the rectangle are finite. If any are
infinite or NaN then this returns false.
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method SkScalar x() const
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method SkScalar y() const
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method SkScalar left() const
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method SkScalar top() const
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method SkScalar right() const
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method SkScalar bottom() const
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method SkScalar width() const
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method SkScalar height() const
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method SkScalar centerX() const
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method SkScalar centerY() const
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method friend bool operator==(const SkRect& a, const SkRect& b)
#Param a incomplete ##
#Param b incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method friend bool operator!=(const SkRect& a, const SkRect& b)
#Param a incomplete ##
#Param b incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method void toQuad(SkPoint quad[4]) const
return the 4 points that enclose the rectangle (top-left, top-right, bottom-right,
bottom-left).
#ToDo
Consider adding param to control whether quad is CW or CCW.
##
#Param quad incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method void setEmpty()
Set this rectangle to the empty rectangle (0,0,0,0)
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method void set(const SkIRect& src)
#Param src incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method void set(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom)
#Param left incomplete ##
#Param top incomplete ##
#Param right incomplete ##
#Param bottom incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method void setLTRB(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom)
alias for set(l, t, r, b)
#Param left incomplete ##
#Param top incomplete ##
#Param right incomplete ##
#Param bottom incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method void iset(int left, int top, int right, int bottom)
Initialize the rectangle with the 4 specified integers. The routine handles
converting them to scalars (by calling SkIntToScalar)
#Param left incomplete ##
#Param top incomplete ##
#Param right incomplete ##
#Param bottom incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method void isetWH(int width, int height)
Set this rectangle to be left/top at 0,0, and have the specified width
and height (automatically converted to SkScalar).
#Param width incomplete ##
#Param height incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method void set(const SkPoint pts[], int count)
Set this rectangle to be the bounds of the array of points.
If the array is empty (count == 0), then set this rectangle
to the empty rectangle (0,0,0,0)
#Param pts incomplete ##
#Param count incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method void setBounds(const SkPoint pts[], int count)
alias for set(pts, count)
#Param pts incomplete ##
#Param count incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method bool setBoundsCheck(const SkPoint pts[], int count)
Compute the bounds of the array of points, and set this rectangle to that
bounds and return true... unless a non-finite value is encountered,
in which case this rectangle is set to empty and false is returned.
#Param pts incomplete ##
#Param count incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method void set(const SkPoint& p0, const SkPoint& p1)
#Param p0 incomplete ##
#Param p1 incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method void setXYWH(SkScalar x, SkScalar y, SkScalar width, SkScalar height)
#Param x incomplete ##
#Param y incomplete ##
#Param width incomplete ##
#Param height incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method void setWH(SkScalar width, SkScalar height)
#Param width incomplete ##
#Param height incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method void setLargest()
Sets rectangle left and top to most negative value, and sets
right and bottom to most positive value.
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method void setLargestInverted()
Sets rectangle left and top to most positive value, and sets
right and bottom to most negative value.
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method SkRect makeOffset(SkScalar dx, SkScalar dy) const
Return a new Rect, built as an offset of this rectangle.
#Param dx incomplete ##
#Param dy incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method SkRect makeInset(SkScalar dx, SkScalar dy) const
Return a new Rect, built as an inset of this rectangle.
#Param dx incomplete ##
#Param dy incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method SkRect makeOutset(SkScalar dx, SkScalar dy) const
Return a new Rect, built as an outset of this rectangle.
#Param dx incomplete ##
#Param dy incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method void offset(SkScalar dx, SkScalar dy)
Offset set the rectangle by adding dx to its left and right,
and adding dy to its top and bottom.
#Param dx incomplete ##
#Param dy incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method void offset(const SkPoint& delta)
#Param delta incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method void offsetTo(SkScalar newX, SkScalar newY)
Offset this rectangle such its new x() and y() will equal newX and newY.
#Param newX incomplete ##
#Param newY incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method void inset(SkScalar dx, SkScalar dy)
Inset the rectangle by (dx,dy). If dx is positive, then the sides are
moved inwards, making the rectangle narrower. If dx is negative, then
the sides are moved outwards, making the rectangle wider. The same holds
true for dy and the top and bottom.
#Param dx incomplete ##
#Param dy incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method void outset(SkScalar dx, SkScalar dy)
Outset the rectangle by (dx,dy). If dx is positive, then the sides are
moved outwards, making the rectangle wider. If dx is negative, then the
sides are moved inwards, making the rectangle narrower. The same holds
true for dy and the top and bottom.
#Param dx incomplete ##
#Param dy incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method bool intersect(const SkRect& r)
If this rectangle intersects r, return true and set this rectangle to that
intersection, otherwise return false and do not change this rectangle.
If either rectangle is empty, do nothing and return false.
#Param r incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method bool intersect(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom)
If this rectangle intersects the rectangle specified by left, top, right, bottom,
return true and set this rectangle to that intersection, otherwise return false
and do not change this rectangle.
If either rectangle is empty, do nothing and return false.
#Param left incomplete ##
#Param top incomplete ##
#Param right incomplete ##
#Param bottom incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
# ------------------------------------------------------------------------------
#Method bool SK_WARN_UNUSED_RESULT intersect(const SkRect& a, const SkRect& b)
If rectangles a and b intersect, return true and set this rectangle to
that intersection, otherwise return false and do not change this
rectangle. If either rectangle is empty, do nothing and return false.
#Param a incomplete ##
#Param b incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#ToDo incomplete ##
##
#Method bool intersects(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) const
Returns true if this rectangle is not empty, and the specified sides of
a rectangle are not empty, and they intersect.
#Param left incomplete ##
#Param top incomplete ##
#Param right incomplete ##
#Param bottom incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
##
#Method bool intersects(const SkRect& r) const
#Param r incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
##
#Method static bool Intersects(const SkRect& a, const SkRect& b)
Returns true if rectangles a and b are not empty and intersect.
#Param a incomplete ##
#Param b incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
##
#Method void join(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom)
Updates rectangle to enclose itself and the specified rectangle.
If this rectangle is empty, just set it to the specified rectangle.
If the specified rectangle is empty, do nothing.
#Param left incomplete ##
#Param top incomplete ##
#Param right incomplete ##
#Param bottom incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
##
#Method void join(const SkRect& r)
If this rectangle is empty, just set it to the specified rectangle. If the specified
rectangle is empty, do nothing.
#Param r incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
##
#Method void joinNonEmptyArg(const SkRect& r)
#Param r incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
##
#Method void joinPossiblyEmptyRect(const SkRect& r)
Joins the rectangle with another without checking if either are empty (may produce unexpected
results if either rectangle is inverted).
#Param r incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
##
#Method void growToInclude(SkPoint pt)
Grows rectangle to include the specified (x,y). After this call, the
following will be true: fLeft <= x <= fRight && fTop <= y <= fBottom.
This is close, but not quite the same contract as contains(), since
contains() treats the left and top different from the right and bottom.
contains(x,y) -> fLeft <= x < fRight && fTop <= y < fBottom. Also note
that contains(x,y) always returns false if the rectangle is empty.
#Param pt incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
##
#Method void growToInclude(const SkPoint pts[], int count)
Bulk version of growToInclude
#Param pts incomplete ##
#Param count incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
##
#Method void growToInclude(const SkPoint pts[], size_t stride, int count)
Bulk version of growToInclude with stride.
#Param pts incomplete ##
#Param stride incomplete ##
#Param count incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
##
#Method bool contains(const SkRect& r) const {
Return true if this rectangle contains r, and if both rectangles are
not empty.
#Param r incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
##
#Method bool contains(const SkIRect& r) const
Returns true if the specified rectangle r is inside or equal to this rectangle.
#Param r incomplete ##
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
##
#Method void round(SkIRect* dst) const
Sets dst rectangle by rounding this rectangle coordinates to their
nearest integer values using SkScalarRoundToInt.
#Param dst incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
##
#Method void roundOut(SkIRect* dst) const
Sets dst rectangle by rounding "out" this rectangle, choosing the
SkScalarFloorToInt of top and left, and the SkScalarCeilToInt of right and bottom.
#Param dst incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
##
#Method void roundOut(SkRect* dst) const
Sets the dst rectangle by rounding "out" this rectangle, choosing the
SkScalarFloorToScalar of top and left, and the SkScalarCeilToScalar of right and bottom.
It is safe for this to equal dst.
#Param dst incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
##
#Method void roundIn(SkIRect* dst) const
Set the dst rectangle by rounding "in" this rectangle, choosing the
ceil() of top and left, and the floor of right and bottom. This does *not*
call sort(), so it is possible that the resulting rectangle is inverted;
either left >= right or top >= bottom. Call isEmpty() to detect that.
#Param dst incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
##
#Method SkIRect round() const
Returns the result of calling round(&dst)
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
##
#Method SkIRect roundOut() const
Returns the result of calling roundOut(&dst)
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
##
#Method void sort()
Swaps top/bottom or left/right if there are flipped; if width()
or height() would have returned a negative value. This should be called
if the edges are computed separately, and may have crossed over each
other. When this returns, left <= right && top <= bottom
#Example
// incomplete
##
#SeeAlso incomplete
##
#Method SkRect makeSorted() const
Returns a new Rect that is the sorted version of this rectangle (left <= right, top <= bottom).
#Return incomplete ##
#Example
// incomplete
##
#SeeAlso incomplete
##
#Method const SkScalar* asScalars() const
Cast-safe way to treat the rectangle as a SkScalar array with four entries.
#Return incomplete ##
#Example
// incomplete
##
##
#Method void dump(bool asHex) const
#Param asHex incomplete ##
#Example
// incomplete
##
##
#Method void dump() const
#Example
// incomplete
##
##
#Method void dumpHex() const
#Example
// incomplete
##
##
#Struct SkRect ##
#Topic Rect ##