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