SvgPaintServer.cs 2 KB
Newer Older
davescriven's avatar
davescriven committed
1
2
3
4
5
6
7
8
9
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;

namespace Svg
{
10
11
12
    /// <summary>
    /// Represents the base class for all paint servers that are intended to be used as a fill or stroke.
    /// </summary>
davescriven's avatar
davescriven committed
13
14
15
    [TypeConverter(typeof(SvgPaintServerFactory))]
    public abstract class SvgPaintServer : SvgElement
    {
16
17
18
        /// <summary>
        /// An unspecified <see cref="SvgPaintServer"/>.
        /// </summary>
19
        public static readonly SvgPaintServer None = new SvgColourServer();
davescriven's avatar
davescriven committed
20

21
22
23
        /// <summary>
        /// Initializes a new instance of the <see cref="SvgPaintServer"/> class.
        /// </summary>
davescriven's avatar
davescriven committed
24
25
26
27
        public SvgPaintServer()
        {
        }

28
        /// <summary>
Eric Domke's avatar
Eric Domke committed
29
        /// Renders the <see cref="SvgElement"/> and contents to the specified <see cref="ISvgRenderer"/> object.
30
        /// </summary>
Eric Domke's avatar
Eric Domke committed
31
32
        /// <param name="renderer">The <see cref="ISvgRenderer"/> object to render to.</param>
        protected override void Render(ISvgRenderer renderer)
davescriven's avatar
davescriven committed
33
34
35
36
        {
            // Never render paint servers or their children
        }

37
38
39
40
41
        /// <summary>
        /// Gets a <see cref="Brush"/> representing the current paint server.
        /// </summary>
        /// <param name="styleOwner">The owner <see cref="SvgVisualElement"/>.</param>
        /// <param name="opacity">The opacity of the brush.</param>
Eric Domke's avatar
Eric Domke committed
42
        public abstract Brush GetBrush(SvgVisualElement styleOwner, ISvgRenderer renderer, float opacity);
davescriven's avatar
davescriven committed
43

44
45
46
47
48
49
        /// <summary>
        /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </returns>
davescriven's avatar
davescriven committed
50
51
52
53
        public override string ToString()
        {
            return String.Format("url(#{0})", this.ID);
        }
54
55
56



davescriven's avatar
davescriven committed
57
58
    }
}