Search in sources :

Example 1 with ClosePath

use of com.xenoage.zong.symbols.path.ClosePath in project Zong by Xenoage.

the class SvgPathReader method closePath.

private void closePath() {
    pCurrent = pStart;
    elements.add(new ClosePath());
}
Also used : ClosePath(com.xenoage.zong.symbols.path.ClosePath)

Example 2 with ClosePath

use of com.xenoage.zong.symbols.path.ClosePath in project Zong by Xenoage.

the class SvgPathReaderTest method testImplicitLineToAbs.

@Test
public void testImplicitLineToAbs() {
    String validPath = "M1200,1300 1400,1050 1600,1300 1800,1550 2000,1300z";
    Path p = new SvgPathReader(validPath).read();
    assertEquals(alist(new MoveTo(p(2, 3)), new LineTo(p(4, 0.5f)), new LineTo(p(6, 3)), new LineTo(p(8, 5.5f)), new LineTo(p(10, 3)), new ClosePath()), p.getElements());
}
Also used : ClosePath(com.xenoage.zong.symbols.path.ClosePath) Path(com.xenoage.zong.symbols.path.Path) ClosePath(com.xenoage.zong.symbols.path.ClosePath) MoveTo(com.xenoage.zong.symbols.path.MoveTo) LineTo(com.xenoage.zong.symbols.path.LineTo) Test(org.junit.Test)

Example 3 with ClosePath

use of com.xenoage.zong.symbols.path.ClosePath in project Zong by Xenoage.

the class SvgPathReaderTest method test2.

@Test
public void test2() {
    String validPath = "M1200,1300 L1400,1050 L1600,1300 1800,1550 M2000,1300z";
    Path p = new SvgPathReader(validPath).read();
    assertEquals(alist(new MoveTo(p(2, 3)), new LineTo(p(4, 0.5f)), new LineTo(p(6, 3)), new LineTo(p(8, 5.5f)), new MoveTo(p(10, 3)), new ClosePath()), p.getElements());
}
Also used : ClosePath(com.xenoage.zong.symbols.path.ClosePath) Path(com.xenoage.zong.symbols.path.Path) ClosePath(com.xenoage.zong.symbols.path.ClosePath) MoveTo(com.xenoage.zong.symbols.path.MoveTo) LineTo(com.xenoage.zong.symbols.path.LineTo) Test(org.junit.Test)

Example 4 with ClosePath

use of com.xenoage.zong.symbols.path.ClosePath in project Zong by Xenoage.

the class SvgPathReaderTest method test1.

@Test
public void test1() {
    String validPath = "M 1100 1100 L 1300 1100 L 1200 1300 z";
    Path p = new SvgPathReader(validPath).read();
    assertEquals(alist(new MoveTo(p(1, 1)), new LineTo(p(3, 1)), new LineTo(p(2, 3)), new ClosePath()), p.getElements());
}
Also used : ClosePath(com.xenoage.zong.symbols.path.ClosePath) Path(com.xenoage.zong.symbols.path.Path) ClosePath(com.xenoage.zong.symbols.path.ClosePath) MoveTo(com.xenoage.zong.symbols.path.MoveTo) LineTo(com.xenoage.zong.symbols.path.LineTo) Test(org.junit.Test)

Example 5 with ClosePath

use of com.xenoage.zong.symbols.path.ClosePath in project Zong by Xenoage.

the class SvgPathReaderTest method testImplicitLineToRel.

@Test
public void testImplicitLineToRel() {
    String validPath = "m1200,1300 100,100 z";
    Path p = new SvgPathReader(validPath).read();
    assertEquals(alist(new MoveTo(p(2, 3)), new LineTo(p(3, 4f)), new ClosePath()), p.getElements());
}
Also used : ClosePath(com.xenoage.zong.symbols.path.ClosePath) Path(com.xenoage.zong.symbols.path.Path) ClosePath(com.xenoage.zong.symbols.path.ClosePath) MoveTo(com.xenoage.zong.symbols.path.MoveTo) LineTo(com.xenoage.zong.symbols.path.LineTo) Test(org.junit.Test)

Aggregations

ClosePath (com.xenoage.zong.symbols.path.ClosePath)6 Path (com.xenoage.zong.symbols.path.Path)5 LineTo (com.xenoage.zong.symbols.path.LineTo)4 MoveTo (com.xenoage.zong.symbols.path.MoveTo)4 Test (org.junit.Test)4 Point2f (com.xenoage.utils.math.geom.Point2f)1