| #pragma once |
| |
| #ifndef RASTER_SELECTION_H |
| #define RASTER_SELECTION_H |
| |
| |
| #include "tcommon.h" |
| #include "tpalette.h" |
| #include "ttoonzimage.h" |
| #include "trasterimage.h" |
| #include "tstroke.h" |
| #include "tdata.h" |
| |
| |
| #include "toonz/ttileset.h" |
| #include "toonz/txshcell.h" |
| |
| |
| #include "toonzqt/selection.h" |
| |
| #undef DVAPI |
| #undef DVVAR |
| #ifdef TNZTOOLS_EXPORTS |
| #define DVAPI DV_EXPORT_API |
| #define DVVAR DV_EXPORT_VAR |
| #else |
| #define DVAPI DV_IMPORT_API |
| #define DVVAR DV_IMPORT_VAR |
| #endif |
| |
| |
| class TTileSetCM32; |
| class StrokesData; |
| class RasterImageData; |
| |
| |
| |
| |
| |
| |
| class DVAPI RasterSelection final : public TSelection { |
| TImageP m_currentImage; |
| TXshCell m_currentImageCell; |
| |
| TPaletteP m_oldPalette; |
| TRectD m_selectionBbox; |
| std::vector<TStroke> m_strokes; |
| std::vector<TStroke> m_originalStrokes; |
| TAffine m_affine; |
| TPoint m_startPosition; |
| TRasterP m_floatingSelection; |
| TRasterP m_originalfloatingSelection; |
| TFrameId m_fid; |
| int m_transformationCount; |
| bool m_isPastedSelection; |
| bool m_noAntialiasing; |
| |
| private: |
| void pasteSelection(const RasterImageData *data); |
| |
| public: |
| RasterSelection(); |
| RasterSelection(const RasterSelection &src); |
| |
| TSelection *clone() const; |
| void notify(); |
| |
| const TImageP &getCurrentImage() const { return m_currentImage; } |
| const TXshCell &getCurrentImageCell() const { return m_currentImageCell; } |
| void setCurrentImage(const TImageP &img, const TXshCell &imageCell) { |
| m_currentImage = img, m_currentImageCell = imageCell; |
| } |
| |
| void setStrokes(const std::vector<TStroke> &strokes) { m_strokes = strokes; } |
| std::vector<TStroke> getStrokes() const { return m_strokes; } |
| std::vector<TStroke> getOriginalStrokes() const { return m_originalStrokes; } |
| |
| void setTransformation(const TAffine &affine) { m_affine = affine; } |
| TAffine getTransformation() const { return m_affine; } |
| |
| void setStartPosition(const TPoint &position) { m_startPosition = position; } |
| TPoint getStartPosition() const { return m_startPosition; } |
| |
| void setFloatingSeletion(const TRasterP &floatingSelection) { |
| m_floatingSelection = floatingSelection; |
| } |
| TRasterP getFloatingSelection() const { return m_floatingSelection; } |
| TRasterP getOriginalFloatingSelection() const { |
| return m_originalfloatingSelection; |
| } |
| |
| void setFrameId(const TFrameId &fid) { m_fid = fid; } |
| TFrameId getFrameId() const { return m_fid; } |
| |
| int getTransformationCount() const { return m_transformationCount; } |
| void setTransformationCount(int transformationCount) { |
| m_transformationCount = transformationCount; |
| } |
| |
| void setNoAntialiasing(bool value) { m_noAntialiasing = value; } |
| |
| bool isPastedSelection() const { return m_isPastedSelection; } |
| |
| |
| TRectD getStrokesBound(std::vector<TStroke> strokes) const; |
| |
| |
| TRectD getSelectionBound() const; |
| |
| TRectD getOriginalSelectionBound() const; |
| |
| |
| |
| TRectD getSelectionBbox() const; |
| void setSelectionBbox(const TRectD &rect); |
| |
| void selectNone() override; |
| |
| |
| void select(const TRectD &rect); |
| void select(TStroke &stroke); |
| void selectAll(); |
| bool isEmpty() const override; |
| |
| void enableCommands() override; |
| |
| bool isFloating() const; |
| void transform(const TAffine &affine); |
| |
| |
| |
| |
| void makeFloating(); |
| |
| void pasteFloatingSelection(); |
| |
| void deleteSelection(); |
| |
| void copySelection(); |
| |
| void cutSelection(); |
| |
| void pasteSelection(); |
| |
| bool isTransformed(); |
| }; |
| |
| #endif |