struct SkIPoint { int32_t fX; int32_t fY; static constexpr SkIPoint Make(int32_t x, int32_t y); int32_t x() const; int32_t y() const; bool isZero() const; void set(int32_t x, int32_t y); SkIPoint operator-() const; void operator+=(const SkIVector& v); void operator-=(const SkIVector& v); bool equals(int32_t x, int32_t y) const; friend bool operator==(const SkIPoint& a, const SkIPoint& b); friend bool operator!=(const SkIPoint& a, const SkIPoint& b); friend SkIVector operator-(const SkIPoint& a, const SkIPoint& b); friend SkIPoint operator+(const SkIPoint& a, const SkIVector& b); };
SkIPoint holds two 32-bit integer coordinates.
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>int32_t</td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkIPoint_fX'><code>fX</code></a></td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
x-axis value used by IPoint.
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>int32_t</td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkIPoint_fY'><code>fY</code></a></td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>
y-axis value used by IPoint.
static constexpr SkIPoint Make(int32_t x, int32_t y)
x |
integer x-axis value of constructed SkIPoint |
y |
integer y-axis value of constructed SkIPoint |
set() SkPoint::iset() SkPoint::Make
int32_t x()const
Returns x-axis value of SkIPoint.
int32_t y()const
Returns y-axis value of SkIPoint.
bool isZero()const
Returns true if fX and fY are both zero.
true if fX is zero and fY is zero
void set(int32_t x, int32_t y)
x |
new value for fX |
y |
new value for fY |
SkIPoint operator-()const
Returns SkIPoint changing the signs of fX and fY.
operator-(const SkIPoint& a, const SkIPoint& b) operator-=(const SkIVector& v) SkPoint::operator-() const
void operator+=(const SkIVector& v)
Offsets IPoint by IVector v. Sets IPoint to (fX + v.fX, fY + v.fY)
.
v |
IVector to add |
operator+(const SkIPoint& a, const SkIVector& b) SkPoint::operator+=(const SkVector& v)
void operator-=(const SkIVector& v)
Subtracts IVector v from IPoint. Sets IPoint to: (fX - v.fX, fY - v.fY)
.
v |
IVector to subtract |
operator-(const SkIPoint& a, const SkIPoint& b) SkPoint::operator-=(const SkVector& v)
bool equals(int32_t x, int32_t y)const
Returns true if SkIPoint is equivalent to SkIPoint constructed from (x, y).
x |
value compared with fX |
y |
value compared with fY |
true if SkIPoint equals (x, y)
operator==(const SkIPoint& a, const SkIPoint& b)
bool operator==(const SkIPoint& a, const SkIPoint& b)
Returns true if a is equivalent to b.
a |
SkIPoint to compare |
b |
SkIPoint to compare |
true if a.fX == b.fX and a.fY == b.fY
equals() operator!=(const SkIPoint& a, const SkIPoint& b)
bool operator!=(const SkIPoint& a, const SkIPoint& b)
Returns true if a is not equivalent to b.
a |
SkIPoint to compare |
b |
SkIPoint to compare |
true if a.fX != b.fX or a.fY != b.fY
operator==(const SkIPoint& a, const SkIPoint& b) equals()
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.
a |
IPoint or IVector to subtract from |
b |
IVector to subtract |
operator-=(const SkIVector& v)
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.
a |
IPoint or IVector to add to |
b |
IPoint or IVector to add |
operator+=(const SkIVector& v)
typedef SkIPoint SkIVector;
SkIVector provides an alternative name for SkIPoint. SkIVector and SkIPoint can be used interchangeably for all purposes.