Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tstroke.h"
Toshihiro Shimizu 890ddd
#include "tvectorrenderdata.h"
Toshihiro Shimizu 890ddd
#include "tgl.h"
Toshihiro Shimizu 890ddd
#include "tstrokeoutline.h"
Toshihiro Shimizu 890ddd
#include "tsimplecolorstyles.h"
Toshihiro Shimizu 890ddd
#include "tpalette.h"
Toshihiro Shimizu 890ddd
#include "tregion.h"
Toshihiro Shimizu 890ddd
#include "tregionoutline.h"
Toshihiro Shimizu 890ddd
#include "tmathutil.h"
Toshihiro Shimizu 890ddd
#include "tlevel_io.h"
Toshihiro Shimizu 890ddd
#include "tenv.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tvectorbrushstyle.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//**********************************************************************
Toshihiro Shimizu 890ddd
//    Vector Brush Style  static members
Toshihiro Shimizu 890ddd
//**********************************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
TFilePath TVectorBrushStyle::m_rootDir = TFilePath();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//**********************************************************************
Toshihiro Shimizu 890ddd
//    Vector Brush Prop  declaration
Toshihiro Shimizu 890ddd
//**********************************************************************
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class VectorBrushProp final : public TStrokeProp {
Shinya Kitaoka 120a6e
  TVectorBrushStyle *m_style;
Shinya Kitaoka 120a6e
  TVectorImageP m_brush;
Shinya Kitaoka 120a6e
  TRectD m_brushBox;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  std::vector<tstrokeoutline> m_strokeOutlines;</tstrokeoutline>
Shinya Kitaoka 120a6e
  std::vector<tregionoutline> m_regionOutlines;</tregionoutline>
Shinya Kitaoka 120a6e
  double m_pixelSize;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  VectorBrushProp(const TStroke *stroke, TVectorBrushStyle *style);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  TStrokeProp *clone(const TStroke *stroke) const override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void draw(const TVectorRenderData &rd) override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  const TColorStyle *getColorStyle() const override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  // not implemented
Shinya Kitaoka 120a6e
  VectorBrushProp(const VectorBrushProp &);
Shinya Kitaoka 120a6e
  VectorBrushProp &operator=(const VectorBrushProp &);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//**********************************************************************
Toshihiro Shimizu 890ddd
//    Vector Brush Prop  implementation
Toshihiro Shimizu 890ddd
//**********************************************************************
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
VectorBrushProp::VectorBrushProp(const TStroke *stroke,
Shinya Kitaoka 120a6e
                                 TVectorBrushStyle *style)
Shinya Kitaoka 120a6e
    : TStrokeProp(stroke)
Shinya Kitaoka 120a6e
    , m_style(style)
Shinya Kitaoka 120a6e
    , m_brush(style->getImage())
Shinya Kitaoka 120a6e
    , m_brushBox(m_brush->getBBox())
Shinya Kitaoka 120a6e
    , m_pixelSize(.0) {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
TStrokeProp *VectorBrushProp::clone(const TStroke *stroke) const {
Shinya Kitaoka 120a6e
  return new VectorBrushProp(stroke, m_style);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void VectorBrushProp::draw(const TVectorRenderData &rd) {
Shinya Kitaoka 120a6e
  // Ensure that the stroke overlaps our clipping rect
Shinya Kitaoka 120a6e
  if (rd.m_clippingRect != TRect() && !rd.m_is3dView &&
Shinya Kitaoka 120a6e
      !convert(rd.m_aff * m_stroke->getBBox()).overlaps(rd.m_clippingRect))
Shinya Kitaoka 120a6e
    return;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  TPaletteP palette(m_brush->getPalette());
Shinya Kitaoka 120a6e
  if (!palette) return;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  static TOutlineUtil::OutlineParameter param;  // unused, but requested
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // Build a solid color style to draw each m_vi's stroke with.
Shinya Kitaoka 120a6e
  TSolidColorStyle colorStyle;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // Push the specified rd affine before drawing
Shinya Kitaoka 120a6e
  glPushMatrix();
Shinya Kitaoka 120a6e
  tglMultMatrix(rd.m_aff);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // 1. If necessary, build the outlines
Shinya Kitaoka 120a6e
  double currentPixelSize = sqrt(tglGetPixelSize2());
Shinya Kitaoka 120a6e
  bool differentPixelSize = !isAlmostZero(currentPixelSize - m_pixelSize, 1e-5);
Shinya Kitaoka 120a6e
  m_pixelSize             = currentPixelSize;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  int i, viRegionsCount = m_brush->getRegionCount(),
Shinya Kitaoka 120a6e
         viStrokesCount = m_brush->getStrokeCount();
Shinya Kitaoka 120a6e
  if (differentPixelSize || m_strokeChanged) {
Shinya Kitaoka 120a6e
    m_strokeChanged = false;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    // 1a. First, the regions
Shinya Kitaoka 120a6e
    m_regionOutlines.resize(viRegionsCount);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    for (i = 0; i < viRegionsCount; ++i) {
Shinya Kitaoka 120a6e
      TRegionOutline &outline    = m_regionOutlines[i];
Shinya Kitaoka 120a6e
      const TRegion *brushRegion = m_brush->getRegion(i);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
      // Build the outline
Shinya Kitaoka 120a6e
      outline.clear();
Shinya Kitaoka 120a6e
      TOutlineUtil::makeOutline(*getStroke(), *brushRegion, m_brushBox,
Shinya Kitaoka 120a6e
                                outline);
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    // 1b. Then, the strokes
Shinya Kitaoka 120a6e
    m_strokeOutlines.resize(viStrokesCount);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    for (i = 0; i < viStrokesCount; ++i) {
Shinya Kitaoka 120a6e
      TStrokeOutline &outline    = m_strokeOutlines[i];
Shinya Kitaoka 120a6e
      const TStroke *brushStroke = m_brush->getStroke(i);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
      outline.getArray().clear();
Shinya Kitaoka 120a6e
      TOutlineUtil::makeOutline(*getStroke(), *brushStroke, m_brushBox, outline,
Shinya Kitaoka 120a6e
                                param);
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // 2. Draw the outlines
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  UINT s, t, r, strokesCount = m_brush->getStrokeCount(),
Shinya Kitaoka 120a6e
                regionCount = m_brush->getRegionCount();
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  for (s = 0; s < strokesCount; s = t)  // Each cycle draws a group
Shinya Kitaoka 120a6e
  {
Shinya Kitaoka 120a6e
    // A vector image stores group strokes with consecutive indices.
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    // 2a. First, draw regions in the strokeIdx-th stroke's group
Shinya Kitaoka 120a6e
    for (r = 0; r < regionCount; ++r) {
Shinya Kitaoka 120a6e
      if (m_brush->sameGroupStrokeAndRegion(s, r)) {
Shinya Kitaoka 120a6e
        const TRegion *brushRegion = m_brush->getRegion(r);
Shinya Kitaoka 120a6e
        const TColorStyle *brushStyle =
Shinya Kitaoka 120a6e
            palette->getStyle(brushRegion->getStyle());
Shinya Kitaoka 120a6e
        assert(brushStyle);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
        // Draw the outline
Shinya Kitaoka 120a6e
        colorStyle.setMainColor(brushStyle->getMainColor());
Shinya Kitaoka 120a6e
        colorStyle.drawRegion(0, false, m_regionOutlines[r]);
Shinya Kitaoka 120a6e
      }
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    // 2b. Then, draw all strokes in strokeIdx-th stroke's group
Shinya Kitaoka 120a6e
    for (t = s; t < strokesCount && m_brush->sameGroup(s, t); ++t) {
Shinya Kitaoka 120a6e
      const TStroke *brushStroke = m_brush->getStroke(t);
Shinya Kitaoka 120a6e
      const TColorStyle *brushStyle =
Shinya Kitaoka 120a6e
          palette->getStyle(brushStroke->getStyle());
Shinya Kitaoka 120a6e
      if (!brushStyle) continue;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
      colorStyle.setMainColor(brushStyle->getMainColor());
Shinya Kitaoka 120a6e
      colorStyle.drawStroke(0, &m_strokeOutlines[t],
Shinya Kitaoka 120a6e
                            brushStroke);  // brushStroke unused but requested
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  glPopMatrix();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
const TColorStyle *VectorBrushProp::getColorStyle() const { return m_style; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//**********************************************************************
Toshihiro Shimizu 890ddd
//    Vector Brush Style  implementation
Toshihiro Shimizu 890ddd
//**********************************************************************
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
TVectorBrushStyle::TVectorBrushStyle() : m_colorCount(0) {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
TVectorBrushStyle::TVectorBrushStyle(const std::string &brushName,
Shinya Kitaoka 120a6e
                                     TVectorImageP vi)
Shinya Kitaoka 120a6e
    : m_brush(vi) {
Shinya Kitaoka 120a6e
  loadBrush(brushName);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
TVectorBrushStyle::~TVectorBrushStyle() {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void TVectorBrushStyle::loadBrush(const std::string &brushName) {
Shinya Kitaoka 120a6e
  m_brushName  = brushName;
Shinya Kitaoka 120a6e
  m_colorCount = 0;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (brushName.empty()) return;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (!m_brush) {
Shinya Kitaoka 120a6e
    // Load the image associated with fp
Shinya Kitaoka 120a6e
    TFilePath fp(m_rootDir + TFilePath(brushName + ".pli"));
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
    TLevelReaderP lr(fp);
Shinya Kitaoka 120a6e
    TLevelP level = lr->loadInfo();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
    m_brush = lr->getFrameReader(level->begin()->first)->load();
Shinya Kitaoka 120a6e
    assert(m_brush);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
    TPalette *palette = level->getPalette();
Shinya Kitaoka 120a6e
    m_brush->setPalette(palette);
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  assert(m_brush);
Shinya Kitaoka 120a6e
  m_colorCount =
Shinya Kitaoka 120a6e
      m_brush->getPalette()->getStyleInPagesCount() - 1;  // No transparent
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
TColorStyle *TVectorBrushStyle::clone() const {
Shinya Kitaoka 120a6e
  TVectorImageP brush;
Shinya Kitaoka 120a6e
  if (m_brush) {
Shinya Kitaoka 120a6e
    // Clone m_brush and its palette
Shinya Kitaoka 120a6e
    brush = m_brush->clone();  // NOTE: This does NOT clone the palette, too.
Shinya Kitaoka 120a6e
    brush->setPalette(m_brush->getPalette()->clone());
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TVectorBrushStyle *theClone = new TVectorBrushStyle(m_brushName, brush);
Shinya Kitaoka 120a6e
  theClone->assignNames(this);
Shinya Kitaoka 120a6e
  theClone->setFlags(getFlags());
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  return theClone;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
QString TVectorBrushStyle::getDescription() const { return "VectorBrushStyle"; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
TStrokeProp *TVectorBrushStyle::makeStrokeProp(const TStroke *stroke) {
Shinya Kitaoka 120a6e
  return new VectorBrushProp(stroke, this);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void TVectorBrushStyle::saveData(TOutputStreamInterface &osi) const {
Shinya Kitaoka 120a6e
  osi << m_brushName;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  // Save palette
Shinya Kitaoka 120a6e
  osi << m_colorCount;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TPalette *pal = m_brush->getPalette();
Shinya Kitaoka 120a6e
  assert(pal);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int p, pagesCount = pal->getPageCount();
Shinya Kitaoka 120a6e
  for (p = 0; p < pagesCount; ++p) {
Shinya Kitaoka 120a6e
    TPalette::Page *page = pal->getPage(p);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
    int s, stylesCount = page->getStyleCount();
Shinya Kitaoka 120a6e
    for (s = 0; s < stylesCount; ++s) osi << page->getStyle(s)->getMainColor();
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void TVectorBrushStyle::loadData(TInputStreamInterface &isi) {
Shinya Kitaoka 120a6e
  std::string str;
Shinya Kitaoka 120a6e
  isi >> str;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  assert(!str.empty());
Shinya Kitaoka 120a6e
  loadBrush(str);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int colorCount;
Shinya Kitaoka 120a6e
  isi >> colorCount;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (colorCount != m_colorCount)
Shinya Kitaoka 120a6e
    return;  // Palette mismatch! Just skip palette loading...
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  // WARNING: Is it needed to read all colors nonetheless?
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  // Load palette colors
Shinya Kitaoka 120a6e
  TPalette *pal = m_brush->getPalette();
Shinya Kitaoka 120a6e
  assert(pal);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TPixel32 color;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int p, pagesCount = pal->getPageCount();
Shinya Kitaoka 120a6e
  for (p = 0; p < pagesCount; ++p) {
Shinya Kitaoka 120a6e
    TPalette::Page *page = pal->getPage(p);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
    int s, stylesCount = page->getStyleCount();
Shinya Kitaoka 120a6e
    for (s = 0; s < stylesCount; ++s) {
Shinya Kitaoka 120a6e
      isi >> color;
Shinya Kitaoka 120a6e
      page->getStyle(s)->setMainColor(color);
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
int TVectorBrushStyle::getColorStyleId(int index) const {
Shinya Kitaoka 120a6e
  if (index < 0) return 1;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  ++index;  // Skipping transparent
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TPalette *pal = m_brush->getPalette();
Shinya Kitaoka 120a6e
  assert(pal);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int p, pagesCount = pal->getPageCount();
Shinya Kitaoka 120a6e
  for (p = 0; p < pagesCount; ++p) {
Shinya Kitaoka 120a6e
    TPalette::Page *page = pal->getPage(p);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
    int stylesCount = page->getStyleCount();
Shinya Kitaoka 120a6e
    if (index - stylesCount < 0) break;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
    index -= stylesCount;
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (p >= pagesCount) return -1;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TPalette::Page *page = pal->getPage(p);
Shinya Kitaoka 120a6e
  return page->getStyleId(index);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
TPixel32 TVectorBrushStyle::getMainColor() const {
Shinya Kitaoka 120a6e
  if (!m_brush) return TPixel32::Transparent;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TPalette *pal = m_brush->getPalette();
Shinya Kitaoka 120a6e
  return pal->getStyle(1)->getMainColor();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void TVectorBrushStyle::setMainColor(const TPixel32 &color) {
Shinya Kitaoka 120a6e
  if (!m_brush) return;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TPalette *pal = m_brush->getPalette();
Shinya Kitaoka 120a6e
  pal->getStyle(1)->setMainColor(color);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
int TVectorBrushStyle::getColorParamCount() const { return m_colorCount; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
TPixel32 TVectorBrushStyle::getColorParamValue(int index) const {
Shinya Kitaoka 120a6e
  TPalette *pal = m_brush->getPalette();
Shinya Kitaoka 120a6e
  assert(pal);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int styleId              = getColorStyleId(index);
Shinya Kitaoka 120a6e
  if (styleId < 0) styleId = 1;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  return pal->getStyle(styleId)->getMainColor();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void TVectorBrushStyle::setColorParamValue(int index, const TPixel32 &color) {
Shinya Kitaoka 120a6e
  TPalette *pal = m_brush->getPalette();
Shinya Kitaoka 120a6e
  assert(pal);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int styleId              = getColorStyleId(index);
Shinya Kitaoka 120a6e
  if (styleId < 0) styleId = 1;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  return pal->getStyle(styleId)->setMainColor(color);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//**************************************************************
Toshihiro Shimizu 890ddd
//    Vector Style  global declaration instance
Toshihiro Shimizu 890ddd
//**************************************************************
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
namespace {
Toshihiro Shimizu 890ddd
TColorStyle::Declaration declaration(new TVectorBrushStyle());
Toshihiro Shimizu 890ddd
}