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

palapeli/libpala

  • Pala
  • Slicer
Public Types | Public Member Functions | Protected Member Functions | List of all members
Pala::Slicer Class Referenceabstract

#include <Pala/Slicer>

Inheritance diagram for Pala::Slicer:
Inheritance graph
[legend]

Public Types

enum  SlicerFlag { NoFlags = 0x0, AllowFullTransparency = 0x1 }
 

Public Member Functions

 Slicer (QObject *parent=0, const QVariantList &args=QVariantList())
 
virtual ~Slicer ()
 
SlicerFlags flags () const
 
QList< const Pala::SlicerMode * > modes () const
 
bool process (Pala::SlicerJob *job)
 
QMap< QByteArray, const
Pala::SlicerProperty * > 
properties () const
 
QList< const
Pala::SlicerProperty * > 
propertyList () const
 

Protected Member Functions

void addMode (Pala::SlicerMode *mode)
 
void addProperty (const QByteArray &key, Pala::SlicerProperty *property)
 
virtual bool run (Pala::SlicerJob *job)=0
 
void setFlags (SlicerFlags flags)
 

Detailed Description

Representation of a slicing algorithm.

This class represents a slicing algorithm. It has to be subclassed by slicing plugin developers. Subclasses need to implement

  • the constructor (where the slicer's properties and, if used, the modes have to be instantiated)
  • the run() method (where the actual slicing is performed).

Additionally, the class must be flagged as entry point into the plugin, with the following code:

class MySlicer : public Pala::Slicer { ... };
#include <KPluginFactory>
#include <KPluginLoader>
K_PLUGIN_FACTORY(MySlicerFactory, registerPlugin<MySlicer>();)
K_EXPORT_PLUGIN(MySlicerFactory("myslicer"))

In the last line, put inside the string literal the file name of the plugin library (e.g. myslicer is the name for a library libmyslicer.so on unixoid systems, or myslicer.dll on Windows systems).

Definition at line 58 of file slicer.h.

Member Enumeration Documentation

enum Pala::Slicer::SlicerFlag

Behavioral flags of a slicer.

These flags can be used to programmatically configure the behavior of libpala for a single slicer. You should only set the slicer's flags once in the constructor, and not modify it later. (The latter might cause unexpected behavior.)

See also
setFlags
Enumerator
NoFlags 
AllowFullTransparency 

By default, libpala will increase the minimum alpha value of input images to avoid invisible pieces. Set this flag if you rely on the alpha channel in your slicing algorithm.

Definition at line 67 of file slicer.h.

Constructor & Destructor Documentation

Pala::Slicer::Slicer ( QObject *  parent = 0,
const QVariantList &  args = QVariantList() 
)
explicit

Constructs a new Slicer object.

In any subclass, the constructor signature has to be the same (due to the way the plugin loader works). The arguments should be passed to this constructor and ignored by the subclass implementation, as their format might change without notice in future versions.

Definition at line 36 of file slicer.cpp.

Pala::Slicer::~Slicer ( )
virtual

Deletes this slicer, and all properties and modes which have been added with addProperty() and addMode().

Definition at line 43 of file slicer.cpp.

Member Function Documentation

void Pala::Slicer::addMode ( Pala::SlicerMode *  mode)
protected

Add an operation mode to this slicer.

The slicer will take care of destructing the given Pala::SlicerMode instance when it is destructed. You may use modes e.g. if your slicer includes different slicing algorithms at once which might need a different set of properties (see Pala::SlicerMode documentation for details). If you choose not to use modes, just ignore this function and all other functions concerning modes.

Warning
It is not safe to add new modes outside the constructor of a Pala::Slicer subclass.
Since
libpala 1.2 (KDE SC 4.6)

Definition at line 90 of file slicer.cpp.

void Pala::Slicer::addProperty ( const QByteArray &  key,
Pala::SlicerProperty *  property 
)
protected

Add the given property to the property list of this slicer.

The slicer will take care of destructing the given Pala::SlicerProperty instance when it is destructed. Use this method in the subclass constructors to fill the slicer with properties. Properties let the user control how the slicing is done.

Warning
It is not safe to add new properties outside the constructor of a Pala::Slicer subclass.

Definition at line 73 of file slicer.cpp.

Pala::Slicer::SlicerFlags Pala::Slicer::flags ( ) const

Definition at line 68 of file slicer.cpp.

QList< const Pala::SlicerMode * > Pala::Slicer::modes ( ) const
Since
libpala 1.2 (KDE SC 4.6)

Definition at line 50 of file slicer.cpp.

bool Pala::Slicer::process ( Pala::SlicerJob *  job)

Definition at line 111 of file slicer.cpp.

QMap< QByteArray, const Pala::SlicerProperty * > Pala::Slicer::properties ( ) const
Deprecated:
because sorting order is not right

Definition at line 55 of file slicer.cpp.

QList< const Pala::SlicerProperty * > Pala::Slicer::propertyList ( ) const
Since
libpala 1.2 (KDE SC 4.6)

Definition at line 63 of file slicer.cpp.

virtual bool Pala::Slicer::run ( Pala::SlicerJob *  job)
protectedpure virtual

The slicing algorithm.

Implement the slicing algorithm in this method. The slicing algorithm should always respect the current values of the slicer's properties, as defined through the addProperty() method.

Returns
whether the operation has been completed successfully
See also
Pala::SlicerJob
void Pala::Slicer::setFlags ( SlicerFlags  flags)
protected
See also
Pala::Slicer::SlicerFlags

Definition at line 106 of file slicer.cpp.


The documentation for this class was generated from the following files:
  • slicer.h
  • slicer.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:44:52 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