Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cRectI Class Reference

#include <cRectI.h>

Inheritance diagram for GrayLib::cRectI:
GrayLib::cRectNT< int > GrayLib::cRectT< TYPE >

Public Member Functions

 cRectI () noexcept
 
 cRectI (DVALUE_t nleft, DVALUE_t ntop, DVALUE_t nright=0, DVALUE_t nbottom=0)
 
bool IsInsideX (DVALUE_t x) const noexcept
 
bool IsInsideY (DVALUE_t y) const noexcept
 
bool PtInRect (DVALUE_t x, DVALUE_t y) const noexcept
 
bool PtInRect (const cPoint2i &pt) const noexcept
 
bool ClampPtInRectX (cPoint2i &pt) const noexcept
 
bool IsInsideMe (const cRectI &rect) const noexcept
 
DVALUE_t GetOverlapX (const cRectI &rect) const noexcept
 
DVALUE_t GetOverlapY (const cRectI &rect) const noexcept
 
bool IsOverlapped (const cRectI &r, DVALUE_t minx, DVALUE_t miny) const noexcept
 
bool IsOverlapped (const cRectI &rect) const noexcept
 
bool ClampPtInRectI (cPoint2f &pt) const
 
void UnionPoint (DVALUE_t x, DVALUE_t y)
 
void OffsetPositive ()
 
void SnapToGrid (DVALUE_t iSizeXY) noexcept
 
cPoint2i GetRectCorner (DIR_TYPE eDir) const
 
cWinSize get_RectSize () const noexcept
 
ITERATE_t SetRectStr (const GChar_t *pszVal, bool bSizes=false)
 
cString get_RectStr (void) const
 
ITERATE_t v_SetRect (const cVariant &vVal, ITERATE_t i=0)
 
void v_GetRect (cVariant &vVal) const
 
- Public Member Functions inherited from GrayLib::cRectNT< int >
 cRectNT () noexcept
 
 cRectNT (int x1, int y1, int x2, int y2) noexcept
 
 cRectNT (const SUPER_t &rect) noexcept
 
int get_X () const noexcept
 
int X () const noexcept
 
int get_Y () const noexcept
 
int Y () const noexcept
 
int get_Width () const noexcept
 
int Width () const noexcept
 
int get_Height () const noexcept
 
int Height () const noexcept
 
int get_Radius () const noexcept
 
bool IsRectEmpty () const noexcept
 
void SetLT (int nLeft2, int nTop2) noexcept
 
void SetWidth (int cx) noexcept
 
void SetHeight (int cy) noexcept
 
void SetWH (int nWidth=0, int nHeight=0) noexcept
 
void InflateRectX (int dx) noexcept
 
void InflateRectY (int dy) noexcept
 
void InflateRectBoth (int dx, int dy) noexcept
 
void UnionRect (const THIS_t &rect) noexcept
 
void UnionRectE (const THIS_t &rect) noexcept
 
bool IntersectRect (const THIS_t &rect) noexcept
 
void RectClamp (int cx=(int) INT_MAX, int cy=(int) INT_MAX) noexcept
 
void NormalizeRectClamp (int cx=(int) INT_MAX, int cy=(int) INT_MAX) noexcept
 
- Public Member Functions inherited from GrayLib::cRectT< TYPE >
 cRectT () noexcept
 
 cRectT (TYPE x1, TYPE y1, TYPE x2, TYPE y2) noexcept
 
 cRectT (const THIS_t &rect) noexcept
 
TYPE get_DiffX () const noexcept
 
TYPE get_DiffY () const noexcept
 
cVecT2< TYPEget_Center () const noexcept
 
float get_AspectRatio () const noexcept
 
bool IsEqual (const THIS_t &rect) const noexcept
 
bool operator== (const THIS_t &rect) const noexcept
 
bool operator!= (const THIS_t &rect) const noexcept
 
bool isRectNull () const noexcept
 
bool isRectNormal () const noexcept
 
bool isRectNormalE () const noexcept
 
bool IsInRangeX (TYPE value) const noexcept
 
bool IsInRangeY (TYPE value) const noexcept
 
void SetRectNull () noexcept
 
void SetRectWH (TYPE nLeft, TYPE nTop, TYPE nWidth, TYPE nHeight) noexcept
 
void SetRectEmptyX () noexcept
 
void SetRect4 (TYPE nLeft, TYPE nTop, TYPE nRight, TYPE nBottom) noexcept
 
void SetRectAsPt (TYPE x, TYPE y) noexcept
 
void SetRectAsPt (const POINT_t &pt) noexcept
 
void SetRectFromSphere (TYPE x, TYPE y, TYPE nRadius) noexcept
 
HRESULT SetRectAsStr (const char *pszStr)
 
void OffsetRectX (TYPE dx) noexcept
 
void OffsetRectY (TYPE dy) noexcept
 
void OffsetRect (TYPE dx, TYPE dy) noexcept
 
void UnionX (TYPE x) noexcept
 
void UnionY (TYPE y) noexcept
 
void Union2 (TYPE x, TYPE y) noexcept
 
void Union4 (const THIS_t &rect) noexcept
 
void ScrollInRangeX (TYPE value) noexcept
 
void ScrollInRangeY (TYPE value)
 
void SetRectNotEmpty (TYPE iMin=10) noexcept
 
void ScaleX (float mx) noexcept
 
void ScaleY (float my) noexcept
 
void Scale (float mx, float my) noexcept
 
void AddScaleY () noexcept
 
void NormalizeRect () noexcept
 

Additional Inherited Members

- Public Types inherited from GrayLib::cRectT< TYPE >
typedef TYPE DVALUE_t
 Dimension value type. More...
 
- Public Attributes inherited from GrayLib::cRectT< TYPE >
TYPE left
 
TYPE top
 
TYPE right
 
TYPE bottom
 

Detailed Description

a normalized 2d int rectangle. 4 2d points. Same order and basic element sizing as _WIN32 RECT and MFC CRect

Constructor & Destructor Documentation

◆ cRectI() [1/2]

GrayLib::cRectI::cRectI ( )
inlinenoexcept

◆ cRectI() [2/2]

GrayLib::cRectI::cRectI ( DVALUE_t  nleft,
DVALUE_t  ntop,
DVALUE_t  nright = 0,
DVALUE_t  nbottom = 0 
)
inline

Member Function Documentation

◆ ClampPtInRectI()

bool GrayLib::cRectI::ClampPtInRectI ( cPoint2f pt) const
inline

This is slightly weird because integer rectangles are not normally inclusive

◆ ClampPtInRectX()

bool GrayLib::cRectI::ClampPtInRectX ( cPoint2i pt) const
inlinenoexcept

◆ get_RectSize()

cWinSize GrayLib::cRectI::get_RectSize ( ) const
inlinenoexcept

◆ get_RectStr()

cString GrayLib::cRectI::get_RectStr ( void  ) const

◆ GetOverlapX()

DVALUE_t GrayLib::cRectI::GetOverlapX ( const cRectI rect) const
inlinenoexcept

◆ GetOverlapY()

DVALUE_t GrayLib::cRectI::GetOverlapY ( const cRectI rect) const
inlinenoexcept

◆ GetRectCorner()

cPoint2i GrayLib::cRectI::GetRectCorner ( DIR_TYPE  eDir) const

Get the point if a directional corner of the cRectI.

◆ IsInsideMe()

bool GrayLib::cRectI::IsInsideMe ( const cRectI rect) const
inlinenoexcept

Is &rect inside this ? equal=inside ASSUME: Normalized rect

◆ IsInsideX()

bool GrayLib::cRectI::IsInsideX ( DVALUE_t  x) const
inlinenoexcept

non-inclusive of right. ASSUME normalized!

◆ IsInsideY()

bool GrayLib::cRectI::IsInsideY ( DVALUE_t  y) const
inlinenoexcept

non-inclusive of bottom. ASSUME normalized!

◆ IsOverlapped() [1/2]

bool GrayLib::cRectI::IsOverlapped ( const cRectI r,
DVALUE_t  minx,
DVALUE_t  miny 
) const
inlinenoexcept

are the 2 rectangles overlapped by at least this amount?

◆ IsOverlapped() [2/2]

bool GrayLib::cRectI::IsOverlapped ( const cRectI rect) const
inlinenoexcept

are the 2 rectangles overlapped at all? NON inclusive rectangle. ASSUME: Normalized rectangle

◆ OffsetPositive()

void GrayLib::cRectI::OffsetPositive ( )
inline

◆ PtInRect() [1/2]

bool GrayLib::cRectI::PtInRect ( const cPoint2i pt) const
inlinenoexcept

same as MFC PtInRect() NON inclusive rect! Is the point in the rectangle ? A point is within CRect if it lies on the left or top side or is within all four sides. A point on the right or bottom side is outside CRect.

Note
The rectangle must be normalized or this function may fail. You can call NormalizeRect to normalize the rectangle before calling this function.

◆ PtInRect() [2/2]

bool GrayLib::cRectI::PtInRect ( DVALUE_t  x,
DVALUE_t  y 
) const
inlinenoexcept

NON inclusive rect! Is the point in the rectangle ?

◆ SetRectStr()

ITERATE_t GrayLib::cRectI::SetRectStr ( const GChar_t pszVal,
bool  bSizes = false 
)

parse reading the rectangle. for use of char ??

◆ SnapToGrid()

void GrayLib::cRectI::SnapToGrid ( DVALUE_t  iSizeXY)
inlinenoexcept

assume iSizeXY is a power of 2

◆ UnionPoint()

void GrayLib::cRectI::UnionPoint ( DVALUE_t  x,
DVALUE_t  y 
)
inline

Inflate this rect to include this point. ASSUME this is a NON inclusive rect! ASSUME normalized!

◆ v_GetRect()

void GrayLib::cRectI::v_GetRect ( cVariant vVal) const

◆ v_SetRect()

ITERATE_t GrayLib::cRectI::v_SetRect ( const cVariant vVal,
ITERATE_t  i = 0 
)

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