Exemple #1
0
        private int AddJoint(int pointIndex, ref JoinSample joinSample, PenWorkspace ws, Buffer <CCVector2> insetBuffer, Buffer <CCVector2> 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);
        }
        /// <summary>
        /// Immediatley renders a <see cref="DrawCache"/> object.
        /// </summary>
        /// <param name="cache">A <see cref="DrawCache"/> object.</param>
        /// <remarks>Any previous unflushed geometry will be rendered first.</remarks>
        //public void DrawCache (DrawCache cache)
        //{
        //    if (_sortMode != DrawSortMode.Immediate)
        //        SetRenderState();

        //    FlushBuffer();

        //    cache.Render(_device, _defaultTexture);
        //}

        //private void SetRenderState ()
        //{
        //    _device.BlendState = (_blendState != null)
        //        ? _blendState : BlendState.AlphaBlend;

        //    _device.DepthStencilState = (_depthStencilState != null)
        //        ? _depthStencilState : DepthStencilState.None;

        //    _device.RasterizerState = (_rasterizerState != null)
        //        ? _rasterizerState : RasterizerState.CullCounterClockwise;

        //    _device.SamplerStates[0] = (_samplerState != null)
        //        ? _samplerState : SamplerState.PointWrap;

        //    _standardEffect.Projection = Matrix.CreateOrthographicOffCenter(0, _device.Viewport.Width, _device.Viewport.Height, 0, -1, 1);
        //    _standardEffect.World = _transform;
        //    _standardEffect.CurrentTechnique.Passes[0].Apply();

        //    if (_effect != null)
        //        _effect.CurrentTechnique.Passes[0].Apply();
        //}

        private void AddMiteredJoint (ref JoinSample js, Pen pen, PenWorkspace ws)
        {
            InsetOutsetCount vioCount = pen.ComputeMiter(ref js, ws);

            AddVertex(ws.XYInsetBuffer[0], pen.ColorAt(ws.UVInsetBuffer[0], ws.PathLengthScale), pen);
            AddVertex(ws.XYOutsetBuffer[0], pen.ColorAt(ws.UVOutsetBuffer[0], ws.PathLengthScale), pen);
        }