Exemple #1
0
void Canvas::drawLine(const float width, Color const& color, geom::Point const& start, geom::Point const& end, const float depth)
{
	if(color.isInvalid() || !(width > 0)){
		return;
	}
	this->setLineWidth(width);
	this->setColor(color);
	this->setOperation(Lines);
	pushVertex(start.x(), start.y(), depth);
	pushVertex(end.x()  , end.y(), depth);
}
void KnotPropertiesDialog::_setKnotPoint(Geom::Point knotpoint, Glib::ustring const unit_name)
{
    _unit_name = unit_name;
    _knot_x_entry.set_value( Inkscape::Util::Quantity::convert(knotpoint.x(), "px", _unit_name));
    _knot_y_entry.set_value( Inkscape::Util::Quantity::convert(knotpoint.y(), "px", _unit_name));
    _knot_x_label.set_label(g_strdup_printf(_("Position X (%s):"), _unit_name.c_str()));
    _knot_y_label.set_label(g_strdup_printf(_("Position Y (%s):"), _unit_name.c_str()));
}
Exemple #3
0
void Canvas::translate(geom::Point const& pt)
{
	glTranslatef(pt.x(),pt.y(),0.0f);
#ifdef DEBUG
	const GLenum err = glGetError();
	if(err != GL_NO_ERROR){
		CINAMO_EXCEPTION(Exception, "[BUG] Failed to exec glTranslatef: 0x%08x", err);
	}
#endif
}
geom::Area PredefinedSymRenderer::renderSyms( Canvas& cv, geom::Point const& point, SymList const& str, float depth)
{
	float x=0.0f;
	for(unsigned int symbol : str){
		auto it = this->entryTable_.find(symbol);
		if(it == this->entryTable_.end()){
			this->log().w(TAG, "Unknown symbol: %d", symbol);
			continue;
		}
		Entry const& ent( it->second );
		Image& img = renderBuffer_[ent.spriteNo];
		geom::Point rendered( point.x()+x, point.y() );
		img.add(rendered, ent.areaInSprite);
		x += ent.areaInSprite.width();
	}
	return geom::Area(point, geom::Box(x,this->height_));
}