#include "drawing/size.h"

Public Member Functions

 Size ()
 Constructs a new Size object and initializes its width and height values with 0. More...
 
 Size (const Point &point)
 
 Size (int width, int height)
 
bool get_IsEmpty () const
 
int get_Width () const
 Returns the value of width represented by the current object. More...
 
int get_Height () const
 Returns the value of heght represented by the current object. More...
 
void set_Width (int value)
 
void set_Height (int value)
 
bool Equals (const Size &size) const
 
String ToString () const
 
int32_t GetHashCode () const
 Returns a hash code for the current object. More...
 
 operator SizeF () const
 
 operator Point () const
 

Static Public Member Functions

static Size Add (const Size &size1, const Size &size2)
 
static Size Subtract (const Size &size1, const Size &size2)
 
static Size Ceiling (const SizeF &size)
 
static Size Truncate (const SizeF &size)
 
static Size Round (const SizeF &size)
 

Static Public Attributes

static const Size Empty
 An empty instance of Size class whose width and height values are 0. More...
 

Friends

Size operator+ (const Size &size1, const Size &size2)
 
Size operator- (const Size &size1, const Size &size2)
 
bool operator== (const Size &size1, const Size &size2)
 
bool operator!= (const Size &size1, const Size &size2)
 

Detailed Description

Represents a pair of integer values that represent width and height of an image. This type should be allocated on stack and passed to functions by value or by reference. Never use System::SmartPtr class to manage objects of this type.

Constructor & Destructor Documentation

◆ Size() [1/3]

System::Drawing::Size::Size ( )

Constructs a new Size object and initializes its width and height values with 0.

◆ Size() [2/3]

System::Drawing::Size::Size ( const Point point)

Constructs a new Size object and initializes its width and height values with the values of X and Y coordinates of the specifide point correspondingly.

Parameters
pointA Point object whose X and Y coordinates are used to initialize width and height value of the Size object being created

◆ Size() [3/3]

System::Drawing::Size::Size ( int  width,
int  height 
)

Constructs a new Size object and initializes it with the specified value.

Parameters
widthThe value to width
heightThe value of height

Member Function Documentation

◆ Add()

static Size System::Drawing::Size::Add ( const Size size1,
const Size size2 
)
static

Returns a new Size object that is a sum of the specified Size object, i.e. whose width value is equal to the sum of width values of the specified objects and height value is equal to the sum of height values of the specified objects.

Parameters
size1The first operand
size2The second operand
Returns
The Size object which is the sum of size1 and size2

◆ Ceiling()

static Size System::Drawing::Size::Ceiling ( const SizeF size)
static

Constructs a Size object from the specified SizeF object by rounding the SizeF object's width and height values to the next higher integer values.

Parameters
sizeThe SizeF object to convert
Returns
A Size object constructed from size

◆ Equals()

bool System::Drawing::Size::Equals ( const Size size) const

Determines if the current object and the specified object are equal, i.e. represent the same pair of width and hegiht values.

Parameters
sizeThe object to compare the current object with
Returns
True if the objects are equal, otherwise - false

◆ get_Height()

int System::Drawing::Size::get_Height ( ) const
inline

Returns the value of heght represented by the current object.

◆ get_IsEmpty()

bool System::Drawing::Size::get_IsEmpty ( ) const
inline

Determines if both width and hegiht values are equal to 0.

Returns
True if both width and height represented by the current object are 0; otherwise - false

◆ get_Width()

int System::Drawing::Size::get_Width ( ) const
inline

Returns the value of width represented by the current object.

◆ GetHashCode()

int32_t System::Drawing::Size::GetHashCode ( ) const

Returns a hash code for the current object.

◆ operator Point()

System::Drawing::Size::operator Point ( ) const

Constructs an instance of Point object and initializes its X and Y coordinate with the current object's width and height values correspondingly.

◆ operator SizeF()

System::Drawing::Size::operator SizeF ( ) const

Constructs an instance of SizeF object and initializes it with width and hegiht values of the current Size object.

◆ Round()

static Size System::Drawing::Size::Round ( const SizeF size)
static

Constructs a Size object from the specified SizeF object by rounding the SizeF object's width and height values to the nearest integer values.

Parameters
sizeThe SizeF object to convert to construct Size object from
Returns
A Size object constructed from size

◆ set_Height()

void System::Drawing::Size::set_Height ( int  value)
inline

Sets the value of height represented by the current object.

Parameters
valueThe value to set

◆ set_Width()

void System::Drawing::Size::set_Width ( int  value)
inline

Sets the value of width represented by the current object.

Parameters
valueThe value to set

◆ Subtract()

static Size System::Drawing::Size::Subtract ( const Size size1,
const Size size2 
)
static

Returns a new Size object that is the results of subctraction of size2 from size1, i.e. whose width value is the result of subtraction of size2's width value from size1's width value and height value is the result of subtraction of size2's height value from size1's height value.

Parameters
size1The Size object to subtract from
size2The Size object to subtract
Returns
The Size object which is the result of subtraction of size2 from size1

◆ ToString()

String System::Drawing::Size::ToString ( ) const

Returns the string representation of the pair of width and hegiht values represented by the current object.

◆ Truncate()

static Size System::Drawing::Size::Truncate ( const SizeF size)
static

Constructs a Size object from the specified SizeF object by truncating the SizeF object's width and height values to the next lower integer values.

Parameters
sizeThe SizeF object to convert to construct Size object from
Returns
A Size object constructed from size

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const Size size1,
const Size size2 
)
friend

Determines the inequality of two Size objects by comparing their corresponding width and height values.

Parameters
size1The first comparand
size2The second comparand
Returns
True if size1 and size2 are not equal, otherwise - false

◆ operator+

Size operator+ ( const Size size1,
const Size size2 
)
friend

Returns a new Size object that is a sum of the specified Size object, i.e. whose width value is equal to the sum of width values of the specified objects and height value is equal to the sum of height values of the specified objects.

Parameters
size1The first operand
size2The second operand
Returns
The Size object which is the sum of size1 and size2

◆ operator-

Size operator- ( const Size size1,
const Size size2 
)
friend

Returns a new Size object that is the results of subctraction of size2 from size1, i.e. whose width value is the result of subtraction of size2's width value from size1's width value and height value is the result of subtraction of size2's height value from size1's height value.

Parameters
size1The Size object to subtract from
size2The Size object to subtract
Returns
The Size object which is the result of subtraction of size2 from size1

◆ operator==

bool operator== ( const Size size1,
const Size size2 
)
friend

Determines the equality of two Size objects by comparing their corresponding width and height values.

Parameters
size1The first comparand
size2The second comparand
Returns
True if size1 and size2 are equal, otherwise - false

Member Data Documentation

◆ Empty

const Size System::Drawing::Size::Empty
static

An empty instance of Size class whose width and height values are 0.