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 120a6e
class DVAPI TVectorBrushStyle : 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 120a6e
  TColorStyle *clone() const;
Shinya Kitaoka 120a6e
  QString getDescription() const;
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 120a6e
  int getTagId() const { return 3000; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TVectorImageP getImage() const { return m_brush; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  bool isRegionStyle() const { return false; }
Shinya Kitaoka 120a6e
  bool isStrokeStyle() const { return true; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TStrokeProp *makeStrokeProp(const TStroke *stroke);
Shinya Kitaoka 120a6e
  TRegionProp *makeRegionProp(const TRegion *region) {
Shinya Kitaoka 120a6e
    assert(false);
Shinya Kitaoka 120a6e
    return 0;
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  bool hasMainColor() const { return true; }
Shinya Kitaoka 120a6e
  TPixel32 getMainColor() const;
Shinya Kitaoka 120a6e
  void setMainColor(const TPixel32 &color);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int getColorParamCount() const;
Shinya Kitaoka 120a6e
  TPixel32 getColorParamValue(int index) const;
Shinya Kitaoka 120a6e
  void setColorParamValue(int index, const TPixel32 &color);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  void loadData(TInputStreamInterface &);
Shinya Kitaoka 120a6e
  void saveData(TOutputStreamInterface &) const;
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