|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef FULLCOLORBRUSHTOOL_H
|
|
Toshihiro Shimizu |
890ddd |
#define FULLCOLORBRUSHTOOL_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "brushtool.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//==============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Forward declarations
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TTileSetFullColor;
|
|
Toshihiro Shimizu |
890ddd |
class TTileSaverFullColor;
|
|
Toshihiro Shimizu |
890ddd |
class BluredBrush;
|
|
Toshihiro Shimizu |
890ddd |
class FullColorBrushToolNotifier;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//==============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// FullColor Brush Tool declaration
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
class FullColorBrushTool : public TTool {
|
|
Shinya Kitaoka |
120a6e |
Q_DECLARE_TR_FUNCTIONS(FullColorBrushTool)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
FullColorBrushTool(std::string name);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
ToolType getToolType() const override { return TTool::LevelWriteTool; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
ToolOptionsBox *createOptionsBox() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void updateTranslation() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void onActivate() override;
|
|
Shinya Kitaoka |
473e70 |
void onDeactivate() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
bool preLeftButtonDown() override;
|
|
Shinya Kitaoka |
473e70 |
void leftButtonDown(const TPointD &pos, const TMouseEvent &e) override;
|
|
Shinya Kitaoka |
473e70 |
void leftButtonDrag(const TPointD &pos, const TMouseEvent &e) override;
|
|
Shinya Kitaoka |
473e70 |
void leftButtonUp(const TPointD &pos, const TMouseEvent &e) override;
|
|
Shinya Kitaoka |
473e70 |
void mouseMove(const TPointD &pos, const TMouseEvent &e) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void draw() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void onEnter() override;
|
|
Shinya Kitaoka |
473e70 |
void onLeave() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
int getCursorId() const override { return ToolCursor::PenCursor; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
TPropertyGroup *getProperties(int targetType) override;
|
|
Shinya Kitaoka |
473e70 |
bool onPropertyChanged(std::string propertyName) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void onImageChanged() override;
|
|
Shinya Kitaoka |
120a6e |
void setWorkAndBackupImages();
|
|
Shinya Kitaoka |
120a6e |
void updateWorkAndBackupRasters(const TRect &rect);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void initPresets();
|
|
Shinya Kitaoka |
120a6e |
void loadPreset();
|
|
Shinya Kitaoka |
120a6e |
void addPreset(QString name);
|
|
Shinya Kitaoka |
120a6e |
void removePreset();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void onCanvasSizeChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
120a6e |
TPropertyGroup m_prop;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TIntPairProperty m_thickness;
|
|
Shinya Kitaoka |
120a6e |
TBoolProperty m_pressure;
|
|
Shinya Kitaoka |
120a6e |
TDoublePairProperty m_opacity;
|
|
Shinya Kitaoka |
120a6e |
TDoubleProperty m_hardness;
|
|
Shinya Kitaoka |
120a6e |
TEnumProperty m_preset;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TPixel32 m_currentColor;
|
|
Shinya Kitaoka |
120a6e |
int m_styleId, m_minThick, m_maxThick;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
double m_oldOpacity;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TPointD m_dpiScale,
|
|
Shinya Kitaoka |
120a6e |
m_mousePos, //!< Current mouse position, in world coordinates.
|
|
Shinya Kitaoka |
120a6e |
m_brushPos; //!< World position the brush will be painted at.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TRasterP m_backUpRas;
|
|
Shinya Kitaoka |
120a6e |
TRaster32P m_workRaster;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TRect m_strokeRect, m_lastRect;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QRadialGradient m_brushPad;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
std::vector<tthickpoint> m_points;</tthickpoint>
|
|
Shinya Kitaoka |
120a6e |
BluredBrush *m_brush;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TTileSetFullColor *m_tileSet;
|
|
Shinya Kitaoka |
120a6e |
TTileSaverFullColor *m_tileSaver;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
BrushPresetManager
|
|
Shinya Kitaoka |
120a6e |
m_presetsManager; //!< Manager for presets of this tool instance
|
|
Shinya Kitaoka |
120a6e |
FullColorBrushToolNotifier *m_notifier;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool m_presetsLoaded;
|
|
Shinya Kitaoka |
120a6e |
bool m_firstTime;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
class FullColorBrushToolNotifier : public QObject {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
FullColorBrushTool *m_tool;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
FullColorBrushToolNotifier(FullColorBrushTool *tool);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected slots:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void onCanvasSizeChanged() { m_tool->onCanvasSizeChanged(); }
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
#endif // FULLCOLORBRUSHTOOL_H
|