本文整理汇总了C++中Path::Fill方法的典型用法代码示例。如果您正苦于以下问题:C++ Path::Fill方法的具体用法?C++ Path::Fill怎么用?C++ Path::Fill使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Path
的用法示例。
在下文中一共展示了Path::Fill方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/**
* Computes a point on the offset; used to set a "seed" position for
* the control knot.
*
* \return the topmost point on the offset.
*/
void
sp_offset_top_point (SPOffset const * offset, Geom::Point *px)
{
(*px) = Geom::Point(0, 0);
if (offset == NULL) {
return;
}
if (offset->knotSet)
{
(*px) = offset->knot;
return;
}
SPCurve *curve = SP_SHAPE (offset)->getCurve();
if (curve == NULL)
{
// CPPIFY
//offset->set_shape();
const_cast<SPOffset*>(offset)->set_shape();
curve = SP_SHAPE (offset)->getCurve();
if (curve == NULL)
return;
}
if (curve->is_empty())
{
curve->unref();
return;
}
Path *finalPath = new Path;
finalPath->LoadPathVector(curve->get_pathvector());
Shape *theShape = new Shape;
finalPath->Convert (1.0);
finalPath->Fill (theShape, 0);
if (theShape->hasPoints())
{
theShape->SortPoints ();
*px = theShape->getPoint(0).x;
}
delete theShape;
delete finalPath;
curve->unref();
}
开发者ID:NotBrianZach,项目名称:modalComposableProgrammableFuzzySearchingVectorGraphicEditing,代码行数:59,代码来源:sp-offset.cpp
示例2: set_shape
void SPOffset::set_shape() {
if ( this->originalPath == NULL ) {
// oops : no path?! (the offset object should do harakiri)
return;
}
#ifdef OFFSET_VERBOSE
g_print ("rad=%g\n", offset->rad);
#endif
// au boulot
if ( fabs(this->rad) < 0.01 ) {
// grosso modo: 0
// just put the source this as the offseted one, no one will notice
// it's also useless to compute the offset with a 0 radius
//XML Tree being used directly here while it shouldn't be.
const char *res_d = this->getRepr()->attribute("inkscape:original");
if ( res_d ) {
Geom::PathVector pv = sp_svg_read_pathv(res_d);
SPCurve *c = new SPCurve(pv);
g_assert(c != NULL);
this->setCurveInsync (c, TRUE);
this->setCurveBeforeLPE(c);
c->unref();
}
return;
}
// extra paraniac careful check. the preceding if () should take care of this case
if (fabs (this->rad) < 0.01) {
this->rad = (this->rad < 0) ? -0.01 : 0.01;
}
Path *orig = new Path;
orig->Copy ((Path *)this->originalPath);
if ( use_slow_but_correct_offset_method == false ) {
// version par outline
Shape *theShape = new Shape;
Shape *theRes = new Shape;
Path *originaux[1];
Path *res = new Path;
res->SetBackData (false);
// and now: offset
float o_width;
if (this->rad >= 0)
{
o_width = this->rad;
orig->OutsideOutline (res, o_width, join_round, butt_straight, 20.0);
}
else
{
o_width = -this->rad;
orig->OutsideOutline (res, -o_width, join_round, butt_straight, 20.0);
}
if (o_width >= 1.0)
{
// res->ConvertForOffset (1.0, orig, offset->rad);
res->ConvertWithBackData (1.0);
}
else
{
// res->ConvertForOffset (o_width, orig, offset->rad);
res->ConvertWithBackData (o_width);
}
res->Fill (theShape, 0);
theRes->ConvertToShape (theShape, fill_positive);
originaux[0] = res;
theRes->ConvertToForme (orig, 1, originaux);
Geom::OptRect bbox = this->desktopVisualBounds();
if ( bbox ) {
gdouble size = L2(bbox->dimensions());
gdouble const exp = this->transform.descrim();
if (exp != 0) {
size /= exp;
}
orig->Coalesce (size * 0.001);
//g_print ("coa %g exp %g item %p\n", size * 0.001, exp, item);
}
// if (o_width >= 1.0)
// {
// orig->Coalesce (0.1); // small treshhold, since we only want to get rid of small segments
// the curve should already be computed by the Outline() function
// orig->ConvertEvenLines (1.0);
// orig->Simplify (0.5);
// }
// else
//.........这里部分代码省略.........
开发者ID:NotBrianZach,项目名称:modalComposableProgrammableFuzzySearchingVectorGraphicEditing,代码行数:101,代码来源:sp-offset.cpp
示例3: if
static void
refresh_offset_source(SPOffset* offset)
{
if ( offset == NULL ) {
return;
}
offset->sourceDirty=false;
// le mauvais cas: pas d'attribut d => il faut verifier que c'est une SPShape puis prendre le contour
// The bad case: no d attribute. Must check that it's an SPShape and then take the outline.
SPObject *refobj=offset->sourceObject;
if ( refobj == NULL ) {
return;
}
SPItem *item = SP_ITEM (refobj);
SPCurve *curve = NULL;
if (SP_IS_SHAPE (item)) {
curve = SP_SHAPE (item)->getCurve ();
}
else if (SP_IS_TEXT (item)) {
curve = SP_TEXT (item)->getNormalizedBpath ();
}
else {
return;
}
if (curve == NULL) {
return;
}
Path *orig = new Path;
orig->LoadPathVector(curve->get_pathvector());
curve->unref();
if (!item->transform.isIdentity()) {
gchar const *t_attr = item->getRepr()->attribute("transform");
if (t_attr) {
Geom::Affine t;
if (sp_svg_transform_read(t_attr, &t)) {
orig->Transform(t);
}
}
}
// Finish up.
{
SPCSSAttr *css;
const gchar *val;
Shape *theShape = new Shape;
Shape *theRes = new Shape;
orig->ConvertWithBackData (1.0);
orig->Fill (theShape, 0);
css = sp_repr_css_attr (offset->sourceRepr , "style");
val = sp_repr_css_property (css, "fill-rule", NULL);
if (val && strcmp (val, "nonzero") == 0)
{
theRes->ConvertToShape (theShape, fill_nonZero);
}
else if (val && strcmp (val, "evenodd") == 0)
{
theRes->ConvertToShape (theShape, fill_oddEven);
}
else
{
theRes->ConvertToShape (theShape, fill_nonZero);
}
Path *originaux[1];
originaux[0] = orig;
Path *res = new Path;
theRes->ConvertToForme (res, 1, originaux);
delete theShape;
delete theRes;
char *res_d = res->svg_dump_path ();
delete res;
delete orig;
// TODO fix:
//XML Tree being used diectly here while it shouldn't be.
offset->getRepr()->setAttribute("inkscape:original", res_d);
free (res_d);
}
}
开发者ID:NotBrianZach,项目名称:modalComposableProgrammableFuzzySearchingVectorGraphicEditing,代码行数:95,代码来源:sp-offset.cpp