|
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 |
120a6e |
ToolType getToolType() const { return TTool::LevelWriteTool; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ToolOptionsBox *createOptionsBox();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void updateTranslation();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void onActivate();
|
|
Shinya Kitaoka |
120a6e |
void onDeactivate();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool preLeftButtonDown();
|
|
Shinya Kitaoka |
120a6e |
void leftButtonDown(const TPointD &pos, const TMouseEvent &e);
|
|
Shinya Kitaoka |
120a6e |
void leftButtonDrag(const TPointD &pos, const TMouseEvent &e);
|
|
Shinya Kitaoka |
120a6e |
void leftButtonUp(const TPointD &pos, const TMouseEvent &e);
|
|
Shinya Kitaoka |
120a6e |
void mouseMove(const TPointD &pos, const TMouseEvent &e);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void draw();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void onEnter();
|
|
Shinya Kitaoka |
120a6e |
void onLeave();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int getCursorId() const { return ToolCursor::PenCursor; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TPropertyGroup *getProperties(int targetType);
|
|
Shinya Kitaoka |
120a6e |
bool onPropertyChanged(std::string propertyName);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void onImageChanged();
|
|
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
|