QskGraphic::aspectRatio added
This commit is contained in:
parent
0b5b622d1a
commit
3842ca36a3
|
@ -611,6 +611,15 @@ qreal QskGraphic::widthForHeight( qreal height ) const
|
||||||
return sz.width() * height / sz.height();
|
return sz.width() * height / sz.height();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qreal QskGraphic::aspectRatio() const
|
||||||
|
{
|
||||||
|
const auto sz = defaultSize();
|
||||||
|
if ( sz.isEmpty() )
|
||||||
|
return 1.0;
|
||||||
|
|
||||||
|
return sz.width() / sz.height();
|
||||||
|
}
|
||||||
|
|
||||||
void QskGraphic::render( QPainter* painter ) const
|
void QskGraphic::render( QPainter* painter ) const
|
||||||
{
|
{
|
||||||
render( painter, QskColorFilter() );
|
render( painter, QskColorFilter() );
|
||||||
|
|
|
@ -101,6 +101,8 @@ class QSK_EXPORT QskGraphic : public QPaintDevice
|
||||||
void setDefaultSize( const QSizeF& );
|
void setDefaultSize( const QSizeF& );
|
||||||
QSizeF defaultSize() const;
|
QSizeF defaultSize() const;
|
||||||
|
|
||||||
|
qreal aspectRatio() const;
|
||||||
|
|
||||||
qreal heightForWidth( qreal width ) const;
|
qreal heightForWidth( qreal width ) const;
|
||||||
qreal widthForHeight( qreal height ) const;
|
qreal widthForHeight( qreal height ) const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue