OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TSize Class Reference

The tagSIZE struct is defined as. More...

#include <owl/geometry.h>

Inheritance diagram for owl::TSize:

Public Member Functions

 TSize ()
 Default constructor that does nothing.
 
 TSize (int dx, int dy)
 Creates a TSize object with cx = dx and cy = dy.
 
 TSize (const tagPOINT &point)
 Creates a TSize object with cx = point.x and cy = point.y.
 
 TSize (const tagSIZE &size)
 Creates a TSize object with cx = size.cx and cy = size.cy.
 
 TSize (const TSize &size)
 Creates a TSize object with cx = size.cx and cy = size.cy.
 
 TSize (DWORD packedExtents)
 Creates a size by extracting the extents from the given argument.
 
bool operator== (const TSize &other) const
 Returns true if this TSize object is equal to the other TSize object; otherwise returns false.
 
bool operator!= (const TSize &other) const
 Returns false if this TSize object is equal to the other TSize object; otherwise returns true.
 
int X () const
 Returns the width.
 
int Y () const
 Returns the height.
 
int Magnitude () const
 Returns the length of the diagonal of the rectangle represented by this object.
 
TSize operator+ (const TSize &size) const
 Calculates an offset to this TSize object using the given size argument as the displacement.
 
TSize operator- (const TSize &size) const
 Calculates a negative offset to this TSize object using the given size argument as the displacement.
 
TSize operator- () const
 Returns the TSize object (-cx, -cy). This object is not changed.
 
TSizeoperator+= (const TSize &size)
 Offsets this TSize object by the given size argument.
 
TSizeoperator-= (const TSize &size)
 Negatively offsets this TSize object by the given size argument.
 

Detailed Description

The tagSIZE struct is defined as.

struct tagSIZE {
int cx;
int cy;
};

TSize encapsulates the notion of a two-dimensional quantity that usually represents a displacement or the height and width of a rectangle. TSize inherits the two data members cx and cy from tagSIZE. Member functions and operators are provided for comparing, assigning, and manipulating sizes. Overloaded << and >> operators allow chained insertion and extraction of TSize objects with streams.

Definition at line 234 of file geometry.h.

Constructor & Destructor Documentation

◆ TSize() [1/6]

owl::TSize::TSize ( )
inline

Default constructor that does nothing.

Definition at line 1406 of file geometry.h.

◆ TSize() [2/6]

owl::TSize::TSize ( int dx,
int dy )
inline

Creates a TSize object with cx = dx and cy = dy.

Definition at line 1416 of file geometry.h.

◆ TSize() [3/6]

owl::TSize::TSize ( const tagPOINT & point)
inline

Creates a TSize object with cx = point.x and cy = point.y.

Definition at line 1426 of file geometry.h.

◆ TSize() [4/6]

owl::TSize::TSize ( const tagSIZE & size)
inline

Creates a TSize object with cx = size.cx and cy = size.cy.

Definition at line 1436 of file geometry.h.

◆ TSize() [5/6]

owl::TSize::TSize ( const TSize & size)
inline

Creates a TSize object with cx = size.cx and cy = size.cy.

Definition at line 1446 of file geometry.h.

◆ TSize() [6/6]

owl::TSize::TSize ( DWORD packedExtents)
inlineexplicit

Creates a size by extracting the extents from the given argument.

The constructor assumes that the low-word of the given argument is the horizontal extent and the high-word of the given argument is the vertical extent.

Definition at line 1459 of file geometry.h.

Member Function Documentation

◆ Magnitude()

int owl::TSize::Magnitude ( ) const

Returns the length of the diagonal of the rectangle represented by this object.

The value returned is an int approximation to the square root of (cx2 + cy2).

Definition at line 81 of file geometry.cpp.

References owl::Sqrt().

◆ operator!=()

bool owl::TSize::operator!= ( const TSize & other) const
inline

Returns false if this TSize object is equal to the other TSize object; otherwise returns true.

Definition at line 1507 of file geometry.h.

References owl::ToBool().

◆ operator+()

TSize owl::TSize::operator+ ( const TSize & size) const
inline

Calculates an offset to this TSize object using the given size argument as the displacement.

Returns the object (cx + size.cx, cy + size.cy). This TSize object is not changed.

Definition at line 1518 of file geometry.h.

References TSize().

◆ operator+=()

TSize & owl::TSize::operator+= ( const TSize & size)
inline

Offsets this TSize object by the given size argument.

This TSize object is changed to (cx + size.cx, cy + size.cy). Returns a reference to this object.

Definition at line 1539 of file geometry.h.

◆ operator-() [1/2]

TSize owl::TSize::operator- ( ) const
inline

Returns the TSize object (-cx, -cy). This object is not changed.

Definition at line 1487 of file geometry.h.

References TSize().

◆ operator-() [2/2]

TSize owl::TSize::operator- ( const TSize & size) const
inline

Calculates a negative offset to this TSize object using the given size argument as the displacement.

Returns the point (cx - size.cx, cy - size.cy). This object is not changed.

Definition at line 1529 of file geometry.h.

References TSize().

◆ operator-=()

TSize & owl::TSize::operator-= ( const TSize & size)
inline

Negatively offsets this TSize object by the given size argument.

This object is changed to (cx - size.cx, cy - size.cy). Returns a reference to this object.

Definition at line 1551 of file geometry.h.

◆ operator==()

bool owl::TSize::operator== ( const TSize & other) const
inline

Returns true if this TSize object is equal to the other TSize object; otherwise returns false.

Definition at line 1497 of file geometry.h.

References owl::ToBool().

◆ X()

int owl::TSize::X ( ) const
inline

Returns the width.

Definition at line 1469 of file geometry.h.

◆ Y()

int owl::TSize::Y ( ) const
inline

Returns the height.

Definition at line 1478 of file geometry.h.


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