public static SKVertices CreateCopy(SKVertexMode vmode, SKPoint[] positions, SKPoint[] texs, SKColor[] colors, UInt16[] indices) { if (positions == null) { throw new ArgumentNullException(nameof(positions)); } if (texs != null && positions.Length != texs.Length) { throw new ArgumentException("The number of texture coordinates must match the number of vertices.", nameof(texs)); } if (colors != null && positions.Length != colors.Length) { throw new ArgumentException("The number of colors must match the number of vertices.", nameof(colors)); } var vertexCount = positions.Length; var indexCount = indices?.Length ?? 0; fixed(SKPoint *p = positions) fixed(SKPoint * t = texs) fixed(SKColor * c = colors) fixed(UInt16 * i = indices) { return(GetObject(SkiaApi.sk_vertices_make_copy(vmode, vertexCount, p, t, (uint *)c, indexCount, i))); } }
private void DrawOrFillMesh([NotNull] IPaintProvider provider, [NotNull] Triangle[] mesh) { using (var paint = provider.Paint.Clone()) { const SKVertexMode geometryMode = SKVertexMode.Triangles; var vertices = new SKPoint[mesh.Length * 3]; for (var i = 0; i < mesh.Length; ++i) { var j = i * 3; vertices[j] = mesh[i].Point1.ToSKPoint(); vertices[j + 1] = mesh[i].Point2.ToSKPoint(); vertices[j + 2] = mesh[i].Point3.ToSKPoint(); } var colors = new SKColor[vertices.Length]; for (var i = 0; i < colors.Length; ++i) { colors[i] = SKColors.White; } _canvas?.DrawVertices(geometryMode, vertices, colors, paint); } SetDirty(); }
public void DrawVertices(SKVertexMode vmode, SKPoint[] vertices, SKPoint[] texs, SKColor[] colors, SKBlendMode mode, UInt16[] indices, SKPaint paint) { if (vertices == null) { throw new ArgumentNullException(nameof(vertices)); } if (paint == null) { throw new ArgumentNullException(nameof(paint)); } if (texs != null && vertices.Length != texs.Length) throw new ArgumentException("The number of texture coordinates must match the number of vertices.", nameof(texs)); }
public void DrawVertices(SKVertexMode vmode, SKPoint[] vertices, SKPoint[] texs, SKColor[] colors, SKBlendMode mode, UInt16[] indices, SKPaint paint) { var vert = SKVertices.CreateCopy(vmode, vertices, texs, colors, indices); DrawVertices(vert, mode, paint); }
public void DrawVertices(SKVertexMode vmode, SKPoint[] vertices, SKPoint[] texs, SKColor[] colors, SKPaint paint) { var vert = SKVertices.CreateCopy(vmode, vertices, texs, colors); DrawVertices(vert, SKBlendMode.Modulate, paint); }
public static SKVertices CreateCopy(SKVertexMode vmode, SKPoint[] positions, SKPoint[] texs, SKColor[] colors) { return(CreateCopy(vmode, positions, texs, colors, null)); }
public void DrawVertices(SKVertexMode vmode, SKPoint[] vertices, SKPoint[] texs, SKColor[] colors, UInt16[] indices, SKPaint paint) { DrawVertices(vmode, vertices, texs, colors, SKBlendMode.Modulate, indices, paint); }
public void DrawVertices(SKVertexMode vmode, SKPoint[] vertices, SKPoint[] texs, SKColor[] colors, SKPaint paint) { DrawVertices(vmode, vertices, texs, colors, null, paint); }