public void Transform(Matrix2x3 matrix) { if (Triangulated) { for (int i = 0; i < Vertices.Count; i++) { Vertices[i] = matrix.ApplyTo(Vertices[i]); } } else { if (polygons != null) { for (int i = 0; i < polygons.Count; i++) { polygons[i] = matrix.ApplyTo(polygons[i]).ToList(); } } if (tree != null) { TransformRecursiveley(tree, matrix); } } }
static void TransformRecursiveley(PolyNode node, Matrix2x3 matrix) { foreach (PolyNode childNode in node.Childs) { childNode.Contour = matrix.ApplyTo(childNode.Contour).ToList(); TransformRecursiveley(childNode, matrix); } }
protected override Vector2 GetTexturePosition(Vector2 vertex, Matrix2x3 inverseTransform) { if (texture == null) { return(Vector2.Zero); } Vector2 textPos = inverseTransform.ApplyTo(vertex); textPos.X /= texture.Width; textPos.Y /= texture.Height; return(textPos); }
protected override unsafe void FillBuffer(ref BrushBuffer buffer) { buffer.Type = 3; if (gradientStops != null && gradientStops.Length > 0) { buffer.ColorCount = gradientStops.Length; fixed(float *colors = buffer.GradientColors, positions = buffer.GradientPositions) { for (int i = 0; i < gradientStops.Length; i++) { colors[4 * i + 0] = gradientStops[i].Color.R; colors[4 * i + 1] = gradientStops[i].Color.G; colors[4 * i + 2] = gradientStops[i].Color.B; colors[4 * i + 3] = gradientStops[i].Color.A; positions[i * 4] = gradientStops[i].Position; } } } Matrix2x3 transformFromCircle = Matrix2x3.Translation(Center) * Matrix2x3.Rotation(Angle) * Matrix2x3.Scaling(RadiusX, RadiusY); Matrix2x3 transformToCircle = (Transform * transformFromCircle).Invert(); fixed(float *matrix = buffer.Matrix) { for (int i = 0; i < 6; i++) { matrix[i * 4] = transformToCircle[i / 3, i % 3]; } } if (FocusPoint.HasValue) { Vector2 transformedFocusPoint = transformToCircle.ApplyTo(FocusPoint.Value); buffer.Point1 = new SharpDX.Vector2(transformedFocusPoint.X, transformedFocusPoint.Y); buffer.Point2 = new SharpDX.Vector2(1, 0); } }
public void Transform(Matrix2x3 matrix) { if (Triangulated) { for (int i = 0; i < Vertices.Count; i++) Vertices[i] = matrix.ApplyTo(Vertices[i]); } else { if (polygons != null) { for (int i = 0; i < polygons.Count; i++) polygons[i] = matrix.ApplyTo(polygons[i]).ToList(); } if (tree != null) { TransformRecursiveley(tree, matrix); } } }
static void TransformRecursiveley(PolyNode node, Matrix2x3 matrix) { foreach (PolyNode childNode in node.Childs) { childNode.Contour = matrix.ApplyTo(childNode.Contour).ToList(); TransformRecursiveley(childNode, matrix); } }