diff --git a/src/graphic/QskGraphic.cpp b/src/graphic/QskGraphic.cpp index 84b8fd02..e4d01578 100644 --- a/src/graphic/QskGraphic.cpp +++ b/src/graphic/QskGraphic.cpp @@ -611,6 +611,15 @@ qreal QskGraphic::widthForHeight( qreal height ) const 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 { render( painter, QskColorFilter() ); diff --git a/src/graphic/QskGraphic.h b/src/graphic/QskGraphic.h index 2e96e5c4..f7e5f6ef 100644 --- a/src/graphic/QskGraphic.h +++ b/src/graphic/QskGraphic.h @@ -101,6 +101,8 @@ class QSK_EXPORT QskGraphic : public QPaintDevice void setDefaultSize( const QSizeF& ); QSizeF defaultSize() const; + qreal aspectRatio() const; + qreal heightForWidth( qreal width ) const; qreal widthForHeight( qreal height ) const;