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
Shinya Kitaoka d1f6c4
class DVAPI TVectorBrushStyle final : public TColorStyle {
Shinya Kitaoka 120a6e
  static TFilePath m_rootDir;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  std::string m_brushName;
Shinya Kitaoka 120a6e
  TVectorImageP m_brush;
Shinya Kitaoka 120a6e
  int m_colorCount;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TVectorBrushStyle();
Shinya Kitaoka 120a6e
  TVectorBrushStyle(const std::string &brushName,
Shinya Kitaoka 120a6e
                    TVectorImageP vi = TVectorImageP());
Shinya Kitaoka 120a6e
  ~TVectorBrushStyle();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  TColorStyle *clone() const override;
justburner 981d46
  TColorStyle *clone(std::string brushIdName) const override;
justburner 981d46
Shinya Kitaoka 473e70
  QString getDescription() const override;
justburner 981d46
  std::string getBrushIdName() const override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  static TFilePath getRootDir() { return m_rootDir; }
Shinya Kitaoka 120a6e
  static void setRootDir(const TFilePath &path) {
Shinya Kitaoka 120a6e
    m_rootDir = path + "vector brushes";
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void loadBrush(const std::string &brushName);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  int getTagId() const override { return 3000; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TVectorImageP getImage() const { return m_brush; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  bool isRegionStyle() const override { return false; }
Shinya Kitaoka 473e70
  bool isStrokeStyle() const override { return true; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  TStrokeProp *makeStrokeProp(const TStroke *stroke) override;
Shinya Kitaoka 473e70
  TRegionProp *makeRegionProp(const TRegion *region) override {
Shinya Kitaoka 120a6e
    assert(false);
Shinya Kitaoka 120a6e
    return 0;
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  bool hasMainColor() const override { return true; }
Shinya Kitaoka 473e70
  TPixel32 getMainColor() const override;
Shinya Kitaoka 473e70
  void setMainColor(const TPixel32 &color) override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  int getColorParamCount() const override;
Shinya Kitaoka 473e70
  TPixel32 getColorParamValue(int index) const override;
Shinya Kitaoka 473e70
  void setColorParamValue(int index, const TPixel32 &color) override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 473e70
  void loadData(TInputStreamInterface &) override;
Shinya Kitaoka 473e70
  void saveData(TOutputStreamInterface &) const override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  int getColorStyleId(int index) const;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#endif  // T_VECTOR_BRUSH_STYLE_H