• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegames API Reference
  • KDE Home
  • Contact Us
 

palapeli/libpala

  • Pala
  • SlicerJob
Public Member Functions | Protected Member Functions | List of all members
Pala::SlicerJob Class Reference

#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

Pala::SlicerJob::SlicerJob ( const QImage &  image,
const QMap< QByteArray, QVariant > &  args 
)
explicit

Creates a new slicer job.

Definition at line 42 of file slicerjob.cpp.

Pala::SlicerJob::~SlicerJob ( )
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.

QMap< int, QPoint > Pala::SlicerJob::pieceOffsets ( ) const

Definition at line 74 of file slicerjob.cpp.

QMap< int, QImage > Pala::SlicerJob::pieces ( ) const

Definition at line 69 of file slicerjob.cpp.

QList< QPair< int, int > > Pala::SlicerJob::relations ( ) const

Definition at line 79 of file slicerjob.cpp.

void Pala::SlicerJob::respectSlicerFlags ( int  flags)
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:
  • slicerjob.h
  • slicerjob.cpp
This file is part of the KDE documentation.
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.

palapeli/libpala

Skip menu "palapeli/libpala"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal