Clone() публичный абстрактный Метод

public abstract Clone ( ) : object
Результат object
Пример #1
0
 public Entry(string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
 {
     this.s               = s;
     this.font            = (Font)font.Clone();      // An owner could possibly call Dispose()!
     this.brush           = (Brush)brush.Clone();
     this.layoutRectangle = layoutRectangle;
     this.format          = (StringFormat)format.Clone();
 }
Пример #2
0
 public Pen(Brush brush, float width)
 {
     if (brush == null)
         throw new ArgumentNullException ("brush");
     this.brush = (Brush) brush.Clone ();
     var sb = brush as SolidBrush;
     if (sb != null)
         color = sb.Color;
 }
Пример #3
0
 public Pen(Brush brush, float width)
 {
     _brush      = (Brush)brush.Clone();;
     _width      = width;
     _dashStyle  = DashStyle.Solid;
     _startCap   = LineCap.Flat;
     _dashCap    = DashCap.Flat;
     _endCap     = LineCap.Flat;
     _alignment  = PenAlignment.Center;
     _lineJoin   = LineJoin.Miter;
     _miterLimit = 10f;
     _transform  = new Matrix();
 }
Пример #4
0
		public Pen (Brush brush, float width)
		{
			_brush = (Brush)brush.Clone();;
			_width = width;
			_dashStyle = DashStyle.Solid;
			_startCap = LineCap.Flat;
			_dashCap = DashCap.Flat;
			_endCap = LineCap.Flat;
			_alignment = PenAlignment.Center;
			_lineJoin = LineJoin.Miter;
			_miterLimit = 10f;
			_transform = new Matrix();
		}
Пример #5
0
        public Pen(Brush brush, float width)
        {
            if (brush == null)
            {
                throw new ArgumentNullException("brush");
            }
            this.brush = (Brush)brush.Clone();
            var sb = brush as SolidBrush;

            if (sb != null)
            {
                color = sb.Color;
            }
        }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the VGElement class.
 /// </summary>
 /// <param name="newShapeDrawAction">Drawing action: Edge, Fill, Both</param>
 /// <param name="newBrush">Brush for text and fills</param>
 /// <param name="newBounds">Bounds of element</param>
 public VGElement(ShapeDrawAction newShapeDrawAction, Brush newBrush, RectangleF newBounds)
 {
   this.InitStandards();
   this.shapeDrawAction = newShapeDrawAction;
   this.Brush = newBrush == null ? null : (Brush)newBrush.Clone();
   this.Bounds = newBounds;
 }
Пример #7
0
 /// <summary>
 /// Constructor that creates a <see cref="Brush"/> fill, using a user-supplied, custom
 /// <see cref="Brush"/>.  This constructor will make the brush unscaled (see <see cref="IsScaled"/>),
 /// but it provides <see paramref="alignH"/> and <see paramref="alignV"/> parameters to control
 /// alignment of the brush with respect to the filled object.
 /// </summary>
 /// <param name="brush">The <see cref="Brush"/> to use for fancy fills.  Typically, this would
 /// be a <see cref="LinearGradientBrush"/> or a <see cref="TextureBrush"/> class</param>
 /// <param name="alignH">Controls the horizontal alignment of the brush within the filled object
 /// (see <see cref="AlignH"/></param>
 /// <param name="alignV">Controls the vertical alignment of the brush within the filled object
 /// (see <see cref="AlignV"/></param>
 public Fill( Brush brush, AlignH alignH, AlignV alignV )
 {
     Init();
     _alignH = alignH;
     _alignV = alignV;
     _isScaled = false;
     _color = Color.White;
     _brush = (Brush) brush.Clone();
     _type = FillType.Brush;
 }
Пример #8
0
 /// <summary>
 /// Constructor that creates a <see cref="Brush"/> fill, using a user-supplied, custom
 /// <see cref="Brush"/>.  The brush will be scaled to fit the destination screen object
 /// according to the <see paramref="isScaled"/> parameter.
 /// </summary>
 /// <param name="brush">The <see cref="Brush"/> to use for fancy fills.  Typically, this would
 /// be a <see cref="LinearGradientBrush"/> or a <see cref="TextureBrush"/> class</param>
 /// <param name="isScaled">Determines if the brush will be scaled to fit the bounding box
 /// of the destination object.  true to scale it, false to leave it unscaled</param>
 public Fill( Brush brush, bool isScaled )
 {
     Init();
     _isScaled = isScaled;
     _color = Color.White;
     _brush = (Brush) brush.Clone();
     _type = FillType.Brush;
 }
Пример #9
0
        private Brush ScaleBrush( RectangleF rect, Brush brush, bool isScaled )
        {
            if ( brush != null )
            {
                if ( brush is SolidBrush )
                {
                    return (Brush) brush.Clone();
                }
                else if ( brush is LinearGradientBrush )
                {
                    LinearGradientBrush linBrush = (LinearGradientBrush) brush.Clone();

                    if ( isScaled )
                    {
                        linBrush.ScaleTransform( rect.Width / linBrush.Rectangle.Width,
                            rect.Height / linBrush.Rectangle.Height, MatrixOrder.Append );
                        linBrush.TranslateTransform( rect.Left - linBrush.Rectangle.Left,
                            rect.Top - linBrush.Rectangle.Top, MatrixOrder.Append );
                    }
                    else
                    {
                        float	dx = 0,
                                dy = 0;
                        switch ( _alignH )
                        {
                        case AlignH.Left:
                            dx = rect.Left - linBrush.Rectangle.Left;
                            break;
                        case AlignH.Center:
                            dx = ( rect.Left + rect.Width / 2.0F ) - linBrush.Rectangle.Left;
                            break;
                        case AlignH.Right:
                            dx = ( rect.Left + rect.Width ) - linBrush.Rectangle.Left;
                            break;
                        }

                        switch ( _alignV )
                        {
                        case AlignV.Top:
                            dy = rect.Top - linBrush.Rectangle.Top;
                            break;
                        case AlignV.Center:
                            dy = ( rect.Top + rect.Height / 2.0F ) - linBrush.Rectangle.Top;
                            break;
                        case AlignV.Bottom:
                            dy = ( rect.Top + rect.Height) - linBrush.Rectangle.Top;
                            break;
                        }

                        linBrush.TranslateTransform( dx, dy, MatrixOrder.Append );
                    }

                    return linBrush;

                } // LinearGradientBrush
                else if ( brush is TextureBrush )
                {
                    TextureBrush texBrush = (TextureBrush) brush.Clone();

                    if ( isScaled )
                    {
                        texBrush.ScaleTransform( rect.Width / texBrush.Image.Width,
                            rect.Height / texBrush.Image.Height, MatrixOrder.Append );
                        texBrush.TranslateTransform( rect.Left, rect.Top, MatrixOrder.Append );
                    }
                    else
                    {
                        float	dx = 0,
                                dy = 0;
                        switch ( _alignH )
                        {
                        case AlignH.Left:
                            dx = rect.Left;
                            break;
                        case AlignH.Center:
                            dx = ( rect.Left + rect.Width / 2.0F );
                            break;
                        case AlignH.Right:
                            dx = ( rect.Left + rect.Width );
                            break;
                        }

                        switch ( _alignV )
                        {
                        case AlignV.Top:
                            dy = rect.Top;
                            break;
                        case AlignV.Center:
                            dy = ( rect.Top + rect.Height / 2.0F );
                            break;
                        case AlignV.Bottom:
                            dy = ( rect.Top + rect.Height);
                            break;
                        }

                        texBrush.TranslateTransform( dx, dy, MatrixOrder.Append );
                    }

                    return texBrush;
                }
                else // other brush type
                {
                    return (Brush) brush.Clone();
                }
            }
            else
                // If they didn't provide a brush, make one using the fillcolor gradient to white
                return new LinearGradientBrush( rect, Color.White, _color, 0F );
        }
Пример #10
0
 /// <summary>
 /// Constructor that creates a <see cref="Brush"/> fill, using a user-supplied, custom
 /// <see cref="Brush"/>.  This constructor will make the brush unscaled (see <see cref="IsScaled"/>),
 /// but it provides <see paramref="alignH"/> and <see paramref="alignV"/> parameters to control
 /// alignment of the brush with respect to the filled object.
 /// </summary>
 /// <param name="brush">The <see cref="Brush"/> to use for fancy fills.  Typically, this would
 /// be a <see cref="LinearGradientBrush"/> or a <see cref="TextureBrush"/> class</param>
 /// <param name="alignH">Controls the horizontal alignment of the brush within the filled object
 /// (see <see cref="AlignH"/></param>
 /// <param name="alignV">Controls the vertical alignment of the brush within the filled object
 /// (see <see cref="AlignV"/></param>
 public Fill( Brush brush, AlignH alignH, AlignV alignV )
 {
     Init();
     this.alignH = alignH;
     this.alignV = alignV;
     this.isScaled = false;
     this.color = Color.White;
     this.brush = (Brush) brush.Clone();
     this.type = FillType.Brush;
 }
Пример #11
0
 /// <summary>
 /// Constructor that creates a <see cref="Brush"/> fill, using a user-supplied, custom
 /// <see cref="Brush"/>.  The brush will be scaled to fit the destination screen object
 /// unless you manually change <see cref="IsScaled"/> to false;
 /// </summary>
 /// <param name="brush">The <see cref="Brush"/> to use for fancy fills.  Typically, this would
 /// be a <see cref="LinearGradientBrush"/> or a <see cref="TextureBrush"/> class</param>
 public Fill( Brush brush )
 {
     Init();
     this.color = Color.White;
     this.brush = (Brush) brush.Clone();
     this.type = FillType.Brush;
 }
Пример #12
0
 /// <summary>
 /// Constructor that creates a <see cref="Brush"/> fill, using a user-supplied, custom
 /// <see cref="Brush"/>.  The brush will be scaled to fit the destination screen object
 /// according to the <see paramref="isScaled"/> parameter.
 /// </summary>
 /// <param name="brush">The <see cref="Brush"/> to use for fancy fills.  Typically, this would
 /// be a <see cref="LinearGradientBrush"/> or a <see cref="TextureBrush"/> class</param>
 /// <param name="isScaled">Determines if the brush will be scaled to fit the bounding box
 /// of the destination object.  true to scale it, false to leave it unscaled</param>
 public Fill( Brush brush, bool isScaled )
 {
     Init();
     this.isScaled = isScaled;
     this.color = Color.White;
     this.brush = (Brush) brush.Clone();
     this.type = FillType.Brush;
 }
        /// <summary>
        /// The constructor for the RenderThread. Sets up the private members
        /// of the class, but DOES NOT start the rendering process.
        /// </summary>
        /// @param metrics The MapMetrics object for this Map
        /// @param features The VectorFeature array
        /// @param type The type of shapefile we're going to draw
        /// @param beginning The array index of the VectorFeature to begin drawing with
        /// @param ending The array index of the VectorFeature to end drawing with
        /// @param pen The pen to draw the features with
        /// @param brush The brush to fill the features with
        public RenderThread( MapMetrics metrics, 
							 VectorFeature[] features,
							 ShapeType type,
							 int beginning,
							 int ending,
							 Pen pen,
							 Brush brush )
        {
            _mapMetrics = metrics;
            _features = features;
            _shapeType = type;
            _beginningFeature = beginning;
            _endingFeature = ending;
            _pen = (Pen) pen.Clone();
            _brush = (Brush) brush.Clone();
            _gr = Graphics.FromImage( _mapMetrics.Canvas );
        }
Пример #14
0
 /// <summary>
 /// Initializes a new instance of the VGElement class.
 /// </summary>
 /// <param name="newShapeDrawAction">Drawing action: Edge, Fill, Both</param>
 /// <param name="newBrush">Brush for text and fills</param>
 /// <param name="newFont">Font for text</param>
 /// <param name="newFontColor">Color for text</param>
 /// <param name="newBounds">Bounds of element</param>
 /// <param name="newStyleGroup">Group Enumeration, <see cref="VGStyleGroup"/></param>
 /// <param name="newName">Name of Element</param>
 /// <param name="newElementGroup">Element group description</param>
 public VGElement(
   ShapeDrawAction newShapeDrawAction,
   Brush newBrush,
   Font newFont,
   Color newFontColor,
   RectangleF newBounds,
   VGStyleGroup newStyleGroup,
   string newName,
   string newElementGroup)
 {
   this.InitStandards();
   this.styleGroup = newStyleGroup;
   this.name = newName;
   this.elementGroup = newElementGroup;
   this.shapeDrawAction = newShapeDrawAction;
   this.Brush = newBrush == null ? null : (Brush)newBrush.Clone();
   this.Font = newFont == null ? null : (Font)newFont.Clone();
   this.FontColor = newFontColor;
   this.Bounds = newBounds;
 }
Пример #15
0
 /// <summary>
 /// Initializes a new instance of the VGElement class.
 /// </summary>
 /// <param name="newShapeDrawAction">Drawing action: Edge, Fill, Both</param>
 /// <param name="newBrush">Brush for text and fills</param>
 /// <param name="newStyleGroup">Group Enumeration, <see cref="VGStyleGroup"/></param>
 /// <param name="newName">Name of Element</param>
 /// <param name="newElementGroup">Element group description</param>
 public VGElement(
   ShapeDrawAction newShapeDrawAction,
   Brush newBrush,
   VGStyleGroup newStyleGroup,
   string newName,
   string newElementGroup)
 {
   this.InitStandards();
   this.styleGroup = newStyleGroup;
   this.name = newName;
   this.elementGroup = newElementGroup;
   this.shapeDrawAction = newShapeDrawAction;
   this.Brush = newBrush == null ? null : (Brush)newBrush.Clone();
 }
Пример #16
0
 /// <summary>
 /// Initializes a new instance of the VGElement class.
 /// </summary>
 /// <param name="newShapeDrawAction">Drawing action: Edge, Fill, Both</param>
 /// <param name="newBrush">Brush for text and fills</param>
 public VGElement(ShapeDrawAction newShapeDrawAction, Brush newBrush)
 {
   this.InitStandards();
   this.shapeDrawAction = newShapeDrawAction;
   this.Brush = newBrush == null ? null : (Brush)newBrush.Clone();
 }
Пример #17
0
 /// <summary>
 /// Initializes a new instance of the VGElement class.
 /// </summary>
 /// <param name="newShapeDrawAction">Drawing action: Edge, Fill, Both</param>
 /// <param name="newPen">Pen for edges</param>
 /// <param name="newBrush">Brush for text and fills</param>
 /// <param name="newFont">Font for text</param>
 /// <param name="newFontColor">Color for text</param>
 /// <param name="newBounds">Bounds of element</param>
 /// <param name="newStyleGroup">Group Enumeration, <see cref="VGStyleGroup"/></param>
 /// <param name="newName">Name of Element</param>
 /// <param name="newElementGroup">Element group description</param>
 /// <param name="newSound">The <see cref="AudioFile"/> to play with this element.</param>
 public VGElement(
   ShapeDrawAction newShapeDrawAction,
   Pen newPen,
   Brush newBrush,
   Font newFont,
   Color newFontColor,
   RectangleF newBounds,
   VGStyleGroup newStyleGroup,
   string newName,
   string newElementGroup,
   AudioFile newSound)
 {
   this.InitStandards();
   this.pen = newPen == null ? null : (Pen)newPen.Clone();
   this.Brush = newBrush == null ? null : (Brush)newBrush.Clone();
   this.Bounds = newBounds;
   this.styleGroup = newStyleGroup;
   this.name = newName;
   this.elementGroup = newElementGroup;
   this.Font = newFont == null ? null : (Font)newFont.Clone();
   this.FontColor = newFontColor;
   this.shapeDrawAction = newShapeDrawAction;
   if (newSound != null)
   {
     this.Sound = (AudioFile)newSound.Clone();
   }
 }
Пример #18
0
 /// <summary>
 /// Initializes a new instance of the VGElement class.
 /// </summary>
 /// <param name="newShapeDrawAction">Drawing action: Edge, Fill, Both</param>
 /// <param name="newPen">Pen for edges</param>
 /// <param name="newBrush">Brush for text and fills</param>
 /// <param name="newBounds">Bounds of element</param>
 /// <param name="newStyleGroup">Group Enumeration, <see cref="VGStyleGroup"/></param>
 /// <param name="newName">Name of Element</param>
 /// <param name="newElementGroup">Element group description</param>
 public VGElement(
   ShapeDrawAction newShapeDrawAction,
   Pen newPen,
   Brush newBrush,
   RectangleF newBounds,
   VGStyleGroup newStyleGroup,
   string newName,
   string newElementGroup)
 {
   this.InitStandards();
   this.pen = newPen == null ? null : (Pen)newPen.Clone();
   this.Brush = newBrush == null ? null : (Brush)newBrush.Clone();
   this.Bounds = newBounds;
   this.styleGroup = newStyleGroup;
   this.name = newName;
   this.elementGroup = newElementGroup;
   this.shapeDrawAction = newShapeDrawAction;
 }
Пример #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Fill"/> class. 
 /// Constructor that creates a <see cref="Brush"/> fill, using a user-supplied, custom
 /// <see cref="Brush"/>.  The brush will be scaled to fit the destination screen object according to the <see paramref="isScaled"/> parameter.
 /// </summary>
 /// <param name="brush">
 /// The <see cref="Brush"/> to use for fancy fills.  Typically, this would be a <see cref="LinearGradientBrush"/> or a
 /// <see cref="TextureBrush"/> class
 /// </param>
 /// <param name="isScaled">
 /// Determines if the brush will be scaled to fit the bounding box of the destination object.  true to scale it, false to leave it
 /// unscaled
 /// </param>
 public Fill(Brush brush, bool isScaled)
 {
     this.Init();
     this._isScaled = isScaled;
     this._color = Color.White;
     this._brush = (Brush)brush.Clone();
     this._type = FillType.Brush;
 }