palapeli/libpala
#include <Pala/SlicerJob>
Public Member Functions | |
SlicerJob (const QImage &image, const QMap< QByteArray, QVariant > &args) | |
virtual | ~SlicerJob () |
void | addPiece (int pieceID, const QImage &image, const QPoint &offset=QPoint()) |
void | addPieceFromMask (int pieceID, const QImage &mask, const QPoint &offset=QPoint()) |
void | addRelation (int pieceID1, int pieceID2) |
QVariant | argument (const QByteArray &key) const |
QImage | image () const |
const Pala::SlicerMode * | mode () const |
QMap< int, QPoint > | pieceOffsets () const |
QMap< int, QImage > | pieces () const |
QList< QPair< int, int > > | relations () const |
void | setMode (const Pala::SlicerMode *mode) |
Protected Member Functions | |
void | respectSlicerFlags (int flags) |
Detailed Description
Representation of a single run of a slicing algorithm.
This class holds everything that concerns a single slicing job: It starts out with the image and the arguments (i.e., the values that the user has chosen for the properties defined by the slicing algorithm). The Pala::Slicer::run method should then use this information to slice the image into pieces and define neighborship relations between them.
- See also
- Pala::Slicer::run
Definition at line 46 of file slicerjob.h.
Constructor & Destructor Documentation
|
explicit |
Creates a new slicer job.
Definition at line 42 of file slicerjob.cpp.
|
virtual |
Deletes this slicer job.
Definition at line 49 of file slicerjob.cpp.
Member Function Documentation
void Pala::SlicerJob::addPiece | ( | int | pieceID, |
const QImage & | image, | ||
const QPoint & | offset = QPoint() |
||
) |
Add a generated piece to the result set of this slicing job.
The pieceID can later be used to refer to this piece in the addRelation() method. The given offset describes the position of the top-left edge of the given piece image in the complete image.
- Note
- It is good practice to make the piece image as small as possible, and use the offset to move it to the right position in the image's coordinates. Big images might result in bad performance, even if most of the images is fully transparent.
- Warning
- You should not use negative piece IDs. These might be used internally.
Definition at line 103 of file slicerjob.cpp.
void Pala::SlicerJob::addPieceFromMask | ( | int | pieceID, |
const QImage & | mask, | ||
const QPoint & | offset = QPoint() |
||
) |
Generate a piece, and add it to the result set of this slicing job.
The pieceID can later be used to refer to this piece in the addRelation() method. The given offset describes the position of the top-left edge of the given mask in the complete image.
- Note
- It is good practice to make the mask as small as possible, and use the offset to move it to the right position in the image's coordinates. Big masks result in big piece images, which might in turn result in bad performance, even if most of the images is fully transparent.
- Warning
- You should not use negative piece IDs. These might be used internally.
Definition at line 122 of file slicerjob.cpp.
void Pala::SlicerJob::addRelation | ( | int | pieceID1, |
int | pieceID2 | ||
) |
Define a neighborship relation between two pieces.
Neighborship relations are crucial for the gameplay: Palapeli needs to know somehow which pieces are neighbors, to let these pieces snap together when they're near each other.
Definition at line 132 of file slicerjob.cpp.
QVariant Pala::SlicerJob::argument | ( | const QByteArray & | key | ) | const |
Returns an argument of this job, i.e. the value that the user has chosen for the slicing algorithm's property with the given key.
Definition at line 54 of file slicerjob.cpp.
QImage Pala::SlicerJob::image | ( | ) | const |
Returns the image that should be sliced.
Definition at line 59 of file slicerjob.cpp.
const Pala::SlicerMode * Pala::SlicerJob::mode | ( | ) | const |
Returns the selected slicer mode, or 0 if the slicer does not define any slicer modes.
Definition at line 64 of file slicerjob.cpp.
Definition at line 74 of file slicerjob.cpp.
Definition at line 69 of file slicerjob.cpp.
Definition at line 79 of file slicerjob.cpp.
|
protected |
Definition at line 89 of file slicerjob.cpp.
void Pala::SlicerJob::setMode | ( | const Pala::SlicerMode * | mode | ) |
Definition at line 84 of file slicerjob.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:19:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.