|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef LEVELSELECTION_H
|
|
Toshihiro Shimizu |
890ddd |
#define LEVELSELECTION_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzQt includes
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/selection.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzCore includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tcommon.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// STD includes
|
|
Toshihiro Shimizu |
890ddd |
#include <set></set>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#undef DVAPI
|
|
Toshihiro Shimizu |
890ddd |
#undef DVVAR
|
|
Toshihiro Shimizu |
890ddd |
#ifdef TNZTOOLS_EXPORTS
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_EXPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_EXPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_IMPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_IMPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//====================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Forward declarations
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TVectorImage;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//====================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//*******************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// LevelSelection declaration
|
|
Toshihiro Shimizu |
890ddd |
//*******************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*!
|
|
Toshihiro Shimizu |
890ddd |
\brief Selection type for level-based multi-frame selections targetting
|
|
Toshihiro Shimizu |
890ddd |
primitives described by predefined filtering functions.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI LevelSelection : public TSelection
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
enum FramesMode //! Possible frames selection modes.
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
FRAMES_NONE, //!< No frame is selected.
|
|
Toshihiro Shimizu |
890ddd |
FRAMES_CURRENT, //!< Selects the (context-defined) current frame.
|
|
Toshihiro Shimizu |
890ddd |
FRAMES_SELECTED, //!< Selects the frames specified in \p TTool::getSelectedFrames().
|
|
Toshihiro Shimizu |
890ddd |
FRAMES_ALL, //!< Selects the whole level.
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
enum Filter //! Possible selection filters.
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
EMPTY, //!< Selection is empty - everyting is filtered out.
|
|
Toshihiro Shimizu |
890ddd |
WHOLE, //!< Selects everything - nothing is filtered out.
|
|
Toshihiro Shimizu |
890ddd |
SELECTED_STYLES, //!< Acts only entities with selected palette styles.
|
|
Toshihiro Shimizu |
890ddd |
BOUNDARY_STROKES, //!< Acts only on boundary strokes (applies only to vector images).
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
typedef std::set<int> styles_container; //!< Container of style indexes used together with the</int>
|
|
Toshihiro Shimizu |
890ddd |
//! \p SELECTED_STYLES filter.
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
LevelSelection(); //!< Constructs an empty level selection.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*! \remark The selection is hereby considered empty \a only if it either has
|
|
Toshihiro Shimizu |
890ddd |
FramesMode FRAMES_NONE or Filter EMPTY. It is user's responsibility
|
|
Toshihiro Shimizu |
890ddd |
to check whether nontrivial selections are empty or not. */
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool isEmpty() const; //!< Returns whether the selection is empty.
|
|
Toshihiro Shimizu |
890ddd |
void selectNone(); //!< Resets the selection to empty. This is functionally
|
|
Toshihiro Shimizu |
890ddd |
//! equivalent to <tt>operator=(LevelSelection());</tt>
|
|
Toshihiro Shimizu |
890ddd |
FramesMode framesMode() const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_framesMode;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
FramesMode &framesMode() //! Returns current frames selection mode.
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_framesMode;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Filter filter() const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_filter;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
Filter &filter() //! Returns current styles selection mode.
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_filter;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
const styles_container &styles() const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_styles;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
styles_container &styles()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_styles;
|
|
Toshihiro Shimizu |
890ddd |
} //!< Returns selected palette styles used with the
|
|
Toshihiro Shimizu |
890ddd |
//! \p SELECTED_STYLES filter.
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
FramesMode m_framesMode; //!< Selected level frames.
|
|
Toshihiro Shimizu |
890ddd |
Filter m_filter; //!< Selection filter.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
std::set<int> m_styles; //!< Selected palette styles used with the \p SELECTED_STYLES filter.</int>
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//*******************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// Related standalone functions
|
|
Toshihiro Shimizu |
890ddd |
//*******************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*!
|
|
Toshihiro Shimizu |
890ddd |
\brief Calculates the strokes on the boundary of a vector image.
|
|
Toshihiro Shimizu |
890ddd |
\details Boundary strokes are those with a side entirely adjacent
|
|
Toshihiro Shimizu |
890ddd |
to a region with style index \p 0.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
\return The indexes of boundary strokes in the input image.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
DVAPI std::vector<int> getBoundaryStrokes(TVectorImage &vi);</int>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*!
|
|
Toshihiro Shimizu |
890ddd |
\brief Applies a selection filter to a given vector image.
|
|
Toshihiro Shimizu |
890ddd |
\return The stroke indexes included in the filtered selection.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
\remark In case the filter is LevelSelection::BOUNDARY_STROKES, the resulting
|
|
Toshihiro Shimizu |
890ddd |
selection is composed of all strokes which are even partially
|
|
Toshihiro Shimizu |
890ddd |
adjacent to a region with style index \p 0.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
\sa Function getBoundaryStrokes().
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
DVAPI std::vector<int> getSelectedStrokes(</int>
|
|
Toshihiro Shimizu |
890ddd |
TVectorImage &vi, //!< Vector image whose strokes will be selected.
|
|
Toshihiro Shimizu |
890ddd |
const LevelSelection &levelSelection //!< Selection filter for the specified image.
|
|
Toshihiro Shimizu |
890ddd |
);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif // LEVELSELECTION_H
|