bookmaker bot checked in more md files with the wrong fiddle hashes. Ravi is landing a CL to preventing it from checking in more errors, for now. Sadly, creating this CL also corrupted the md output -- luckily it was an error that could be detected. But perhaps other errors are going undetected. TMI: The call to fiddlecli wrote the wrong "text" string to SKIRect_isEmpty, first time I've seen that. Running it again generated the correct output. TBR=rmistry@google.com,jcgregario@google.com No-Try: true Docs-Preview: https://skia.org/?cl=142329 Bug: skia:6818 Change-Id: I6b57a4a070991b76a1acc44fb024439defc2d977 Reviewed-on: https://skia-review.googlesource.com/142329 Commit-Queue: Cary Clark <caryclark@google.com> Auto-Submit: Cary Clark <caryclark@google.com> Reviewed-by: Cary Clark <caryclark@google.com>
27 KiB
SkIPoint Reference
IPoint
Struct SkIPoint
Typedef
SkIPoint typedef
define a data type.
Topic | Description |
---|
SkIPoint holds two 32-bit integer coordinates.
Overview
Topic | Description |
---|---|
Constructors | functions that construct SkIPoint |
Functions | global and class member functions |
Members | member values |
Operators | operator overloading methods |
Related Functions | similar member functions grouped together |
Related Function
SkIPoint global, struct
, and class
related member functions share a topic.
Topic | Description |
---|---|
IVector | alias for IPoint |
Property | member values |
Set | replaces all values |
Member Function
SkIPoint member functions read and modify the structure properties.
Topic | Description |
---|---|
Make | constructs from integer inputs |
equals | returns true if members are equal |
isZero | returns true if both members equal zero |
set | sets to integer input |
x | returns fX |
y | returns fY |
Member
Members
Type | Name | Description |
---|---|---|
int32_t | fX |
x-axis value |
int32_t | fY |
y-axis value |
SkIPoint members may be read and written directly without using a member function.
Topic | Description |
---|---|
fX | x-axis value |
fY | y-axis value |
Members
Constructor
SkIPoint can be constructed or initialized by these functions, including C++ class constructors.
Type | Name | Description |
---|---|---|
int32_t | fX |
x-axis value used by IPoint. |
int32_t | fY |
y-axis value used by IPoint. |
Topic | Description |
---|---|
Make | constructs from integer inputs |
Make
static constexpr SkIPoint Make(int32_t x, int32_t y)
Parameters
x |
integer x-axis value of constructed IPoint |
y |
integer y-axis value of constructed IPoint |
Return Value
IPoint (x, y)
Example
Example Output
pt1 == pt2
See Also
set SkPoint::iset()[2] SkPoint::Make
Property
Topic | Description |
---|---|
isZero | returns true if both members equal zero |
x | returns fX |
y | returns fY |
x
int32_t x() const
Returns x-axis value of IPoint.
Return Value
Example
Example Output
pt1.fX == pt1.x()
See Also
y
int32_t y() const
Returns y-axis value of IPoint.
Return Value
Example
Example Output
pt1.fY == pt1.y()
See Also
isZero
bool isZero() const
Returns true if fX and fY are both zero.
Return Value
true if fX is zero and fY is zero
Example
Example Output
pt.isZero() == true
See Also
Set
Topic | Description |
---|---|
set | sets to integer input |
set
void set(int32_t x, int32_t y)
Parameters
x |
new value for fX |
y |
new value for fY |
Example
Example Output
pt1 == pt2
See Also
Operator
SkIPoint operators inline class member functions with arithmetic equivalents.
Topic | Description |
---|---|
equals | returns true if members are equal |
operator!=(const SkIPoint& a, const SkIPoint& b) | returns true if IPoints are unequal |
operator+(const SkIPoint& a, const SkIVector& b) | returns IPoint offset by IVector |
operator+=(const SkIVector& v) | adds IVector to IPoint |
operator-() const | reverses sign of IPoint |
operator-(const SkIPoint& a, const SkIPoint& b) | returns IVector between IPoints |
operator-=(const SkIVector& v) | subtracts IVector from IPoint |
operator==(const SkIPoint& a, const SkIPoint& b) | returns true if IPoints are equal |
operator-
SkIPoint operator-() _const
Returns IPoint changing the signs of fX and fY.
Return Value
Example
Example Output
pt: 0, 0 negate: 0, 0
pt: -1, -2 negate: 1, 2
pt: 2147483647, -2147483647 negate: -2147483647, 2147483647
pt: -2147483648, -2147483648 negate: -2147483648, -2147483648
See Also
operator-(const SkIPoint& a, const SkIPoint& b) operator-=(const SkIVector& v) SkPoint::operator-() const
operator+=
void operator+=(const SkIVector& v)
Offsets IPoint by IVector v. Sets IPoint to(fX + v.fX, fY + v.fY) .
Parameters
v |
IVector to add |
Example
See Also
operator+(const SkIPoint& a, const SkIVector& b) SkPoint::operator+=(const SkVector& v)
operator-=
void operator-=(const SkIVector& v)
Subtracts IVector v from IPoint. Sets IPoint to: (fX - v.fX, fY - v.fY) .
Parameters
v |
IVector to subtract |
Example
See Also
operator-(const SkIPoint& a, const SkIPoint& b) SkPoint::operator-=(const SkVector& v)
equals
bool equals(int32_t x, int32_t y) const
Returns true if IPoint is equivalent to IPoint constructed from (x, y).
Parameters
x |
value compared with fX |
y |
value compared with fY |
Return Value
true if IPoint equals (x, y)
Example
Example Output
pt: 0, 0 == pt
pt: -1, -2 == pt
pt: 2147483647, -1 == pt
pt: -2147483648, -1 == pt
See Also
operator==(const SkIPoint& a, const SkIPoint& b)
operator==
bool operator==(const SkIPoint& a, const SkIPoint& b)
Returns true if a is equivalent to b.
Parameters
a |
IPoint to compare |
b |
IPoint to compare |
Return Value
true if a.fX == b.fX and a.fY == b.fY
Example
Example Output
pt: 0, 0 == pt
pt: -1, -2 == pt
pt: 2147483647, -1 == pt
pt: -2147483648, -1 == pt
See Also
equals operator!=(const SkIPoint& a, const SkIPoint& b)
operator!=
bool operator!=(const SkIPoint& a, const SkIPoint& b)
Returns true if a is not equivalent to b.
Parameters
a |
IPoint to compare |
b |
IPoint to compare |
Return Value
true if a.fX != b.fX or a.fY != b.fY
Example
Example Output
pt: 0, 0 == pt
pt: -1, -2 == pt
pt: 2147483647, -1 == pt
pt: -2147483648, -1 == pt
See Also
operator==(const SkIPoint& a, const SkIPoint& b) equals
operator-
SkIVector operator-(const SkIPoint& a, const SkIPoint& b)
Returns IVector from b to a; computed as(a.fX - b.fX, a.fY - b.fY) .
Can also be used to subtract IVector from IVector, returning IVector.
Parameters
a |
IPoint or IVector to subtract from |
b |
IVector to subtract |
Return Value
Example
See Also
operator-=(const SkIVector& v)
operator+
SkIPoint operator+(const SkIPoint& a, const SkIVector& b)
Returns IPoint resulting from IPoint a offset by IVector b, computed as: (a.fX + b.fX, a.fY + b.fY) .
Can also be used to offset IPoint b by IVector a, returning IPoint. Can also be used to add IVector to IVector, returning IVector.
Parameters
a |
IPoint or IVector to add to |
b |
IPoint or IVector to add |
Return Value
Example
See Also
operator+=(const SkIVector& v)
IVector
Typedef SkIVector
typedef SkIPoint SkIVector;
SkIVector provides an alternative name for SkIPoint. SkIVector and SkIPoint can be used interchangeably for all purposes.