SkIPoint Reference

IPoint

Overview

Subtopics

namedescription
Constructorsfunctions that construct SkIPoint
Member Functionsstatic functions and member methods
Membersmember values
Operatorsoperator overloading methods

Struct SkIPoint

SkIPoint holds two 32 bit integer coordinates.

Constructors

namedescription
Makeconstructs from integer inputs

Operators

namedescription
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-() constreverses 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

Member Functions

namedescription
Makeconstructs from integer inputs
equalsreturns true if members are equal
isZeroreturns true if both members equal zero
setsets to integer input
xreturns fX
yreturns fY

Members

namedescription
fXx-axis value
fYy-axis value

int32_t fX

x-axis value used by IPoint.

int32_t fY

y-axis value used by IPoint.

Make

Sets fX to x, fY to y.

Parameters

Return Value

IPoint (x, y)

Example

Example Output

pt1 == pt2

See Also

set SkPoint::iset()[2] SkPoint::Make SkIPoint16::Make


x

Returns x-axis value of IPoint.

Return Value

fX

Example

Example Output

pt1.fX == pt1.x()

See Also

y SkPoint::x() SkIPoint16::x()


y

Returns y-axis value of IPoint.

Return Value

fY

Example

Example Output

pt1.fY == pt1.y()

See Also

x SkPoint::y() SkIPoint16::y()


isZero

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

SkPoint::isZero


set

Sets fX to x and fY to y.

Parameters

Example

Example Output

pt1 == pt2

See Also

Make SkIPoint16::set


operator-

Returns IPoint changing the signs of fX and fY.

Return Value

IPoint as (-fX, -fY)

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+=

Offsets IPoint by IVector v. Sets IPoint to(fX + v.fX, fY + v.fY).

Parameters

Example

See Also

operator+(const SkIPoint& a, const SkIVector& b) SkPoint::operator+=(const SkVector& v)


operator-=

Subtracts IVector v from IPoint. Sets IPoint to: (fX - v.fX, fY - v.fY).

Parameters

Example

See Also

operator-(const SkIPoint& a, const SkIPoint& b) SkPoint::operator-=(const SkVector& v)


equals

Returns true if IPoint is equivalent to IPoint constructed from (x, y).

Parameters

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==

Returns true if a is equivalent to b.

Parameters

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!=

Returns true if a is not equivalent to b.

Parameters

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-

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

Return Value

IVector from b to a

Example

See Also

operator-=(const SkIVector& v)


operator+

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

Return Value

IPoint equal to a offset by b

Example

See Also

operator+=(const SkIVector& v)


IVector