Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
gfx::PointF Class Reference

#include <point_f.h>

Public Member Functions

constexpr PointF ()
 
constexpr PointF (float x, float y)
 
constexpr PointF (const Point &p)
 
constexpr float x () const
 
constexpr float y () const
 
void set_x (float x)
 
void set_y (float y)
 
void SetPoint (float x, float y)
 
void Offset (float delta_x, float delta_y)
 
void operator+= (const Vector2dF &vector)
 
void operator-= (const Vector2dF &vector)
 
void SetToMin (const PointF &other)
 
void SetToMax (const PointF &other)
 
bool IsOrigin () const
 
Vector2dF OffsetFromOrigin () const
 
bool operator< (const PointF &rhs) const
 
void Scale (float scale)
 
void Scale (float x_scale, float y_scale)
 
std::string ToString () const
 

Detailed Description

Definition at line 19 of file point_f.h.

Constructor & Destructor Documentation

◆ PointF() [1/3]

constexpr gfx::PointF::PointF ( )
inlineconstexpr

Definition at line 21 of file point_f.h.

21: x_(0.f), y_(0.f) {}

◆ PointF() [2/3]

constexpr gfx::PointF::PointF ( float  x,
float  y 
)
inlineconstexpr

Definition at line 22 of file point_f.h.

22: x_(x), y_(y) {}
constexpr float x() const
Definition: point_f.h:27
constexpr float y() const
Definition: point_f.h:28

◆ PointF() [3/3]

constexpr gfx::PointF::PointF ( const Point p)
inlineexplicitconstexpr

Definition at line 24 of file point_f.h.

25 : PointF(static_cast<float>(p.x()), static_cast<float>(p.y())) {}
constexpr PointF()
Definition: point_f.h:21

Member Function Documentation

◆ IsOrigin()

bool gfx::PointF::IsOrigin ( ) const
inline

Definition at line 55 of file point_f.h.

55{ return x_ == 0 && y_ == 0; }

◆ Offset()

void gfx::PointF::Offset ( float  delta_x,
float  delta_y 
)
inline

Definition at line 37 of file point_f.h.

37 {
38 x_ += delta_x;
39 y_ += delta_y;
40 }

◆ OffsetFromOrigin()

Vector2dF gfx::PointF::OffsetFromOrigin ( ) const
inline

Definition at line 57 of file point_f.h.

57{ return Vector2dF(x_, y_); }

◆ operator+=()

void gfx::PointF::operator+= ( const Vector2dF vector)
inline

Definition at line 42 of file point_f.h.

42 {
43 x_ += vector.x();
44 y_ += vector.y();
45 }

◆ operator-=()

void gfx::PointF::operator-= ( const Vector2dF vector)
inline

Definition at line 47 of file point_f.h.

47 {
48 x_ -= vector.x();
49 y_ -= vector.y();
50 }

◆ operator<()

bool gfx::PointF::operator< ( const PointF rhs) const
inline

Definition at line 65 of file point_f.h.

65 {
66 return std::tie(y_, x_) < std::tie(rhs.y_, rhs.x_);
67 }

◆ Scale() [1/2]

void gfx::PointF::Scale ( float  scale)
inline

Definition at line 69 of file point_f.h.

69{ Scale(scale, scale); }
void Scale(float scale)
Definition: point_f.h:69
const Scalar scale

◆ Scale() [2/2]

void gfx::PointF::Scale ( float  x_scale,
float  y_scale 
)
inline

Definition at line 71 of file point_f.h.

71 {
72 SetPoint(x() * x_scale, y() * y_scale);
73 }
void SetPoint(float x, float y)
Definition: point_f.h:32

◆ set_x()

void gfx::PointF::set_x ( float  x)
inline

Definition at line 29 of file point_f.h.

29{ x_ = x; }

◆ set_y()

void gfx::PointF::set_y ( float  y)
inline

Definition at line 30 of file point_f.h.

30{ y_ = y; }

◆ SetPoint()

void gfx::PointF::SetPoint ( float  x,
float  y 
)
inline

Definition at line 32 of file point_f.h.

32 {
33 x_ = x;
34 y_ = y;
35 }

◆ SetToMax()

void gfx::PointF::SetToMax ( const PointF other)

Definition at line 16 of file point_f.cc.

16 {
17 x_ = x_ >= other.x_ ? x_ : other.x_;
18 y_ = y_ >= other.y_ ? y_ : other.y_;
19}

◆ SetToMin()

void gfx::PointF::SetToMin ( const PointF other)

Definition at line 11 of file point_f.cc.

11 {
12 x_ = x_ <= other.x_ ? x_ : other.x_;
13 y_ = y_ <= other.y_ ? y_ : other.y_;
14}

◆ ToString()

std::string gfx::PointF::ToString ( ) const

Definition at line 21 of file point_f.cc.

21 {
22 return base::StringPrintf("%f,%f", x(), y());
23}
std::string StringPrintf(const std::string &format, Args... args)
Definition: string_utils.h:18

◆ x()

constexpr float gfx::PointF::x ( ) const
inlineconstexpr

Definition at line 27 of file point_f.h.

27{ return x_; }

◆ y()

constexpr float gfx::PointF::y ( ) const
inlineconstexpr

Definition at line 28 of file point_f.h.

28{ return y_; }

The documentation for this class was generated from the following files: