Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "toonz/rasterstrokegenerator.h"
Toshihiro Shimizu 890ddd
#include "trastercm.h"
Toshihiro Shimizu 890ddd
#include "toonz/rasterbrush.h"
Toshihiro Shimizu 890ddd
#include "trop.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
RasterStrokeGenerator::RasterStrokeGenerator(const TRasterCM32P &raster, Tasks task, ColorType colorType,
Toshihiro Shimizu 890ddd
											 int styleId, const TThickPoint &p, bool selective, int selectedStyle, bool keepAntialias)
Toshihiro Shimizu 890ddd
	: m_raster(raster), m_boxOfRaster(TRect(raster->getSize())), m_styleId(styleId), m_selective(selective), m_task(task), m_colorType(colorType), m_eraseStyle(4095), m_selectedStyle(selectedStyle), m_keepAntiAlias(keepAntialias), m_doAnArc(false)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	TThickPoint pp = p;
Toshihiro Shimizu 890ddd
	m_points.push_back(pp);
Toshihiro Shimizu 890ddd
	if (task == ERASE)
Toshihiro Shimizu 890ddd
		m_styleId = m_eraseStyle;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
RasterStrokeGenerator::~RasterStrokeGenerator()
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
bool RasterStrokeGenerator::add(const TThickPoint &p)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	TThickPoint pp = p;
Toshihiro Shimizu 890ddd
	TThickPoint mid((m_points.back() + pp) * 0.5, (p.thick + m_points.back().thick) * 0.5);
Toshihiro Shimizu 890ddd
	m_points.push_back(mid);
Toshihiro Shimizu 890ddd
	m_points.push_back(pp);
Toshihiro Shimizu 890ddd
	return true;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//Disegna il tratto interamente
Toshihiro Shimizu 890ddd
void RasterStrokeGenerator::generateStroke(bool isPencil) const
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	vector<tthickpoint> points(m_points);</tthickpoint>
Toshihiro Shimizu 890ddd
	int size = points.size();
Toshihiro Shimizu 890ddd
	//Prende un buffer trasparente di appoggio
Toshihiro Shimizu 890ddd
	TRect box = getBBox(points);
Toshihiro Shimizu 890ddd
	TPoint newOrigin = box.getP00();
Toshihiro Shimizu 890ddd
	TRasterCM32P rasBuffer(box.getSize());
Toshihiro Shimizu 890ddd
	rasBuffer->clear();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//Trasla i punti secondo il nuovo sitema di riferimento
Toshihiro Shimizu 890ddd
	translatePoints(points, newOrigin);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	vector<tthickpoint> partialPoints;</tthickpoint>
Toshihiro Shimizu 890ddd
	if (size == 1) {
Toshihiro Shimizu 890ddd
		rasterBrush(rasBuffer, points, m_styleId, !isPencil);
Toshihiro Shimizu 890ddd
		placeOver(m_raster, rasBuffer, newOrigin);
Toshihiro Shimizu 890ddd
	} else if (size <= 3) {
Toshihiro Shimizu 890ddd
		vector<tthickpoint> partialPoints;</tthickpoint>
Toshihiro Shimizu 890ddd
		partialPoints.push_back(points[0]);
Toshihiro Shimizu 890ddd
		partialPoints.push_back(points[1]);
Toshihiro Shimizu 890ddd
		rasterBrush(rasBuffer, partialPoints, m_styleId, !isPencil);
Toshihiro Shimizu 890ddd
		placeOver(m_raster, rasBuffer, newOrigin);
Toshihiro Shimizu 890ddd
	} else if (size % 2 == 1) /*-- 奇数の場合 --*/
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		int strokeCount = (size - 1) / 2 - 1;
Toshihiro Shimizu 890ddd
		vector<tthickpoint> partialPoints;</tthickpoint>
Toshihiro Shimizu 890ddd
		partialPoints.push_back(points[0]);
Toshihiro Shimizu 890ddd
		partialPoints.push_back(points[1]);
Toshihiro Shimizu 890ddd
		rasterBrush(rasBuffer, partialPoints, m_styleId, !isPencil);
Toshihiro Shimizu 890ddd
		placeOver(m_raster, rasBuffer, newOrigin);
Toshihiro Shimizu 890ddd
		for (int i = 0; i < strokeCount; i++) {
Toshihiro Shimizu 890ddd
			partialPoints.clear();
Toshihiro Shimizu 890ddd
			rasBuffer->clear();
Toshihiro Shimizu 890ddd
			partialPoints.push_back(points[i * 2 + 1]);
Toshihiro Shimizu 890ddd
			partialPoints.push_back(points[i * 2 + 2]);
Toshihiro Shimizu 890ddd
			partialPoints.push_back(points[i * 2 + 3]);
Toshihiro Shimizu 890ddd
			if (i == strokeCount - 1)
Toshihiro Shimizu 890ddd
				partialPoints.push_back(points[i * 2 + 4]);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
			rasterBrush(rasBuffer, partialPoints, m_styleId, !isPencil);
Toshihiro Shimizu 890ddd
			placeOver(m_raster, rasBuffer, newOrigin);
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	} else {
Toshihiro Shimizu 890ddd
		vector<tthickpoint> partialPoints;</tthickpoint>
Toshihiro Shimizu 890ddd
		partialPoints.push_back(points[0]);
Toshihiro Shimizu 890ddd
		partialPoints.push_back(points[1]);
Toshihiro Shimizu 890ddd
		rasterBrush(rasBuffer, partialPoints, m_styleId, !isPencil);
Toshihiro Shimizu 890ddd
		placeOver(m_raster, rasBuffer, newOrigin);
Toshihiro Shimizu 890ddd
		if (size > 2) {
Toshihiro Shimizu 890ddd
			partialPoints.clear();
Toshihiro Shimizu 890ddd
			vector<tthickpoint>::iterator it = points.begin();</tthickpoint>
Toshihiro Shimizu 890ddd
			it++;
Toshihiro Shimizu 890ddd
			partialPoints.insert(partialPoints.begin(), it, points.end());
Toshihiro Shimizu 890ddd
			rasterBrush(rasBuffer, partialPoints, m_styleId, !isPencil);
Toshihiro Shimizu 890ddd
			placeOver(m_raster, rasBuffer, newOrigin);
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
TRect RasterStrokeGenerator::generateLastPieceOfStroke(bool isPencil, bool closeStroke)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	vector<tthickpoint> points;</tthickpoint>
Toshihiro Shimizu 890ddd
	int size = m_points.size();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	if (size == 3) {
Toshihiro Shimizu 890ddd
		points.push_back(m_points[0]);
Toshihiro Shimizu 890ddd
		points.push_back(m_points[1]);
Toshihiro Shimizu 890ddd
	} else if (size == 1)
Toshihiro Shimizu 890ddd
		points.push_back(m_points[0]);
Toshihiro Shimizu 890ddd
	else {
Toshihiro Shimizu 890ddd
		points.push_back(m_points[size - 4]);
Toshihiro Shimizu 890ddd
		points.push_back(m_points[size - 3]);
Toshihiro Shimizu 890ddd
		points.push_back(m_points[size - 2]);
Toshihiro Shimizu 890ddd
		if (closeStroke)
Toshihiro Shimizu 890ddd
			points.push_back(m_points[size - 1]);
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TRect box = getBBox(points);
Toshihiro Shimizu 890ddd
	TPoint newOrigin = box.getP00();
Toshihiro Shimizu 890ddd
	TRasterCM32P rasBuffer(box.getSize());
Toshihiro Shimizu 890ddd
	rasBuffer->clear();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//Trasla i punti secondo il nuovo sitema di riferimento
Toshihiro Shimizu 890ddd
	translatePoints(points, newOrigin);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	rasterBrush(rasBuffer, points, m_styleId, !isPencil);
Toshihiro Shimizu 890ddd
	placeOver(m_raster, rasBuffer, newOrigin);
Toshihiro Shimizu 890ddd
	return box;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//Ritorna il rettangolo contenente i dischi generati con centri in "points" e diametro "points.thick" +3 pixel a bordo
Toshihiro Shimizu 890ddd
TRect RasterStrokeGenerator::getBBox(const vector<tthickpoint> &points) const</tthickpoint>
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	double x0 = (std::numeric_limits<double>::max)(), y0 = (std::numeric_limits<double>::max)(),</double></double>
Toshihiro Shimizu 890ddd
		   x1 = -(std::numeric_limits<double>::max)(), y1 = -(std::numeric_limits<double>::max)();</double></double>
Toshihiro Shimizu 890ddd
	for (int i = 0; i < (int)points.size(); i++) {
Toshihiro Shimizu 890ddd
		double radius = points[i].thick * 0.5;
Toshihiro Shimizu 890ddd
		if (points[i].x - radius < x0)
Toshihiro Shimizu 890ddd
			x0 = points[i].x - radius;
Toshihiro Shimizu 890ddd
		if (points[i].x + radius > x1)
Toshihiro Shimizu 890ddd
			x1 = points[i].x + radius;
Toshihiro Shimizu 890ddd
		if (points[i].y - radius < y0)
Toshihiro Shimizu 890ddd
			y0 = points[i].y - radius;
Toshihiro Shimizu 890ddd
		if (points[i].y + radius > y1)
Toshihiro Shimizu 890ddd
			y1 = points[i].y + radius;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	return TRect(TPoint((int)floor(x0 - 3), (int)floor(y0 - 3)), TPoint((int)ceil(x1 + 3), (int)ceil(y1 + 3)));
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//Ricalcola i punti in un nuovo sistema di riferimento
Toshihiro Shimizu 890ddd
void RasterStrokeGenerator::translatePoints(vector<tthickpoint> &points, const TPoint &newOrigin) const</tthickpoint>
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	TPointD p(newOrigin.x, newOrigin.y);
Toshihiro Shimizu 890ddd
	for (int i = 0; i < (int)points.size(); i++)
Toshihiro Shimizu 890ddd
		points[i] -= p;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//Effettua la over.
Toshihiro Shimizu 890ddd
void RasterStrokeGenerator::placeOver(const TRasterCM32P &out, const TRasterCM32P &in, const TPoint &p) const
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	TRect inBox = in->getBounds() + p;
Toshihiro Shimizu 890ddd
	TRect outBox = out->getBounds();
Toshihiro Shimizu 890ddd
	TRect box = inBox * outBox;
Toshihiro Shimizu 890ddd
	if (box.isEmpty())
Toshihiro Shimizu 890ddd
		return;
Toshihiro Shimizu 890ddd
	TRasterCM32P rOut = out->extract(box);
Toshihiro Shimizu 890ddd
	TRect box2 = box - p;
Toshihiro Shimizu 890ddd
	TRasterCM32P rIn = in->extract(box2);
Toshihiro Shimizu 890ddd
	for (int y = 0; y < rOut->getLy(); y++) {
Toshihiro Shimizu 890ddd
		/*-- Finger Toolの境界条件 --*/
Toshihiro Shimizu 890ddd
		if (m_task == FINGER && (y == 0 || y == rOut->getLy() - 1))
Toshihiro Shimizu 890ddd
			continue;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		TPixelCM32 *inPix = rIn->pixels(y);
Toshihiro Shimizu 890ddd
		TPixelCM32 *outPix = rOut->pixels(y);
Toshihiro Shimizu 890ddd
		TPixelCM32 *outEnd = outPix + rOut->getLx();
Toshihiro Shimizu 890ddd
		for (; outPix < outEnd; ++inPix, ++outPix) {
Toshihiro Shimizu 890ddd
			if (m_task == BRUSH) {
Toshihiro Shimizu 890ddd
				int inTone = inPix->getTone();
Toshihiro Shimizu 890ddd
				int outTone = outPix->getTone();
Toshihiro Shimizu 890ddd
				if (inPix->isPureInk() && !m_selective) {
Toshihiro Shimizu 890ddd
					*outPix = TPixelCM32(inPix->getInk(), outPix->getPaint(), inTone);
Toshihiro Shimizu 890ddd
					continue;
Toshihiro Shimizu 890ddd
				}
Toshihiro Shimizu 890ddd
				if (outPix->isPureInk() && m_selective) {
Toshihiro Shimizu 890ddd
					*outPix = TPixelCM32(outPix->getInk(), outPix->getPaint(), outTone);
Toshihiro Shimizu 890ddd
					continue;
Toshihiro Shimizu 890ddd
				}
Toshihiro Shimizu 890ddd
				if (inTone <= outTone) {
Toshihiro Shimizu 890ddd
					*outPix = TPixelCM32(inPix->getInk(), outPix->getPaint(), inTone);
Toshihiro Shimizu 890ddd
				}
Toshihiro Shimizu 890ddd
			}
Toshihiro Shimizu 890ddd
			if (m_task == ERASE) {
Toshihiro Shimizu 890ddd
				if (m_colorType == INK) {
Toshihiro Shimizu 890ddd
					if (!m_keepAntiAlias) {
Toshihiro Shimizu 890ddd
						if (inPix->getTone() == 0 && (!m_selective || (m_selective && outPix->getInk() == m_selectedStyle))) {
Toshihiro Shimizu 890ddd
							outPix->setTone(255);
Toshihiro Shimizu 890ddd
						}
Toshihiro Shimizu 890ddd
					} else if (inPix->getTone() < 255 && (!m_selective || (m_selective && outPix->getInk() == m_selectedStyle))) {
Toshihiro Shimizu 890ddd
						outPix->setTone(tmax(outPix->getTone(), 255 - inPix->getTone()));
Toshihiro Shimizu 890ddd
					}
Toshihiro Shimizu 890ddd
				}
Toshihiro Shimizu 890ddd
				if (m_colorType == PAINT) {
Toshihiro Shimizu 890ddd
					if (inPix->getTone() == 0 && (!m_selective || (m_selective && outPix->getPaint() == m_selectedStyle)))
Toshihiro Shimizu 890ddd
						outPix->setPaint(0);
Toshihiro Shimizu 890ddd
				}
Toshihiro Shimizu 890ddd
				if (m_colorType == INKNPAINT) {
Toshihiro Shimizu 890ddd
					if (inPix->getTone() < 255 && (!m_selective || (m_selective && outPix->getPaint() == m_selectedStyle)))
Toshihiro Shimizu 890ddd
						outPix->setPaint(0);
Toshihiro Shimizu 890ddd
					if (!m_keepAntiAlias) {
Toshihiro Shimizu 890ddd
						if (inPix->getTone() == 0 && (!m_selective || (m_selective && outPix->getInk() == m_selectedStyle))) {
Toshihiro Shimizu 890ddd
							outPix->setTone(255);
Toshihiro Shimizu 890ddd
						}
Toshihiro Shimizu 890ddd
					} else if (inPix->getTone() < 255 && (!m_selective || (m_selective && outPix->getInk() == m_selectedStyle))) {
Toshihiro Shimizu 890ddd
						outPix->setTone(tmax(outPix->getTone(), 255 - inPix->getTone()));
Toshihiro Shimizu 890ddd
					}
Toshihiro Shimizu 890ddd
				}
Toshihiro Shimizu 890ddd
			} else if (m_task == PAINTBRUSH) {
Toshihiro Shimizu 890ddd
				if (!inPix->isPureInk())
Toshihiro Shimizu 890ddd
					continue;
Toshihiro Shimizu 890ddd
				bool changePaint = !m_selective || (m_selective && outPix->getPaint() == 0);
Toshihiro Shimizu 890ddd
				if (m_colorType == INK)
Toshihiro Shimizu 890ddd
					*outPix = TPixelCM32(inPix->getInk(), outPix->getPaint(), outPix->getTone());
Toshihiro Shimizu 890ddd
				if (m_colorType == PAINT)
Toshihiro Shimizu 890ddd
					if (changePaint)
Toshihiro Shimizu 890ddd
						*outPix = TPixelCM32(outPix->getInk(), inPix->getInk(), outPix->getTone());
Toshihiro Shimizu 890ddd
				if (m_colorType == INKNPAINT)
Toshihiro Shimizu 890ddd
					*outPix = TPixelCM32(inPix->getInk(), changePaint ? inPix->getInk() : outPix->getPaint(), outPix->getTone());
Toshihiro Shimizu 890ddd
			}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
			/*-- Finger tool --*/
Toshihiro Shimizu 890ddd
			else if (m_task == FINGER) {
Toshihiro Shimizu 890ddd
				/*-- 境界条件 --*/
Toshihiro Shimizu 890ddd
				if (outPix == rOut->pixels(y) || outPix == outEnd - 1)
Toshihiro Shimizu 890ddd
					continue;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
				int inkId = inPix->getInk();
Toshihiro Shimizu 890ddd
				if (inkId == 0)
Toshihiro Shimizu 890ddd
					continue;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
				TPixelCM32 *neighbourPixels[4];
Toshihiro Shimizu 890ddd
				neighbourPixels[0] = outPix - 1;			   /* 左 */
Toshihiro Shimizu 890ddd
				neighbourPixels[1] = outPix + 1;			   /* 右 */
Toshihiro Shimizu 890ddd
				neighbourPixels[2] = outPix - rOut->getWrap(); /* 上 */
Toshihiro Shimizu 890ddd
				neighbourPixels[3] = outPix + rOut->getWrap(); /* 下 */
Toshihiro Shimizu 890ddd
				int count = 0;
Toshihiro Shimizu 890ddd
				int tone = outPix->getTone();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
				/*--- Invertがオフのとき:穴を埋める操作 ---*/
Toshihiro Shimizu 890ddd
				if (!m_selective) {
Toshihiro Shimizu 890ddd
					/*-- 4近傍のピクセルについて --*/
Toshihiro Shimizu 890ddd
					int minTone = tone;
Toshihiro Shimizu 890ddd
					for (int p = 0; p < 4; p++) {
Toshihiro Shimizu 890ddd
						/*-- 自分Pixelより線が濃い(Toneが低い)ものを集計する --*/
Toshihiro Shimizu 890ddd
						if (neighbourPixels[p]->getTone() < tone) {
Toshihiro Shimizu 890ddd
							count++;
Toshihiro Shimizu 890ddd
							if (neighbourPixels[p]->getTone() < minTone)
Toshihiro Shimizu 890ddd
								minTone = neighbourPixels[p]->getTone();
Toshihiro Shimizu 890ddd
						}
Toshihiro Shimizu 890ddd
					}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
					/*--- 周りの3つ以上のピクセルが濃ければ、最小Toneと置き換える ---*/
Toshihiro Shimizu 890ddd
					if (count <= 2)
Toshihiro Shimizu 890ddd
						continue;
Toshihiro Shimizu 890ddd
					*outPix = TPixelCM32(inkId, outPix->getPaint(), minTone);
Toshihiro Shimizu 890ddd
				}
Toshihiro Shimizu 890ddd
				/*--- InvertがONのとき:出っ張りを削る操作 ---*/
Toshihiro Shimizu 890ddd
				else {
Toshihiro Shimizu 890ddd
					if (outPix->isPurePaint() || outPix->getInk() != inkId)
Toshihiro Shimizu 890ddd
						continue;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
					/*-- 4近傍のピクセルについて --*/
Toshihiro Shimizu 890ddd
					int maxTone = tone;
Toshihiro Shimizu 890ddd
					for (int p = 0; p < 4; p++) {
Toshihiro Shimizu 890ddd
						/*-- Ink#がCurrentでない、または、自分Pixelより線が薄い(Toneが高い)ものを集計する --*/
Toshihiro Shimizu 890ddd
						if (neighbourPixels[p]->getInk() != inkId) {
Toshihiro Shimizu 890ddd
							count++;
Toshihiro Shimizu 890ddd
							maxTone = 255;
Toshihiro Shimizu 890ddd
						} else if (neighbourPixels[p]->getTone() > tone) {
Toshihiro Shimizu 890ddd
							count++;
Toshihiro Shimizu 890ddd
							if (neighbourPixels[p]->getTone() > maxTone)
Toshihiro Shimizu 890ddd
								maxTone = neighbourPixels[p]->getTone();
Toshihiro Shimizu 890ddd
						}
Toshihiro Shimizu 890ddd
					}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
					/*--- 周りの3つ以上のピクセルが薄ければ、最大Toneと置き換える ---*/
Toshihiro Shimizu 890ddd
					if (count <= 2)
Toshihiro Shimizu 890ddd
						continue;
Toshihiro Shimizu 890ddd
					*outPix = TPixelCM32((maxTone == 255) ? 0 : inkId, outPix->getPaint(), maxTone);
Toshihiro Shimizu 890ddd
				}
Toshihiro Shimizu 890ddd
			}
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
TRect RasterStrokeGenerator::getLastRect() const
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	vector<tthickpoint> points;</tthickpoint>
Toshihiro Shimizu 890ddd
	int size = m_points.size();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	if (size == 3) {
Toshihiro Shimizu 890ddd
		points.push_back(m_points[0]);
Toshihiro Shimizu 890ddd
		points.push_back(m_points[1]);
Toshihiro Shimizu 890ddd
	} else if (size == 1)
Toshihiro Shimizu 890ddd
		points.push_back(m_points[0]);
Toshihiro Shimizu 890ddd
	else {
Toshihiro Shimizu 890ddd
		points.push_back(m_points[size - 4]);
Toshihiro Shimizu 890ddd
		points.push_back(m_points[size - 3]);
Toshihiro Shimizu 890ddd
		points.push_back(m_points[size - 2]);
Toshihiro Shimizu 890ddd
		points.push_back(m_points[size - 1]);
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	return getBBox(points);
Toshihiro Shimizu 890ddd
}