예제 #1
0
 public void Apply(VGMatrix projection, VGMatrix transformation, Vector2 offset, Texture2D vertices, Texture2D offsets)
 {
     _projection.SetValue(projection);
     _transformation.SetValue(transformation);
     _offset.SetValue(offset);
     _offsets.SetValue(offsets);
     _vertices.SetValue(vertices);
     _numOffsets.SetValue(new Vector2(offsets.Width, offsets.Height));
     _numVertices.SetValue(new Vector2(vertices.Width, vertices.Height));
     _pass.Apply();
 }
예제 #2
0
        public void SetImagePaint(VGImage image, VGMatrix paintTransformation)
        {
            if (image.LinearColorspace)
                _passIndex |= 1;
            else
                _passIndex &= ~1;

            _effect.CurrentTechnique = _techniques[(int)(image.Premultiplied ? VGPaintType.PatternPremultiplied : VGPaintType.Pattern)];
            _paintTransformation.SetValue(paintTransformation);
            _focalPoint.SetValue(Vector2.Zero);
            _effect.GraphicsDevice.Textures[1] = image.Texture;
            _effect.GraphicsDevice.SamplerStates[1] = image.GetSamplerState();
        }
예제 #3
0
        public void SetSolid(bool isNonscaling, VGMatrix projection, VGMatrix transformation, float thickness)
        {
            _projection.SetValue(projection);
            _transformation.SetValue(transformation);
            _thickness.SetValue(thickness);
            _offset.SetValue(Vector2.Zero);

            if (isNonscaling)
            {
                _effect.CurrentTechnique = _nonscalingTechnique;
                _currentPass = _passSolidNS;
            }
            else
            {
                _effect.CurrentTechnique = _scalingTechnique;
                _currentPass = _passSolid;
            }
        }
예제 #4
0
 public void Apply(VGMatrix projection, VGMatrix transformation)
 {
     _projection.SetValue(projection);
     _transformation.SetValue(transformation);
     _pass.Apply();
 }
예제 #5
0
 public void SetParameters(VGMatrix projection, VGMatrix transformation, VGCxForm cxForm)
 {
     _projection.SetValue(projection);
     _transformation.SetValue(transformation);
     _addTerm.SetValue(cxForm.AddTerm);
     _mulTerm.SetValue(cxForm.MulTerm);
     _offset.SetValue(Vector2.Zero);
 }
예제 #6
0
        public void SetPaint(VGPaint paint, VGMatrix paintTransformation)
        {
            _passIndex &= ~1;
            _paintTransformation.SetValue(paintTransformation);
            _focalPoint.SetValue(new Vector2(paint.Type == VGPaintType.RadialGradient ? (paint as VGRadialPaint).FocalPoint : 0, 0));
            _effect.CurrentTechnique = _techniques[(int)paint.Type];

            switch (paint.Type)
            {
                case VGPaintType.Color:
                    _color.SetValue((paint as VGColorPaint).Color.ToVector4());
                    break;
                case VGPaintType.Pattern:
                case VGPaintType.PatternPremultiplied:
                    var pattern = (paint as VGPatternPaint).Pattern;
                    _effect.GraphicsDevice.Textures[1] = pattern.Texture;
                    _effect.GraphicsDevice.SamplerStates[1] = pattern.GetSamplerState();
                    if (pattern.LinearColorspace) _passIndex |= 1;
                    break;
                case VGPaintType.LinearGradient:
                case VGPaintType.RadialGradient:
                    var gradient = paint as VGGradientPaint;
                    _effect.GraphicsDevice.Textures[1] = gradient.Gradient;
                    _effect.GraphicsDevice.SamplerStates[1] = gradient.GetSamplerState();
                    if (gradient.LinearColorspace) _passIndex |= 1;
                    break;
                default:
                    throw new ArgumentException("Invalid paint type!", "paint");
            }
        }
예제 #7
0
 internal void Clear(VGMatrix baseMatrix)
 {
     Matrices.Clear();
     Matrices.Push(baseMatrix);
 }
예제 #8
0
 public void PushCombineRight(VGMatrix matrix)
 {
     Matrices.Push(Matrices.Peek() * matrix);
 }
예제 #9
0
 public void PushCombineLeft(VGMatrix matrix)
 {
     Matrices.Push(matrix * Matrices.Peek());
 }
예제 #10
0
 public void Push(VGMatrix matrix)
 {
     Matrices.Push(matrix);
 }
예제 #11
0
 public void SetParameters(VGMatrix projection, VGMatrix transformation)
 {
     _projection.SetValue(projection);
     _transformation.SetValue(transformation);
     _offset.SetValue(_offsetValue = Vector4.Zero);
 }