Files
sbox-public/engine/Definitions/tools/QtWidgets/QGraphicsScene.def
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

47 lines
1.1 KiB
Modula-2

#include "sbox/graphicsscene.h"
native class QGraphicsScene as Native.QGraphicsScene : QObject
{
QRectF sceneRect();
void setSceneRect(QRectF rect);
QRectF itemsBoundingRect();
void addItem(QGraphicsItem item);
void removeItem(QGraphicsItem item);
inline void setSelectionArea( QGraphicsView pView, QRectF rect )
{
QPainterPath selectionPath;
selectionPath.addPolygon( pView->mapToScene( rect.toRect() ) );
selectionPath.closeSubpath();
self->setSelectionArea( selectionPath );
}
inline bool Capture( string path )
{
QRectF sceneRect = self->itemsBoundingRect();
QSize imageSize( sceneRect.width(), sceneRect.height() );
QImage image( imageSize, QImage::Format_ARGB32 );
image.fill( Qt::transparent );
QPainter painter( &image );
painter.setRenderHint( QPainter::Antialiasing, true );
painter.setRenderHint( QPainter::SmoothPixmapTransform, true );
self->render( &painter, QRectF(), sceneRect );
painter.end();
return image.save( path, "PNG" );
}
}
native class ManagedGraphicsScene : QGraphicsScene
{
static QGraphicsScene Create( QObject parent, Editor.GraphicsScene obj ); [new]
}
managed class Editor.GraphicsScene
{
}