Ejemplo n.º 1
0
void ShapeTool::updatePreview()
{
	paintcore::Layer *layer = owner.model()->layerStack()->getLayer(owner.activeLayer());
	if(layer) {
		paintcore::StrokeState ss;
		layer->removeSublayer(-1);

		const paintcore::PointVector pv = pointVector();
		Q_ASSERT(pv.size()>1);

		layer->dab(-1, m_brush, pv[0], ss);

		for(int i=1;i<pv.size();++i)
			layer->drawLine(-1, m_brush, pv[i-1], pv[i], ss);
	}
}
Ejemplo n.º 2
0
/**
 * Convert a dpcore::Point to network format. The
 * reverse operation for this is in statetracker.cpp
 * @param p
 * @return
 */
protocol::PenPointVector pointsToProtocol(const paintcore::PointVector &points)
{
	protocol::PenPointVector ppvec;
	ppvec.reserve(points.size());
	foreach(const paintcore::Point &p, points)
		ppvec.append(pointToProtocol(p));

	return ppvec;
}