6#include "QskGraphicTextureFactory.h"
7#include "QskTextureRenderer.h"
9#include <qquickwindow.h>
11QskGraphicTextureFactory::QskGraphicTextureFactory()
15QskGraphicTextureFactory::QskGraphicTextureFactory(
17 : m_graphic( graphic )
22QskGraphicTextureFactory::~QskGraphicTextureFactory()
26void QskGraphicTextureFactory::setGraphic(
const QskGraphic& graphic )
31QskGraphic QskGraphicTextureFactory::graphic()
const
36void QskGraphicTextureFactory::setColorFilter(
39 m_colorFilter = colorFilter;
47void QskGraphicTextureFactory::setSize(
const QSize& size )
52QSize QskGraphicTextureFactory::size()
const
57QSGTexture* QskGraphicTextureFactory::createTexture( QQuickWindow* window )
const
63 : m_graphic( graphic )
68 void paint( QPainter* painter,
const QSize& size )
override
70 const QRect rect( 0, 0, size.width(), size.height() );
71 m_graphic.render( painter, rect, m_filter );
79 PaintHelper helper( m_graphic, m_colorFilter );
80 return QskTextureRenderer::createPaintedTexture( window, m_size, &helper );
83QSize QskGraphicTextureFactory::textureSize()
const
88int QskGraphicTextureFactory::textureByteCount()
const
90 return m_size.width() * m_size.height() * 4;
93QImage QskGraphicTextureFactory::image()
const
95 return m_graphic.toImage( m_size, Qt::KeepAspectRatio );
A paint device for scalable graphics.