private int AddJoint (int pointIndex, ref JoinSample joinSample, PenWorkspace ws, Buffer<Vector2> insetBuffer, Buffer<Vector2> outsetBuffer) { InsetOutsetCount vioCount = new InsetOutsetCount(); switch (_pen.LineJoin) { case LineJoin.Miter: vioCount = _pen.ComputeMiter(ref joinSample, ws); break; case LineJoin.Bevel: vioCount = _pen.ComputeBevel(ref joinSample, ws); break; } if (insetBuffer != null) { for (int i = 0; i < vioCount.InsetCount; i++) insetBuffer.SetNext(ws.XYInsetBuffer[i]); } if (outsetBuffer != null) { for (int i = 0; i < vioCount.OutsetCount; i++) outsetBuffer.SetNext(ws.XYOutsetBuffer[i]); } return (_strokeType != StrokeType.Outline) ? AddJoint(pointIndex, vioCount, ws) : 0; }
private int AddStartOrEndPoint (int pointIndex, PenWorkspace ws, Buffer<Vector2> positionBuffer, bool ccw) { int xyCount = ws.XYBuffer.Index; if (positionBuffer != null) { for (int i = 0; i < ws.OutlineIndexBuffer.Index; i++) positionBuffer.SetNext(ws.XYBuffer[ws.OutlineIndexBuffer[i]]); } if (_strokeType == StrokeType.Outline) return 0; int baseIndex = _vertexBufferIndex; _vertexBufferIndex += xyCount; for (int i = 0; i < xyCount; i++) _positionData[baseIndex + i] = ws.XYBuffer[i]; for (int i = 0; i < ws.IndexBuffer.Index; i++) _indexData[_indexBufferIndex++] = (short)(baseIndex + ws.IndexBuffer[i]); if (_colorData != null) { for (int i = 0; i < xyCount; i++) _colorData[baseIndex + i] = _pen.ColorAt(ws.UVBuffer[i], ws.PathLengthScale); } if (_textureData != null) { int texWidth = _pen.Brush.Texture.Width; int texHeight = _pen.Brush.Texture.Height; for (int i = baseIndex; i < _vertexBufferIndex; i++) { Vector2 pos = _positionData[i]; _textureData[i] = new Vector2(pos.X / texWidth, pos.Y / texHeight); } } _jointCCW[pointIndex] = ccw; return xyCount; }