Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef T_VECTOR_BRUSH_STYLE_H
Toshihiro Shimizu 890ddd
#define T_VECTOR_BRUSH_STYLE_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tfilepath.h"
Toshihiro Shimizu 890ddd
#include "tvectorimage.h"
Toshihiro Shimizu 890ddd
#include "tcolorstyles.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef TVRENDER_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
//**********************************************************************
Toshihiro Shimizu 890ddd
//    Vector Brush Style  declaration
Toshihiro Shimizu 890ddd
//**********************************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TVectorBrushStyle : public TColorStyle
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	static TFilePath m_rootDir;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	std::string m_brushName;
Toshihiro Shimizu 890ddd
	TVectorImageP m_brush;
Toshihiro Shimizu 890ddd
	int m_colorCount;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TVectorBrushStyle();
Toshihiro Shimizu 890ddd
	TVectorBrushStyle(const std::string &brushName, TVectorImageP vi = TVectorImageP());
Toshihiro Shimizu 890ddd
	~TVectorBrushStyle();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TColorStyle *clone() const;
Toshihiro Shimizu 890ddd
	QString getDescription() const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	static TFilePath getRootDir() { return m_rootDir; }
Toshihiro Shimizu 890ddd
	static void setRootDir(const TFilePath &path) { m_rootDir = path + "vector brushes"; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void loadBrush(const std::string &brushName);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int getTagId() const { return 3000; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TVectorImageP getImage() const { return m_brush; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool isRegionStyle() const { return false; }
Toshihiro Shimizu 890ddd
	bool isStrokeStyle() const { return true; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TStrokeProp *makeStrokeProp(const TStroke *stroke);
Toshihiro Shimizu 890ddd
	TRegionProp *makeRegionProp(const TRegion *region)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		assert(false);
Toshihiro Shimizu 890ddd
		return 0;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool hasMainColor() const { return true; }
Toshihiro Shimizu 890ddd
	TPixel32 getMainColor() const;
Toshihiro Shimizu 890ddd
	void setMainColor(const TPixel32 &color);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int getColorParamCount() const;
Toshihiro Shimizu 890ddd
	TPixel32 getColorParamValue(int index) const;
Toshihiro Shimizu 890ddd
	void setColorParamValue(int index, const TPixel32 &color);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Toshihiro Shimizu 890ddd
	void loadData(TInputStreamInterface &);
Toshihiro Shimizu 890ddd
	void saveData(TOutputStreamInterface &) const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Toshihiro Shimizu 890ddd
	int getColorStyleId(int index) const;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif //T_VECTOR_BRUSH_STYLE_H