42 #include "../fpoint.h"
57 FSize( qreal w, qreal h );
69 void scale( qreal w, qreal h, Qt::AspectRatioMode mode );
70 void scale(
const FSize &s, Qt::AspectRatioMode mode );
80 FSize &operator*=(
int c );
81 FSize &operator*=( qreal c );
82 FSize &operator/=(
int c );
83 FSize &operator/=( qreal c );
89 friend inline const FSize operator*(
const FSize &,
int );
90 friend inline const FSize operator*(
int,
const FSize & );
91 friend inline const FSize operator*(
const FSize &, qreal );
92 friend inline const FSize operator*( qreal,
const FSize & );
93 friend inline const FSize operator/(
const FSize &,
int );
94 friend inline const FSize operator/(
const FSize &, qreal );
97 static void warningDivByZero();
120 { wd=(qreal)w; ht=(qreal)h; }
123 {
return wd==0 && ht==0; }
126 {
return wd<1 || ht<1; }
129 {
return wd>=0 && ht>=0; }
150 { wd+=s.wd; ht+=s.ht;
return *
this; }
153 { wd-=s.wd; ht-=s.ht;
return *
this; }
155 inline FSize &FSize::operator*=(
int c )
156 { wd*=(qreal)c; ht*=(qreal)c;
return *
this; }
158 inline FSize &FSize::operator*=( qreal c )
159 { wd=(qreal)(wd*c); ht=(qreal)(ht*c);
return *
this; }
162 {
return s1.wd == s2.wd && s1.ht == s2.ht; }
165 {
return s1.wd != s2.wd || s1.ht != s2.ht; }
168 {
return FSize(s1.wd+s2.wd, s1.ht+s2.ht); }
171 {
return FSize(s1.wd-s2.wd, s1.ht-s2.ht); }
173 inline const FSize operator*(
const FSize &s,
int c )
174 {
return FSize(s.wd*c, s.ht*c); }
176 inline const FSize operator*(
int c,
const FSize &s )
177 {
return FSize(s.wd*c, s.ht*c); }
180 {
return FSize((qreal)(s.wd*c), (qreal)(s.ht*c)); }
182 inline const FSize operator*( qreal c,
const FSize &s )
183 {
return FSize((qreal)(s.wd*c), (qreal)(s.ht*c)); }
185 inline FSize &FSize::operator/=(
int c )
187 #if defined(QT_CHECK_MATH)
191 wd/=(qreal)c; ht/=(qreal)c;
195 inline FSize &FSize::operator/=( qreal c )
197 #if defined(QT_CHECK_MATH)
201 wd=(qreal)(wd/c); ht=(qreal)(ht/c);
205 inline const FSize operator/(
const FSize &s,
int c )
207 #if defined(QT_CHECK_MATH)
209 FSize::warningDivByZero();
211 return FSize(s.wd/c, s.ht/c);
216 #if defined(QT_CHECK_MATH)
218 FSize::warningDivByZero();
220 return FSize((qreal)(s.wd/c), (qreal)(s.ht/c));
225 return FSize( qMax(wd,otherSize.wd), qMax(ht,otherSize.ht) );
230 return FSize( qMin(wd,otherSize.wd), qMin(ht,otherSize.ht) );
FSize expandedTo(const FSize &) const
Definition: fsize.h:223
bool isNull() const
Definition: fsize.h:122
void setWidth(qreal w)
Definition: fsize.h:137
qreal width() const
Definition: fsize.h:131
FSize & operator-=(const FSize &)
Definition: fsize.h:152
FSize & operator+=(const FSize &)
Definition: fsize.h:149
friend bool operator!=(const FSize &, const FSize &)
Definition: fsize.h:164
The FSize class defines the size of a two-dimensional object.
Definition: fsize.h:45
void transpose()
Definition: fsize.cpp:127
bool isEmpty() const
Definition: fsize.h:125
qreal height() const
Definition: fsize.h:134
void scale(qreal w, qreal h, Qt::AspectRatioMode mode)
Definition: fsize.cpp:176
friend bool operator==(const FSize &, const FSize &)
Definition: fsize.h:161
void setHeight(qreal h)
Definition: fsize.h:140
friend const FSize operator+(const FSize &, const FSize &)
Definition: fsize.h:167
friend const FSize operator-(const FSize &, const FSize &)
Definition: fsize.h:170
FSize boundedTo(const FSize &) const
Definition: fsize.h:228
ScaleMode
Definition: fsize.h:50
qreal & rwidth()
Definition: fsize.h:143
bool isValid() const
Definition: fsize.h:128
qreal & rheight()
Definition: fsize.h:146
FSize()
Definition: fsize.h:116