Skia
2D Graphics Library
SkIPoint Struct Reference

#include <SkPoint.h>

Public Member Functions

constexpr int32_t x () const
 Returns x-axis value of SkIPoint. More...
 
constexpr int32_t y () const
 Returns y-axis value of SkIPoint. More...
 
bool isZero () const
 Returns true if fX and fY are both zero. More...
 
void set (int32_t x, int32_t y)
 Sets fX to x and fY to y. More...
 
SkIPoint operator- () const
 Returns SkIPoint changing the signs of fX and fY. More...
 
void operator+= (const SkIVector &v)
 Offsets SkIPoint by ivector v. More...
 
void operator-= (const SkIVector &v)
 Subtracts ivector v from SkIPoint. More...
 
bool equals (int32_t x, int32_t y) const
 Returns true if SkIPoint is equivalent to SkIPoint constructed from (x, y). More...
 

Static Public Member Functions

static constexpr SkIPoint Make (int32_t x, int32_t y)
 Sets fX to x, fY to y. More...
 

Public Attributes

int32_t fX
 x-axis value More...
 
int32_t fY
 y-axis value More...
 

Friends

bool operator== (const SkIPoint &a, const SkIPoint &b)
 Returns true if a is equivalent to b. More...
 
bool operator!= (const SkIPoint &a, const SkIPoint &b)
 Returns true if a is not equivalent to b. More...
 
SkIVector operator- (const SkIPoint &a, const SkIPoint &b)
 Returns ivector from b to a; computed as (a.fX - b.fX, a.fY - b.fY). More...
 
SkIPoint operator+ (const SkIPoint &a, const SkIVector &b)
 Returns SkIPoint resulting from SkIPoint a offset by ivector b, computed as: (a.fX + b.fX, a.fY + b.fY). More...
 

Detailed Description

SkIPoint holds two 32-bit integer coordinates.

Member Function Documentation

◆ equals()

bool SkIPoint::equals ( int32_t  x,
int32_t  y 
) const
inline

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

Parameters
xvalue compared with fX
yvalue compared with fY
Returns
true if SkIPoint equals (x, y)

◆ isZero()

bool SkIPoint::isZero ( ) const
inline

Returns true if fX and fY are both zero.

Returns
true if fX is zero and fY is zero

◆ Make()

static constexpr SkIPoint SkIPoint::Make ( int32_t  x,
int32_t  y 
)
inlinestaticconstexpr

Sets fX to x, fY to y.

Parameters
xinteger x-axis value of constructed SkIPoint
yinteger y-axis value of constructed SkIPoint
Returns
SkIPoint (x, y)

◆ operator+=()

void SkIPoint::operator+= ( const SkIVector v)
inline

Offsets SkIPoint by ivector v.

Sets SkIPoint to (fX + v.fX, fY + v.fY).

Parameters
vivector to add

◆ operator-()

SkIPoint SkIPoint::operator- ( ) const
inline

Returns SkIPoint changing the signs of fX and fY.

Returns
SkIPoint as (-fX, -fY)

◆ operator-=()

void SkIPoint::operator-= ( const SkIVector v)
inline

Subtracts ivector v from SkIPoint.

Sets SkIPoint to: (fX - v.fX, fY - v.fY).

Parameters
vivector to subtract

◆ set()

void SkIPoint::set ( int32_t  x,
int32_t  y 
)
inline

Sets fX to x and fY to y.

Parameters
xnew value for fX
ynew value for fY

◆ x()

constexpr int32_t SkIPoint::x ( ) const
inlineconstexpr

Returns x-axis value of SkIPoint.

Returns
fX

◆ y()

constexpr int32_t SkIPoint::y ( ) const
inlineconstexpr

Returns y-axis value of SkIPoint.

Returns
fY

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const SkIPoint a,
const SkIPoint b 
)
friend

Returns true if a is not equivalent to b.

Parameters
aSkIPoint to compare
bSkIPoint to compare
Returns
true if a.fX != b.fX or a.fY != b.fY

◆ operator+

SkIPoint operator+ ( const SkIPoint a,
const SkIVector b 
)
friend

Returns SkIPoint resulting from SkIPoint a offset by ivector b, computed as: (a.fX + b.fX, a.fY + b.fY).

Can also be used to offset SkIPoint b by ivector a, returning SkIPoint. Can also be used to add ivector to ivector, returning ivector.

Parameters
aSkIPoint or ivector to add to
bSkIPoint or ivector to add
Returns
SkIPoint equal to a offset by b

◆ operator-

SkIVector operator- ( const SkIPoint a,
const SkIPoint b 
)
friend

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
aSkIPoint or ivector to subtract from
bivector to subtract
Returns
ivector from b to a

◆ operator==

bool operator== ( const SkIPoint a,
const SkIPoint b 
)
friend

Returns true if a is equivalent to b.

Parameters
aSkIPoint to compare
bSkIPoint to compare
Returns
true if a.fX == b.fX and a.fY == b.fY

Member Data Documentation

◆ fX

int32_t SkIPoint::fX

x-axis value

◆ fY

int32_t SkIPoint::fY

y-axis value


The documentation for this struct was generated from the following file: