Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
gfx::SizeF Class Reference

#include <size_f.h>

Public Member Functions

constexpr SizeF ()
 
constexpr SizeF (float width, float height)
 
constexpr SizeF (const Size &size)
 
constexpr float width () const
 
constexpr float height () const
 
void set_width (float width)
 
void set_height (float height)
 
float GetArea () const
 
void SetSize (float width, float height)
 
void Enlarge (float grow_width, float grow_height)
 
void SetToMin (const SizeF &other)
 
void SetToMax (const SizeF &other)
 
bool IsEmpty () const
 
void Scale (float scale)
 
void Scale (float x_scale, float y_scale)
 
std::string ToString () const
 

Detailed Description

Definition at line 18 of file size_f.h.

Constructor & Destructor Documentation

◆ SizeF() [1/3]

constexpr gfx::SizeF::SizeF ( )
inlineconstexpr

Definition at line 20 of file size_f.h.

20: width_(0.f), height_(0.f) {}

◆ SizeF() [2/3]

constexpr gfx::SizeF::SizeF ( float  width,
float  height 
)
inlineconstexpr

Definition at line 21 of file size_f.h.

22 : width_(clamp(width)), height_(clamp(height)) {}
constexpr float height() const
Definition size_f.h:29
constexpr float width() const
Definition size_f.h:28

◆ SizeF() [3/3]

constexpr gfx::SizeF::SizeF ( const Size size)
inlineexplicitconstexpr

Definition at line 24 of file size_f.h.

25 : SizeF(static_cast<float>(size.width()),
26 static_cast<float>(size.height())) {}
constexpr SizeF()
Definition size_f.h:20
constexpr size_t size(const T(&array)[N]) noexcept

Member Function Documentation

◆ Enlarge()

void gfx::SizeF::Enlarge ( float  grow_width,
float  grow_height 
)

Definition at line 15 of file size_f.cc.

15 {
16 SetSize(width() + grow_width, height() + grow_height);
17}
void SetSize(float width, float height)
Definition size_f.h:36

◆ GetArea()

float gfx::SizeF::GetArea ( ) const

Definition at line 11 of file size_f.cc.

11 {
12 return width() * height();
13}

◆ height()

constexpr float gfx::SizeF::height ( ) const
inlineconstexpr

Definition at line 29 of file size_f.h.

29{ return height_; }

◆ IsEmpty()

bool gfx::SizeF::IsEmpty ( ) const
inline

Definition at line 46 of file size_f.h.

46{ return !width() || !height(); }

◆ Scale() [1/2]

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

Definition at line 48 of file size_f.h.

48{ Scale(scale, scale); }
const Scalar scale

◆ Scale() [2/2]

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

Definition at line 50 of file size_f.h.

50 {
51 SetSize(width() * x_scale, height() * y_scale);
52 }

◆ set_height()

void gfx::SizeF::set_height ( float  height)
inline

Definition at line 32 of file size_f.h.

32{ height_ = clamp(height); }

◆ set_width()

void gfx::SizeF::set_width ( float  width)
inline

Definition at line 31 of file size_f.h.

31{ width_ = clamp(width); }

◆ SetSize()

void gfx::SizeF::SetSize ( float  width,
float  height 
)
inline

Definition at line 36 of file size_f.h.

36 {
39 }
void set_width(float width)
Definition size_f.h:31
void set_height(float height)
Definition size_f.h:32

◆ SetToMax()

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

Definition at line 24 of file size_f.cc.

24 {
25 width_ = width() >= other.width() ? width() : other.width();
26 height_ = height() >= other.height() ? height() : other.height();
27}

◆ SetToMin()

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

Definition at line 19 of file size_f.cc.

19 {
20 width_ = width() <= other.width() ? width() : other.width();
21 height_ = height() <= other.height() ? height() : other.height();
22}

◆ ToString()

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

Definition at line 29 of file size_f.cc.

29 {
30 return base::StringPrintf("%fx%f", width(), height());
31}
std::string StringPrintf(const std::string &format, Args... args)

◆ width()

constexpr float gfx::SizeF::width ( ) const
inlineconstexpr

Definition at line 28 of file size_f.h.

28{ return width_; }

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