public Stroke NewFromPoints(VectorsStrokeType type, CoordinateList <double> controlpoints, bool closed) { var tmp = controlpoints.ToArray(); int strokeID = gimp_vectors_stroke_new_from_points(_ID, type, tmp.Length, tmp, closed); return(new Stroke(_ID, strokeID)); }
Stroke AddStroke(Vectors vectors) { var controlpoints = new CoordinateList <double> { new Coordinate <double>(10, 10), new Coordinate <double>(50, 50), new Coordinate <double>(100, 100) }; return(vectors.NewFromPoints(VectorsStrokeType.Bezier, controlpoints, true)); }
public void Select(CoordinateList <double> segs, ChannelOps operation, bool antialias, bool feather, double featherRadius) { var array = segs.ToArray(); if (!gimp_free_select(_imageID, array.Length, array, operation, antialias, feather, featherRadius)) { throw new GimpSharpException(); } }
public void Add() { var list = new CoordinateList <int>(); var c = new Coordinate <int>(13, 14); list.Add(c); Assert.AreEqual(1, list.Count); list.Add(23, 24); Assert.AreEqual(2, list.Count); }
public void Equals() { var list1 = new CoordinateList <int>(); var list2 = new CoordinateList <int>(); var c = new Coordinate <int>(13, 14); list1.Add(c); Assert.IsFalse(list1.Equals(list2)); list2.Add(c); Assert.IsTrue(list1.Equals(list2)); }
public void ToArray() { var list = new CoordinateList <int>(); var c = new Coordinate <int>(13, 14); int[] array = list.ToArray(); Assert.IsNull(array); list.Add(c); array = list.ToArray(); Assert.AreEqual(2, array.Length); }
public void NewFromPoints() { var vectors = new Vectors(_image, "firstVector"); var controlpoints = new CoordinateList <double>() { new Coordinate <double>(50, 50), new Coordinate <double>(100, 100), new Coordinate <double>(150, 150) }; vectors.NewFromPoints(VectorsStrokeType.Bezier, controlpoints, false); Assert.AreEqual(1, vectors.Strokes.Count); }
// [Test] public void Close() { var vectors = new Vectors(_image, "firstVector"); var controlpoints = new CoordinateList <double>() { new Coordinate <double>(50, 50), new Coordinate <double>(100, 100), new Coordinate <double>(150, 150) }; var stroke = vectors.NewFromPoints(VectorsStrokeType.Bezier, controlpoints, false); stroke.Close(); bool closed; stroke.GetPoints(out closed); Assert.IsTrue(closed); }
public void ForEach() { var list = new CoordinateList <int>(); for (int i = 0; i < 10; i++) { list.Add(new Coordinate <int>(i, 2 * i)); } int count = 0; list.ForEach(c => { Assert.IsTrue(c == new Coordinate <int>(count, 2 * count)); count++; }); Assert.AreEqual(list.Count, count); }
public void Enumerator() { var list = new CoordinateList <int>(); for (int i = 0; i < 10; i++) { list.Add(new Coordinate <int>(i, 2 * i)); } int count = 0; foreach (var c in list) { Assert.IsTrue(c == new Coordinate <int>(count, 2 * count)); count++; } Assert.AreEqual(list.Count, count); }
public void GetPoints() { var vectors = new Vectors(_image, "firstVector"); var controlpoints = new CoordinateList <double>() { new Coordinate <double>(50, 50), new Coordinate <double>(100, 100), new Coordinate <double>(150, 150) }; var stroke = vectors.NewFromPoints(VectorsStrokeType.Bezier, controlpoints, false); bool closed; // Fix me: this one segfaults // var points = stroke.GetPoints(out closed); // Assert.AreEqual(controlpoints.Count, points.Count); // Assert.AreEqual(controlpoints, points); // Assert.IsFalse(closed); }
public void Scale() { var vectors = new Vectors(_image, "firstVector"); var controlpoints = new CoordinateList <double>() { new Coordinate <double>(50, 50), new Coordinate <double>(100, 100), new Coordinate <double>(150, 150) }; var stroke = vectors.NewFromPoints(VectorsStrokeType.Bezier, controlpoints, false); double precision = 0.001; stroke.Close(); double oldLength = stroke.GetLength(precision); stroke.Scale(2, 2); double newLength = stroke.GetLength(precision); Assert.IsTrue(Math.Abs(2 * oldLength - newLength) < precision); }
public void Select(CoordinateList <double> segs, ChannelOps operation) { Select(segs, operation, false, false, 0); }
public void Constructor() { var list = new CoordinateList <int>(); Assert.AreEqual(0, list.Count); }