Example #1
0
        internal void StencilGlyph(IRenderable path, ref Vector2 offset)
        {
            var effect = Device.EffectManager.StencilFill;
            effect.SetPathOffset(ref offset);

            // Render mesh
            if (path.HasFill)
            {
                path.BeforeRenderFill();
                if (State.Antialiasing == VGAntialiasing.None)
                {
                    effect.Apply();
                    path.RenderFill();
                }
                else
                    for (int samples = (int)State.Antialiasing - 1, MSAAMask = _msaaMasks[State.Antialiasing]; samples >= 0; samples--, MSAAMask <<= 1)
                    {
                        _device.MultiSampleMask = MSAAMask;
                        effect.SetScreenOffset(ref Surface.MSAAPattern[samples]);
                        effect.Apply();
                        path.RenderFill();
                    }
            }
        }
Example #2
0
        internal void StencilFill(IRenderable path)
        {
            var effect = Device.EffectManager.StencilFill;

            // Setup stenciling
            _device.BlendState = Device.BlendStates.NoColor;
            _device.DepthStencilState = State.FillRuleState;

            effect.SetParameters(State.Projection.Matrix, State.PathToSurface.Matrix);

            // Render mesh
            if (path.HasFill)
            {
                path.BeforeRenderFill();
                if (State.Antialiasing == VGAntialiasing.None)
                {
                    effect.Apply();
                    path.RenderFill();
                }
                else
                    for (int samples = (int)State.Antialiasing - 1, MSAAMask = _msaaMasks[State.Antialiasing]; samples >= 0; samples--, MSAAMask <<= 1)
                    {
                        _device.MultiSampleMask = MSAAMask;
                        effect.SetScreenOffset(ref Surface.MSAAPattern[samples]);
                        effect.Apply();
                        path.RenderFill();
                    }
            }
        }