コード例 #1
0
ファイル: SoftShadow.cs プロジェクト: CecleCW/ProductMan
            private void CreateFiller( Types.Vector ev2 )
            {
                Types.Vector ev1 = _epos - _pos;
                Types.Vector lv1 = _lastpos - _pos;
                Types.Vector lv2 = (_lastpos + ev2) - _epos;

                Primitives.Path part = new BinaryComponents.VectorGraphics.Primitives.Path();

                part.Add( new Primitives.Path.Move( _lastpos ) );

                part.Add( new Primitives.Path.Line( _lastpos + ev2 ) );
                part.Add( new Primitives.Path.EllipticalArc( _softShadow._extent, _softShadow._extent, 0, false, false, _epos ) );

                part.Add( new Primitives.Path.Line( _lastpos ) );

                part.Add( new Primitives.Path.Close() );

                part.Pen = null;

                Types.Point gstart = _pos + (_lastpos - _pos) / 2, gend = gstart + (ev1 + ev2).Normalize( _softShadow._extent * 2/3 );

                part.Brush = new Paint.Brushes.RadialGradientBrush
                    ( _softShadow._color, Paint.Color.Transparent, gstart, gend );

                _parts.Add( part );

                _innerPath.Add( new Primitives.Path.Line( _lastpos ) );
            }
コード例 #2
0
ファイル: SoftShadow.cs プロジェクト: CecleCW/ProductMan
            public override void VisitLine( Primitives.Path.Line line )
            {
                Types.Vector lv = line.To - _lastpos;
                Types.Vector ev = new Types.Vector( lv.Y, -lv.X ).Normalize( _softShadow._extent );

                if( _epos != null )
                {
                    CreateFiller( ev );
                }

                Primitives.Path part = new BinaryComponents.VectorGraphics.Primitives.Path();

                part.Add( new Primitives.Path.Move( _lastpos + ev ) );
                part.Add( new Primitives.Path.Line( line.To + ev ) );
                part.Add( new Primitives.Path.Line( line.To ) );
                part.Add( new Primitives.Path.Line( _lastpos ) );
                part.Add( new Primitives.Path.Line( _lastpos + ev ) );
                part.Add( new Primitives.Path.Close() );

                part.Pen = null;

                Types.Point gstart = line.To, gend = line.To + ev;

                part.Brush = new Paint.Brushes.LinearGradientBrush
                    ( _softShadow._color, Paint.Color.Transparent, gstart, gend, Paint.Brushes.LinearGradientBrush.RenderHint.NoClip );

                _parts.Add( part );

                if( _estartpos == null )
                {
                    _estartpos = _pos + ev;
                }
                if( _startev == null )
                {
                    _startev = ev;
                }

                _lastpos = _pos = line.To;
                _epos = _pos + ev;

                _innerPath.Add( new Primitives.Path.Line( line.To ) );
            }