|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef RASTER_SELECTION_H
|
|
Toshihiro Shimizu |
890ddd |
#define RASTER_SELECTION_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzCore includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tcommon.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tpalette.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "ttoonzimage.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "trasterimage.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tstroke.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tdata.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzLib includes
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/ttileset.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/txshcell.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzQt includes
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/selection.h"
|
|
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 |
// forward declaration
|
|
Toshihiro Shimizu |
890ddd |
class TTileSetCM32;
|
|
Toshihiro Shimizu |
890ddd |
class StrokesData;
|
|
Toshihiro Shimizu |
890ddd |
class RasterImageData;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// RasterSelection
|
|
Toshihiro Shimizu |
890ddd |
//! Selection of TToonzImage and TRasterImage.
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI RasterSelection : public TSelection
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TImageP m_currentImage;
|
|
Toshihiro Shimizu |
890ddd |
TXshCell m_currentImageCell;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TPaletteP m_oldPalette;
|
|
Toshihiro Shimizu |
890ddd |
TRectD m_selectionBbox;
|
|
Toshihiro Shimizu |
890ddd |
vector<tstroke> m_strokes;</tstroke>
|
|
Toshihiro Shimizu |
890ddd |
vector<tstroke> m_originalStrokes;</tstroke>
|
|
Toshihiro Shimizu |
890ddd |
TAffine m_affine;
|
|
Toshihiro Shimizu |
890ddd |
TPoint m_startPosition;
|
|
Toshihiro Shimizu |
890ddd |
TRasterP m_floatingSelection;
|
|
Toshihiro Shimizu |
890ddd |
TRasterP m_originalfloatingSelection;
|
|
Toshihiro Shimizu |
890ddd |
TFrameId m_fid;
|
|
Toshihiro Shimizu |
890ddd |
int m_transformationCount;
|
|
Toshihiro Shimizu |
890ddd |
bool m_isPastedSelection;
|
|
Toshihiro Shimizu |
890ddd |
bool m_noAntialiasing;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
void pasteSelection(const RasterImageData *data);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
RasterSelection();
|
|
Toshihiro Shimizu |
890ddd |
RasterSelection(const RasterSelection &src);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TSelection *clone() const;
|
|
Toshihiro Shimizu |
890ddd |
void notify();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
const TImageP &getCurrentImage() const { return m_currentImage; }
|
|
Toshihiro Shimizu |
890ddd |
const TXshCell &getCurrentImageCell() const { return m_currentImageCell; }
|
|
Toshihiro Shimizu |
890ddd |
void setCurrentImage(const TImageP &img, const TXshCell &imageCell)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_currentImage = img, m_currentImageCell = imageCell;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setStrokes(const vector<tstroke> &strokes) { m_strokes = strokes; }</tstroke>
|
|
Toshihiro Shimizu |
890ddd |
vector<tstroke> getStrokes() const { return m_strokes; }</tstroke>
|
|
Toshihiro Shimizu |
890ddd |
vector<tstroke> getOriginalStrokes() const { return m_originalStrokes; }</tstroke>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setTransformation(const TAffine &affine) { m_affine = affine; }
|
|
Toshihiro Shimizu |
890ddd |
TAffine getTransformation() const { return m_affine; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setStartPosition(const TPoint &position) { m_startPosition = position; }
|
|
Toshihiro Shimizu |
890ddd |
TPoint getStartPosition() const { return m_startPosition; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setFloatingSeletion(const TRasterP &floatingSelection) { m_floatingSelection = floatingSelection; }
|
|
Toshihiro Shimizu |
890ddd |
TRasterP getFloatingSelection() const { return m_floatingSelection; }
|
|
Toshihiro Shimizu |
890ddd |
TRasterP getOriginalFloatingSelection() const { return m_originalfloatingSelection; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setFrameId(const TFrameId &fid) { m_fid = fid; }
|
|
Toshihiro Shimizu |
890ddd |
TFrameId getFrameId() const { return m_fid; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int getTransformationCount() const { return m_transformationCount; }
|
|
Toshihiro Shimizu |
890ddd |
void setTransformationCount(int transformationCount) { m_transformationCount = transformationCount; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setNoAntialiasing(bool value) { m_noAntialiasing = value; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool isPastedSelection() const { return m_isPastedSelection; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*! Returns strokes bounding box.*/
|
|
Toshihiro Shimizu |
890ddd |
TRectD getStrokesBound(std::vector<tstroke> strokes) const;</tstroke>
|
|
Toshihiro Shimizu |
890ddd |
/*! Returns m_strokes bounding box in world coordinates.
|
|
Toshihiro Shimizu |
890ddd |
The bounding box results transformed if the selection is transformed.*/
|
|
Toshihiro Shimizu |
890ddd |
TRectD getSelectionBound() const;
|
|
Toshihiro Shimizu |
890ddd |
/*! Returns m_originlStrokes bounding box in world coordinates.*/
|
|
Toshihiro Shimizu |
890ddd |
TRectD getOriginalSelectionBound() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*! Return \b m_selectionBbox.
|
|
Toshihiro Shimizu |
890ddd |
Can be different from getSelectionBound() after a free deform transformation. */
|
|
Toshihiro Shimizu |
890ddd |
TRectD getSelectionBbox() const;
|
|
Toshihiro Shimizu |
890ddd |
void setSelectionBbox(const TRectD &rect);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void selectNone();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//!Take a rect in world coordinates and put it in the selection.
|
|
Toshihiro Shimizu |
890ddd |
void select(const TRectD &rect);
|
|
Toshihiro Shimizu |
890ddd |
void select(TStroke &stroke);
|
|
Toshihiro Shimizu |
890ddd |
void selectAll();
|
|
Toshihiro Shimizu |
890ddd |
bool isEmpty() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void enableCommands();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool isFloating() const;
|
|
Toshihiro Shimizu |
890ddd |
void transform(const TAffine &affine);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//commands
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//!Build the floating image using m_strokes.
|
|
Toshihiro Shimizu |
890ddd |
void makeFloating();
|
|
Toshihiro Shimizu |
890ddd |
//!Paste the floating image over the current image and empty the selection.
|
|
Toshihiro Shimizu |
890ddd |
void pasteFloatingSelection();
|
|
Toshihiro Shimizu |
890ddd |
//!Delete the floating image.
|
|
Toshihiro Shimizu |
890ddd |
void deleteSelection();
|
|
Toshihiro Shimizu |
890ddd |
//!Copy the floating image in the clipboard.
|
|
Toshihiro Shimizu |
890ddd |
void copySelection();
|
|
Toshihiro Shimizu |
890ddd |
//!Cut the floating image.
|
|
Toshihiro Shimizu |
890ddd |
void cutSelection();
|
|
Toshihiro Shimizu |
890ddd |
//!Create the floating image using clipboard Data.
|
|
Toshihiro Shimizu |
890ddd |
void pasteSelection();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool isTransformed();
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif //RASTER_SELECTION_H
|