diff --git a/src/graphic/QskGraphic.cpp b/src/graphic/QskGraphic.cpp index e47570fb..e893ac18 100644 --- a/src/graphic/QskGraphic.cpp +++ b/src/graphic/QskGraphic.cpp @@ -578,6 +578,24 @@ QSizeF QskGraphic::defaultSize() const return boundingRect().size(); } +qreal QskGraphic::heightForWidth( qreal width ) const +{ + const auto sz = defaultSize(); + if ( sz.isEmpty() ) + return 0; + + return sz.height() * width / sz.width(); +} + +qreal QskGraphic::widthForHeight( qreal height ) const +{ + const auto sz = defaultSize(); + if ( sz.isEmpty() ) + return 0; + + return sz.width() * height / sz.height(); +} + void QskGraphic::render( QPainter* painter ) const { render( painter, QskColorFilter() ); diff --git a/src/graphic/QskGraphic.h b/src/graphic/QskGraphic.h index 987fa52c..4644079d 100644 --- a/src/graphic/QskGraphic.h +++ b/src/graphic/QskGraphic.h @@ -88,6 +88,9 @@ class QSK_EXPORT QskGraphic : public QPaintDevice void setDefaultSize( const QSizeF& ); QSizeF defaultSize() const; + qreal heightForWidth( qreal width ) const; + qreal widthForHeight( qreal height ) const; + void setRenderHint( RenderHint, bool on = true ); bool testRenderHint( RenderHint ) const;