Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TCOLORSTYLES_H
Toshihiro Shimizu 890ddd
#define TCOLORSTYLES_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// TnzCore includes
Toshihiro Shimizu 890ddd
#include "tfilepath.h"
Toshihiro Shimizu 890ddd
#include "traster.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// Qt includes
Toshihiro Shimizu 890ddd
#include <qstring></qstring>
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
Toshihiro Shimizu 890ddd
//    Forward declarations
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TStroke;
Toshihiro Shimizu 890ddd
class TRegion;
Toshihiro Shimizu 890ddd
class TStrokeProp;
Toshihiro Shimizu 890ddd
class TRegionProp;
Toshihiro Shimizu 890ddd
class TVectorRenderData;
Toshihiro Shimizu 890ddd
class TFlash;
Toshihiro Shimizu 890ddd
class TInputStreamInterface;
Toshihiro Shimizu 890ddd
class TOutputStreamInterface;
Toshihiro Shimizu 890ddd
class TRasterStyleFx;
Toshihiro Shimizu 890ddd
class QStringList;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//************************************************************************
Toshihiro Shimizu 890ddd
//    TRasterStyleFx  definition
Toshihiro Shimizu 890ddd
//************************************************************************
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI TRasterStyleFx {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  struct Params {
Shinya Kitaoka 120a6e
    TRasterP m_r;
Shinya Kitaoka 120a6e
    TPoint m_p;
Shinya Kitaoka 120a6e
    TRasterP m_rOrig;
Shinya Kitaoka 120a6e
    int m_colorIndex;
Shinya Kitaoka 120a6e
    int m_frame;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  public:
Shinya Kitaoka 120a6e
    Params(const TRasterP &r, const TPoint &p, const TRasterP &rOrig, int index,
Shinya Kitaoka 120a6e
           int frame)
Shinya Kitaoka 120a6e
        : m_r(r), m_p(p), m_rOrig(rOrig), m_colorIndex(index), m_frame(frame) {
Shinya Kitaoka 120a6e
      assert(m_r);
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
  };
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  virtual ~TRasterStyleFx() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual bool isInkStyle() const   = 0;
Shinya Kitaoka 120a6e
  virtual bool isPaintStyle() const = 0;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual bool inkFxNeedRGBMRaster() const { return false; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual bool compute(const Params ¶ms) const = 0;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual void getEnlargement(int &borderIn, int &borderOut) const {
Shinya Kitaoka 120a6e
    borderIn = borderOut = 0;
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//************************************************************************
Toshihiro Shimizu 890ddd
//    TColorStyle  definition
Toshihiro Shimizu 890ddd
//************************************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Toshihiro Shimizu 890ddd
  \brief Abstract class representing a color style in a Toonz palette.
Toshihiro Shimizu 890ddd
*/
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI TColorStyle : public TSmartObject {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  //! Helper class to declare color styles
Shinya Kitaoka 120a6e
  class Declaration {
Shinya Kitaoka 120a6e
  public:
Shinya Kitaoka 120a6e
    Declaration(TColorStyle *style) { declare(style); }
Shinya Kitaoka 120a6e
  };
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  enum ParamType {
Shinya Kitaoka 120a6e
    BOOL,     //!< Boolean parameter type.
Shinya Kitaoka 120a6e
    INT,      //!< Integer parameter type.
Shinya Kitaoka 120a6e
    ENUM,     //!< Enum parameter type (maps to integer values).
Shinya Kitaoka 120a6e
    DOUBLE,   //!< Double parameter type (getParamType() default).
Shinya Kitaoka 120a6e
    FILEPATH  //!< TFilePath parameter type.
Shinya Kitaoka 120a6e
  };
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  struct double_tag {};
Shinya Kitaoka 120a6e
  struct bool_tag {};
Shinya Kitaoka 120a6e
  struct int_tag {};
Shinya Kitaoka 120a6e
  struct TFilePath_tag {};
Toshihiro Shimizu 890ddd
shun-iwasawa dd780b
  struct PickedPosition {
shun-iwasawa dd780b
    TPoint pos = TPoint();
shun-iwasawa dd780b
    int frame  = 0;
shun-iwasawa dd780b
    PickedPosition(TPoint _pos = TPoint(), int _frame = 0)
shun-iwasawa dd780b
        : pos(_pos), frame(_frame) {}
shun-iwasawa dd780b
    inline bool operator==(const PickedPosition &p) const {
shun-iwasawa dd780b
      return (this->pos == p.pos) && (this->frame == p.frame);
shun-iwasawa dd780b
    }
shun-iwasawa dd780b
    inline bool operator!=(const PickedPosition &p) const {
shun-iwasawa dd780b
      return (this->pos != p.pos) || (this->frame != p.frame);
shun-iwasawa dd780b
    }
shun-iwasawa dd780b
  };
shun-iwasawa dd780b
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  std::wstring m_name;          //!< User-define style name.
Shinya Kitaoka 120a6e
  std::wstring m_globalName;    //!< User-define style \a global name.
Shinya Kitaoka 120a6e
  std::wstring m_originalName;  //!< If the style is copied from studio palette,
Shinya Kitaoka 38fd86
                                //! its original name is stored
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int m_versionNumber;  //!< Style's version number.
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  unsigned int m_flags;  //!< Style attributes.
Shinya Kitaoka 120a6e
  bool m_enabled;        //!< Style's \a enabled status.
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  bool m_isEditedFromOriginal;  //
Shinya Kitaoka 38fd86
                                // This flag will be set when the
Shinya Kitaoka 38fd86
  //!  style is edited from the original one.
shun-iwasawa dd780b
  PickedPosition
shun-iwasawa dd780b
      m_pickedPosition;  // picked position from color model by using style
shun-iwasawa dd780b
                         // picker tool with "organize palette" option.
shun_iwasawa e897af
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  TRaster32P m_icon;  //!< Icon shown on TPalette viewers.
Shinya Kitaoka 120a6e
  bool m_validIcon;   //!< Icon's validity status.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  static int m_currentFrame;  //!< Time instant in the palette's timeline.
Shinya Kitaoka 120a6e
                              //!  \deprecated  Should be done better
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TColorStyle();
Shinya Kitaoka 120a6e
  TColorStyle(
Shinya Kitaoka 120a6e
      const TColorStyle &other);  //!< Copies another style \a except its icon
Shinya Kitaoka 120a6e
  virtual ~TColorStyle();
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  virtual TColorStyle *clone() const = 0;  //!< Polymorphic clone of the style.
Shinya Kitaoka 120a6e
  virtual TColorStyle ©(
Shinya Kitaoka 120a6e
      const TColorStyle &other)  //!< Polymorphic copy of the style.
Shinya Kitaoka 120a6e
  {
Shinya Kitaoka 120a6e
    assignBlend(other, other, 0.0);
Shinya Kitaoka 120a6e
    return *this;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  bool operator==(const TColorStyle &cs) const;
Shinya Kitaoka 120a6e
  bool operator!=(const TColorStyle &cs) { return !operator==(cs); }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // Renderizer-related  objects
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  virtual TStrokeProp *makeStrokeProp(
Shinya Kitaoka 120a6e
      const TStroke
Shinya Kitaoka 120a6e
          *stroke) = 0;  //!< Allocates a \a new derived TStrokeProp instance
Shinya Kitaoka 120a6e
  //!  used to draw the style on the specified stroke object.
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  virtual TRegionProp *makeRegionProp(
Shinya Kitaoka 120a6e
      const TRegion
Shinya Kitaoka 120a6e
          *region) = 0;  //!< Allocates a \a new derived TRegionProp instance
Shinya Kitaoka 120a6e
  //!  used to draw the style on the specified region object.
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  virtual bool isRasterStyle() const {
Shinya Kitaoka 120a6e
    return false;
Shinya Kitaoka 120a6e
  }  //!< Returns whether the style is of the raster kind.
Shinya Kitaoka 120a6e
  virtual TRasterStyleFx *getRasterStyleFx() {
Shinya Kitaoka 120a6e
    return 0;
Shinya Kitaoka 120a6e
  }  //!< If the style contains raster effects it must return it,
Shinya Kitaoka 120a6e
     //!  else returns 0.
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  virtual bool isRegionStyle()
Shinya Kitaoka 120a6e
      const = 0;  //!< Returns whether the style applies on regions.
Shinya Kitaoka 120a6e
  virtual bool isStrokeStyle()
Shinya Kitaoka 120a6e
      const = 0;  //!< Returns whether the style applies on strokes.
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // General functions
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void setName(std::wstring name) {
Shinya Kitaoka 120a6e
    m_name = name;
Shinya Kitaoka 120a6e
  }  //!< Sets the style's user-defined name.
Shinya Kitaoka 120a6e
  std::wstring getName() const {
Shinya Kitaoka 120a6e
    return m_name;
Shinya Kitaoka 120a6e
  }  //!< Returns the style's user-defined name.
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  /*! \detail
Shinya Kitaoka 120a6e
The \a global name contains information about palette id.
Shinya Kitaoka 120a6e
*/
Shinya Kitaoka 120a6e
  void setGlobalName(std::wstring name) {
Shinya Kitaoka 120a6e
    m_globalName = name;
Shinya Kitaoka 120a6e
  }  //!< Sets the global name of the style.
Shinya Kitaoka 120a6e
  std::wstring getGlobalName() const {
Shinya Kitaoka 120a6e
    return m_globalName;
Shinya Kitaoka 120a6e
  }  //!< Returns the global name of the style.
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void setOriginalName(std::wstring name) {
Shinya Kitaoka 120a6e
    m_originalName = name;
Shinya Kitaoka 120a6e
  }  //!< If the style is originally copied from studio palette, set this.
Shinya Kitaoka 120a6e
  std::wstring getOriginalName() const {
Shinya Kitaoka 120a6e
    return m_originalName;
Shinya Kitaoka 120a6e
  }  //!< Returns the original name of the style.
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void setIsEditedFlag(bool edited) {
Shinya Kitaoka 120a6e
    m_isEditedFromOriginal = edited;
Shinya Kitaoka 120a6e
  }  //
Shinya Kitaoka 38fd86
     // the
Shinya Kitaoka 38fd86
  //!  style is edited from the original one.
Shinya Kitaoka 120a6e
  bool getIsEditedFlag() const {
Shinya Kitaoka 120a6e
    return m_isEditedFromOriginal;
Shinya Kitaoka 120a6e
  }  //!< Returns whether the style is edited from the original from studio
Shinya Kitaoka 38fd86
     //! palette
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void assignNames(
Shinya Kitaoka 120a6e
      const TColorStyle *src);  //!< Copies the style names from src.
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  //! \sa tcolorflags.h
Shinya Kitaoka 120a6e
  unsigned int getFlags() const { return m_flags; }  //!< Sets color attributes.
Shinya Kitaoka 120a6e
  void setFlags(unsigned int flags) {
Shinya Kitaoka 120a6e
    m_flags = flags;
Shinya Kitaoka 120a6e
  }  //!< Returns color attributes.
Shinya Kitaoka 120a6e
shun-iwasawa dd780b
  void setPickedPosition(const TPoint &pos, const int index = 0) {
shun-iwasawa dd780b
    m_pickedPosition.pos   = pos;
shun-iwasawa dd780b
    m_pickedPosition.frame = index;
shun-iwasawa dd780b
  }
shun-iwasawa dd780b
  void setPickedPosition(const PickedPosition &pos) { m_pickedPosition = pos; }
shun-iwasawa dd780b
  PickedPosition getPickedPosition() const { return m_pickedPosition; }
shun_iwasawa e897af
Shinya Kitaoka 120a6e
  // Color-related functions
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  /*! \detail
Shinya Kitaoka 120a6e
Raster or vector pattern image styles, for example, return false.
Shinya Kitaoka 120a6e
*/
Shinya Kitaoka 120a6e
  virtual bool hasMainColor() const {
Shinya Kitaoka 120a6e
    return false;
Shinya Kitaoka 120a6e
  }  //!< Returns whether the style has a reference \a main color.
Shinya Kitaoka 120a6e
  virtual TPixel32 getMainColor() const {
Shinya Kitaoka 120a6e
    return TPixel32::Black;
Shinya Kitaoka 120a6e
  }  //!< Returns the style's main color, or black if none.
Shinya Kitaoka 120a6e
  virtual void setMainColor(const TPixel32 &color) {
Shinya Kitaoka 120a6e
  }  //!< Sets the main color, if it has one.
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  /*! \detail
Shinya Kitaoka 120a6e
For example a bubble styles has two colors.
Shinya Kitaoka 120a6e
By default it returns \p 1 if the style has only a main color else
Shinya Kitaoka 120a6e
returns \p 0 if the style has no color.
Shinya Kitaoka 120a6e
*/
Shinya Kitaoka 120a6e
  virtual int getColorParamCount() const {
Shinya Kitaoka 120a6e
    return hasMainColor() ? 1 : 0;
Shinya Kitaoka 120a6e
  }  //!< Returns the number of colors (if any) of the style.
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  /*! \detail
Shinya Kitaoka 120a6e
Returns the main color by default.
Shinya Kitaoka 120a6e
*/
Shinya Kitaoka 120a6e
  virtual TPixel32 getColorParamValue(int index) const {
Shinya Kitaoka 120a6e
    return getMainColor();
Shinya Kitaoka 120a6e
  }  //!< Returns the value of the color of index \e index.
Shinya Kitaoka 120a6e
  virtual void setColorParamValue(int index, const TPixel32 &color) {
Shinya Kitaoka 120a6e
    setMainColor(color);
Shinya Kitaoka 120a6e
  }  //!< Sets the \a index-th color value.
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  virtual TPixel32 getAverageColor() const {
Shinya Kitaoka 120a6e
    return getMainColor();
Shinya Kitaoka 120a6e
  }  //!< Returns a color representing the average of all the style's colors
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // Parameters-related functions
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  /*! \detail
Shinya Kitaoka 120a6e
   For example: a the general cleanup style has two parameters, brightness and
Shinya Kitaoka 120a6e
   contrast and
Shinya Kitaoka 120a6e
   a black cleanup style has in addition a black and white threshold, therefore
Shinya Kitaoka 120a6e
   4 parameters.
Shinya Kitaoka 120a6e
*/
Shinya Kitaoka 120a6e
  virtual int getParamCount() const {
Shinya Kitaoka 120a6e
    return 0;
Shinya Kitaoka 120a6e
  }  //!< Returns the number of parameters necessary
Shinya Kitaoka 120a6e
     //!  to describe the style.
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  virtual ParamType getParamType(int paramIdx) const {
Shinya Kitaoka 120a6e
    assert(0 <= paramIdx && paramIdx < getParamCount());
Shinya Kitaoka 120a6e
    return DOUBLE;
Shinya Kitaoka 120a6e
  }  //!< Returns the type of the specified parameter.
Shinya Kitaoka 120a6e
bf1d82
  virtual bool hasParamDefault(int index) const {
bf1d82
    return false;
bf1d82
  }  //!< Value of parameter can be reset to default.
bf1d82
bf1d82
  virtual void setParamDefault(int index) {
bf1d82
    assert(false);
bf1d82
  }  //!< Reset value of parameter to default.
bf1d82
bf1d82
  virtual bool isParamDefault(int index) const {
bf1d82
    return false;
bf1d82
  }  //!< Check if current value of parameter equals to default
bf1d82
Shinya Kitaoka 120a6e
  virtual void setParamValue(int index, bool value) {
Shinya Kitaoka 120a6e
    assert(false);
Shinya Kitaoka 120a6e
  }  //!< Assigns a value to the specified \p bool parameter.
Shinya Kitaoka 120a6e
  virtual bool getParamValue(bool_tag, int index) const {
Shinya Kitaoka 120a6e
    assert(false);
Shinya Kitaoka 120a6e
    return bool();
Shinya Kitaoka 120a6e
  }  //!< Retrieves the specified \p bool parameter value.
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  virtual void setParamValue(int index, int value) {
Shinya Kitaoka 120a6e
    assert(false);
Shinya Kitaoka 120a6e
  }  //!< Assigns a value to the specified \p int parameter.
Shinya Kitaoka 120a6e
  virtual int getParamValue(int_tag, int index) const {
Shinya Kitaoka 120a6e
    assert(false);
Shinya Kitaoka 120a6e
    return int();
Shinya Kitaoka 120a6e
  }  //!< Retrieves the specified \p int parameter value.
Shinya Kitaoka 120a6e
  virtual void getParamRange(int index, int &min, int &max) const {
Shinya Kitaoka 120a6e
    assert(false);
Shinya Kitaoka 120a6e
  }  //!< Retrieves the specified \p int parameter range.
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  virtual void getParamRange(int pIndex, QStringList &stringItems) const {
Shinya Kitaoka 120a6e
    assert(false);
Shinya Kitaoka 120a6e
  }  //!< Returns a description of each supported enum or file
Shinya Kitaoka 120a6e
  //!  extension value in text form.
Shinya Kitaoka 120a6e
  virtual void setParamValue(int index, double value) {
Shinya Kitaoka 120a6e
    assert(false);
Shinya Kitaoka 120a6e
  }  //!< Assigns a value to the specified \p double parameter.
Shinya Kitaoka 120a6e
  virtual double getParamValue(double_tag, int index) const {
Shinya Kitaoka 120a6e
    assert(false);
Shinya Kitaoka 120a6e
    return double();
Shinya Kitaoka 120a6e
  }  //!< Retrieves the specified \p double parameter value.
Shinya Kitaoka 120a6e
  virtual void getParamRange(int index, double &min, double &max) const {
Shinya Kitaoka 120a6e
    assert(false);
Shinya Kitaoka 120a6e
  }  //!< Retrieves the specified \p double parameter range.
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  virtual void setParamValue(int index, const TFilePath &fp) {
Shinya Kitaoka 120a6e
    assert(false);
Shinya Kitaoka 120a6e
  }  //!< Assigns a value to the specified \p TFilePath parameter.
Shinya Kitaoka 120a6e
  virtual TFilePath getParamValue(TFilePath_tag, int index) const {
Shinya Kitaoka 120a6e
    assert(false);
Shinya Kitaoka 120a6e
    return TFilePath();
Shinya Kitaoka 120a6e
  }  //!< Retrieves the specified \p TFilePath parameter value.
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  /*! \detail
Shinya Kitaoka 120a6e
This function is provided to animate a palette style. Given two keyframe
Shinya Kitaoka 120a6e
styles \p a and \p b, it calculates their linear interpolation at parameter
Shinya Kitaoka 120a6e
\p t and assigns the result to this style instance.
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
\param a    Style value at parameter <tt>t = 0</tt>.
Shinya Kitaoka 120a6e
\param b    Style value at parameter <tt>t = 1</tt>.
Shinya Kitaoka 120a6e
\param t    Interpolation parameter.
Shinya Kitaoka 120a6e
*/
Shinya Kitaoka 120a6e
  void assignBlend(const TColorStyle &a, const TColorStyle &b,
Shinya Kitaoka 120a6e
                   double t);  //!< Assigns the linear interpolation between the
Shinya Kitaoka 120a6e
                               //!  supplied styles.
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // Description-related functions
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  /*! \detail
Shinya Kitaoka 120a6e
For example for a stroke style we have "Constant", "Chain", "Rope", "Tulle",
Shinya Kitaoka 120a6e
etc...
Shinya Kitaoka 120a6e
*/
Shinya Kitaoka 120a6e
  virtual QString getDescription()
Shinya Kitaoka 120a6e
      const = 0;  //!< Return a brief description of the style.
Shinya Kitaoka 120a6e
  virtual QString getParamNames(int index)
Shinya Kitaoka 120a6e
      const;  //!< Return the string that identifies the \a index-th parameter.
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // Drawing-related  functions
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  virtual void drawStroke(TFlash &flash, const TStroke *stroke)
Shinya Kitaoka 120a6e
      const;  //!< Draws the supplied stroke in flash.
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // I/O-related  functions
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  virtual int getTagId()
Shinya Kitaoka 120a6e
      const = 0;  //!< Returns an unique number representing the style.
Shinya Kitaoka 120a6e
  virtual void getObsoleteTagIds(std::vector<int> &) const {};  //!< \deprecated</int>
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void save(TOutputStreamInterface &) const;  //!< Calls the local
Shinya Kitaoka 38fd86
                                              //! implementation of saveData()
Shinya Kitaoka 38fd86
  //! passing it also the name and
Shinya Kitaoka 38fd86
  //! the tagId of the style.
Shinya Kitaoka 120a6e
  static TColorStyle *load(TInputStreamInterface &);  //!< Loads the style from
Shinya Kitaoka 38fd86
                                                      //! disk. Calls the local
Shinya Kitaoka 38fd86
  //! implementation of
Shinya Kitaoka 38fd86
  //! loadData().
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  static TColorStyle *create(
Shinya Kitaoka 120a6e
      int tagId);  //!< Creates a new style with identifier equal to \a tagId.
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  static void declare(
Shinya Kitaoka 120a6e
      TColorStyle *style);  //!< Puts the style in the table of actual styles.
Shinya Kitaoka 120a6e
  static void getAllTags(std::vector<int> &tags);</int>
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // Misc functions
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  /*! \detail
Shinya Kitaoka 120a6e
It is used when updates must be done after changes or creation of new styles.
Shinya Kitaoka 120a6e
*/
Shinya Kitaoka 120a6e
  void invalidateIcon() {
Shinya Kitaoka 120a6e
    m_validIcon = false;
Shinya Kitaoka 120a6e
  }  //!< Sets a flag that defines the style's icon validity.
Shinya Kitaoka 120a6e
  virtual const TRaster32P &getIcon(
Shinya Kitaoka 120a6e
      const TDimension &d);  //!< Returns an image representing the style.
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  bool isEnabled() const {
Shinya Kitaoka 120a6e
    return m_enabled;
Shinya Kitaoka 120a6e
  }  //!< Returns whether the style can be used.
Shinya Kitaoka 120a6e
  void enable(bool on) {
Shinya Kitaoka 120a6e
    m_enabled = on;
Shinya Kitaoka 120a6e
  }  //!< Sets the style's \a enabled status
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  int getVersionNumber() const {
Shinya Kitaoka 120a6e
    return m_versionNumber;
Shinya Kitaoka 120a6e
  }  //!< Returns the version number of the style.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  virtual void makeIcon(const TDimension &d);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual void loadData(TInputStreamInterface &)        = 0;
Shinya Kitaoka 120a6e
  virtual void saveData(TOutputStreamInterface &) const = 0;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual void loadData(int, TInputStreamInterface &) {
Shinya Kitaoka 120a6e
  }  //!< \deprecated  Backward compatibility
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void updateVersionNumber();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  TColorStyle &operator=(
Shinya Kitaoka 120a6e
      const TColorStyle &other);  //!< Copies another style \a except its icon
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//--------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 9f5a1b
#ifdef _WIN32
Toshihiro Shimizu 890ddd
template class DVAPI TSmartPointerT<tcolorstyle>;</tcolorstyle>
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
typedef TSmartPointerT<tcolorstyle> TColorStyleP;</tcolorstyle>
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#endif  // TCOLORSTYLES_H