QGIS/python/PyQt6/3d/auto_generated/qgstextureatlasgenerator.sip.in
2025-09-29 08:16:55 +10:00

155 lines
4.5 KiB
Plaintext

/************************************************************************
* This file has been generated automatically from *
* *
* src/3d/qgstextureatlasgenerator.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsTextureAtlas
{
%Docstring(signature="appended")
Encapsulates a texture atlas.
:py:class:`QgsTextureAtlas` contains the packed regions for aggregated
texture atlases, and optionally the packed texture map.
See :py:class:`QgsTextureAtlasGenerator` for a class which automatically
creates texture atlases.
.. versionadded:: 4.0
%End
%TypeHeaderCode
#include "qgstextureatlasgenerator.h"
%End
public:
QgsTextureAtlas();
~QgsTextureAtlas();
QgsTextureAtlas( const QgsTextureAtlas &other );
bool isValid() const;
%Docstring
Returns ``True`` if the atlas is valid.
%End
QSize atlasSize() const;
%Docstring
Returns the total size required for the atlas, i.e. the total size for
the packed images and rectangles.
%End
QRect rect( int index ) const;
%Docstring
Returns the packed rectangle for the texture with the specified
``index``.
:raises IndexError: if no texture with the specified index exists.
%End
%MethodCode
const int count = sipCpp->count();
if ( a0 < 0 || a0 >= count )
{
PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
sipIsErr = 1;
}
else
{
return sipConvertFromNewType( new QRect( sipCpp->rect( a0 ) ), sipType_QRect, Py_None );
}
%End
QImage renderAtlasTexture() const;
%Docstring
Renders the combined texture atlas, containing all source images.
.. note::
This may be a null image if the atlas was created with rectangles alone.
%End
QImage renderDebugTexture() const;
%Docstring
Renders a debug texture.
The debug texture renders all packed rectangles with a unique color, and
can be used to visualize the solution.
%End
int count() const;
%Docstring
Returns the number of textures in the atlas.
%End
Py_ssize_t __len__() const;
%Docstring
Returns the number of textures in the atlas.
%End
%MethodCode
sipRes
= sipCpp->count();
%End
};
class QgsTextureAtlasGenerator
{
%Docstring(signature="appended")
Generates texture atlases by efficient packing of multiple input
rectangles/images.
:py:class:`QgsTextureAtlasGenerator` can be used to pack either images
or raw rectangles. The static :py:func:`~createFromRects` or
:py:func:`~createFromImages` methods should be called with the source
images or rectangles, which will return a :py:class:`QgsTextureAtlas`
containing the results.
.. versionadded:: 4.0
%End
%TypeHeaderCode
#include "qgstextureatlasgenerator.h"
%End
public:
static QgsTextureAtlas createFromRects( const QVector< QRect > &rectangles, int maxSide = 1000 );
%Docstring
Creates a texture atlas for a set of ``rectangles``.
This method should be used when the generator is used to pack rectangle
shapes only. No image will be associated with the rectangle.
The ``maxSide`` argument specifies the maximum permitted side size for
the atlas. The calculated solution can only be less than or equal to
this size - if it cannot fit, then algorithm will gracefully fail and
return an invalid :py:class:`QgsTextureAtlas`.
.. seealso:: :py:func:`createFromImages`
%End
static QgsTextureAtlas createFromImages( const QVector< QImage > &images, int maxSide = 1000 );
%Docstring
Creates a texture atlas for a set of ``images``.
The ``maxSide`` argument specifies the maximum permitted side size for
the atlas. The calculated solution can only be less than or equal to
this size - if it cannot fit, then algorithm will gracefully fail and
return an invalid :py:class:`QgsTextureAtlas`.
.. seealso:: :py:func:`createFromRects`
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/3d/qgstextureatlasgenerator.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/