API:System.Types.TSizeF

De RAD Studio API Documentation
Aller à : navigation, rechercher

Delphi

TSizeF = record

C++

struct TSizeF
{
  float cx;
  float cy;
public:
  TSizeF() _ALWAYS_INLINE {
    cx = cy = 0;
  }
  TSizeF(float w, float h) _ALWAYS_INLINE {
    cx = w;
    cy = h;
  }
  TSizeF(const TSize& s) _ALWAYS_INLINE {
    cx = s.cx;
    cy = s.cy;
  }
  bool operator ==(const TSizeF& sf) const {
    return _sameValue(cx, sf.cx) && _sameValue(cy, sf.cy);
  }
  bool operator !=(const TSizeF& sf) const {
    return !(sf == *this);
  }
  TSizeF operator +(const TSizeF& rhs) const {
    return TSizeF(rhs.cx + this->cx, rhs.cy + this->cy);
  }
  TSizeF operator -(const TSizeF& rhs) const {
    return TSizeF(this->cx - rhs.cx, this->cy - rhs.cy);
  }
  TSizeF& operator +=(const TSizeF& rhs) {
    this->cx += rhs.cx;
    this->cy += rhs.cy;
    return *this;
  }
  TSizeF& operator -=(const TSizeF& rhs) {
    this->cx -= rhs.cx;
    this->cy -= rhs.cy;
    return *this;
  }
  bool IsZero() const _ALWAYS_INLINE {
    return _sameValue(cx, 0.0F) && _sameValue(cy, 0.0F);
  }
  double Distance(const TSizeF& s2) const _ALWAYS_INLINE {
  #ifdef _WIN64 // RS-53817
    return System::hypotWA(s2.cx - this->cx, s2.cy - this->cy);
  #else
    return hypot(s2.cx - this->cx, s2.cy - this->cy);
  #endif
  }
  TSize Ceiling() const _ALWAYS_INLINE {
    return TSize((int32_t)ceil(this->cx), (int32_t)ceil(this->cy));
  }
  TSize Truncate() const _ALWAYS_INLINE {
    return TSize((int32_t)floor(this->cx), (int32_t)floor(this->cy));
  }
  TSize Round() const _ALWAYS_INLINE {
    return TSize((int32_t)floor(this->cx + 0.5), (int32_t)floor(this->cy + 0.5));
  }
  static bool __fastcall _sameValue(float a, float b) {
    const float SINGLE_RESOLUTION = 1.25E-6f;
    const float SINGLE_ZERO =6.25E-37f;
    float _epsilon = (float) ((fabs(a) > fabs(b)) ? fabs(a): fabs(b)) * SINGLE_RESOLUTION;
    if (_epsilon == 0)
      _epsilon = SINGLE_ZERO; // both a and b are very little, _epsilon was 0 because of normalization
    return (a > b) ? ((a - b) <= _epsilon): ((b - a) <= _epsilon);
  }
  __property float Width =  { read=cx,   write=cx  };
  __property float Height = { read=cy,   write=cy  };
};

Propriétés

Type Visibilité  Source Unité  Parent
record
struct
public
System.Types.pas
SystemTypes.h
System.Types System.Types

Description

Embarcadero Technologies ne possède pas d'informations supplémentaires pour le moment. Veuillez nous aider à documenter cette rubrique en utilisant la page Discussion !