std::unique_ptr<SVGAnimatedType> SVGAnimatedTransformListAnimator::constructFromString(const String& string)
{
    auto animatedType = SVGAnimatedType::createTransformList(std::make_unique<SVGTransformList>());
    animatedType->transformList().parse(m_transformTypeString + string + ')');
    ASSERT(animatedType->transformList().size() <= 1);
    return animatedType;
}
示例#2
0
boolean TextGraphic::RotatedIntersects (BoxObj& userb, Graphic* gs) {
    int beg, end, lineSize, nextBeg, ypos = 0;
    const char* s = GetOriginal();
    int size = strlen(s);
    PSFont* f = gs->GetFont();
    Coord x[4], tx[5];
    Coord y[4], ty[5];
    
    x[0] = x[1] = x[2] = x[3] = y[0] = y[1] = 0;
    y[2] = y[3] = f->Height();

    for (beg = 0; beg < size; beg = nextBeg) {
        GetLine(s, size, beg, end, lineSize, nextBeg);
        x[1] = x[2] = f->Width(&s[beg], lineSize) - 1;
	transformList(x, y, 4, tx, ty, gs);
	tx[4] = tx[0];
	ty[4] = ty[0];
	FillPolygonObj fp(tx, ty, 5);
	if (fp.Intersects(userb)) {
            return true;
        }
        y[0] -= _lineHt;
        y[1] -= _lineHt;
        y[2] -= _lineHt;
        y[3] -= _lineHt;
    }
    return false;
}
示例#3
0
bool RasterRect::intersects (BoxObj& userb, Graphic* gs) {
    Transformer* t = gs->GetTransformer();
    Coord xmax = _raster->Width();
    Coord ymax = _raster->Height();
    Coord tx0, ty0, tx1, ty1;
    
    if (t != nil && t->Rotated()) {
	Coord x[4], tx[5];
	Coord y[4], ty[5];
    
	x[0] = x[3] = y[0] = y[1] = 0;
	x[2] = x[1] = xmax;
	y[2] = y[3] = ymax;
	transformList(x, y, 4, tx, ty, gs);
	tx[4] = tx[0];
	ty[4] = ty[0];
	FillPolygonObj fp (tx, ty, 5);
	return fp.Intersects(userb);
    
    } else if (t != nil) {
	t->Transform(0, 0, tx0, ty0);
	t->Transform(xmax, ymax, tx1, ty1);
	BoxObj b1 (tx0, ty0, tx1, ty1);
	return b1.Intersects(userb);

    } else {
	BoxObj b2 (0, 0, xmax, ymax);
	return b2.Intersects(userb);
    }
}
void ImageCollectionMultiplier::transform(const ImageLandmarkDataPtr& data,
                                          int transformType,
                                          std::function<void (const ImageLandmarkDataPtr& data)> processCallback)
{
  ImageTransformer transformer;
  TransformListTypePtr transforms = transformList(data, transformType);
  
  for (const cv::Mat& transformMat : *transforms)
  {
    ImageLandmarkDataPtr newData = transformer.TransformDataWithMat(data, transformMat, m_shouldSaveNewImages);
    if (newData)
    {
      processCallback(newData);
    }
  }
}
示例#5
0
文件: lines.c 项目: barak/ivtools-cvs
boolean MultiLine::f_intersects (BoxObj& userb, Graphic* gs) {
    Coord* convx, *convy;
    BoxObj b;
    boolean result = false;
    getBox(b, gs);

    if (b.Intersects(userb)) {
	convx = new Coord[count()+1];
	convy = new Coord[count()+1];
	transformList(x(), y(), count(), convx, convy, gs);
	FillPolygonObj fp (convx, convy, count());
	result = fp.Intersects(userb);
	delete convx;
	delete convy;
    }
    return result;    
}
示例#6
0
文件: splines.cpp 项目: PNCG/neuron
bool OpenBSpline::s_intersects (BoxObj& userb, Graphic* gs) {
    Coord* convx, *convy;
    BoxObj b;
    bool result = false;
    getBox(b, gs);

    if (b.Intersects(userb)) {
	convx = new Coord[_count];
	convy = new Coord[_count];
	transformList(_x, _y, _count, convx, convy, gs);
	MultiLineObj ml;
	ml.SplineToMultiLine(convx, convy, _count);
	result = ml.Intersects(userb);
	delete convx;
	delete convy;
    }
    return result;
}
示例#7
0
文件: splines.cpp 项目: PNCG/neuron
bool ClosedBSpline::f_intersects (BoxObj& userb, Graphic* gs) {
    Coord* convx, *convy;
    BoxObj b;
    bool result = false;
    getBox(b, gs);

    if (b.Intersects(userb)) {
	convx = new Coord[_count];
	convy = new Coord[_count];
	transformList(_x, _y, _count, convx, convy, gs);
	FillPolygonObj fp;
	fp.ClosedSplineToPolygon(convx, convy, _count);
	result = fp.Intersects(userb);
	delete convx;
	delete convy;
    }
    return result;
}