tahoma2d/toonz/sources/include/tvectorbrushstyle.h

78 lines
2 KiB
C
Raw Normal View History

2016-05-17 03:04:11 +12:00
#pragma once
2016-03-19 06:57:51 +13:00
#ifndef T_VECTOR_BRUSH_STYLE_H
#define T_VECTOR_BRUSH_STYLE_H
#include "tfilepath.h"
#include "tvectorimage.h"
#include "tcolorstyles.h"
#undef DVAPI
#undef DVVAR
#ifdef TVRENDER_EXPORTS
#define DVAPI DV_EXPORT_API
#define DVVAR DV_EXPORT_VAR
#else
#define DVAPI DV_IMPORT_API
#define DVVAR DV_IMPORT_VAR
#endif
//**********************************************************************
// Vector Brush Style declaration
//**********************************************************************
class DVAPI TVectorBrushStyle final : public TColorStyle {
2016-06-15 18:43:10 +12:00
static TFilePath m_rootDir;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
std::string m_brushName;
TVectorImageP m_brush;
int m_colorCount;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
TVectorBrushStyle();
TVectorBrushStyle(const std::string &brushName,
TVectorImageP vi = TVectorImageP());
~TVectorBrushStyle();
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
TColorStyle *clone() const override;
QString getDescription() const override;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
static TFilePath getRootDir() { return m_rootDir; }
static void setRootDir(const TFilePath &path) {
m_rootDir = path + "vector brushes";
}
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void loadBrush(const std::string &brushName);
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
int getTagId() const override { return 3000; }
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
TVectorImageP getImage() const { return m_brush; }
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
bool isRegionStyle() const override { return false; }
bool isStrokeStyle() const override { return true; }
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
TStrokeProp *makeStrokeProp(const TStroke *stroke) override;
TRegionProp *makeRegionProp(const TRegion *region) override {
2016-06-15 18:43:10 +12:00
assert(false);
return 0;
}
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
bool hasMainColor() const override { return true; }
TPixel32 getMainColor() const override;
void setMainColor(const TPixel32 &color) override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
int getColorParamCount() const override;
TPixel32 getColorParamValue(int index) const override;
void setColorParamValue(int index, const TPixel32 &color) override;
2016-03-19 06:57:51 +13:00
protected:
2016-06-19 20:06:29 +12:00
void loadData(TInputStreamInterface &) override;
void saveData(TOutputStreamInterface &) const override;
2016-03-19 06:57:51 +13:00
private:
2016-06-15 18:43:10 +12:00
int getColorStyleId(int index) const;
2016-03-19 06:57:51 +13:00
};
2016-06-15 18:43:10 +12:00
#endif // T_VECTOR_BRUSH_STYLE_H