SvgPaintServer.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using System;
  2. using System.ComponentModel;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using System.Drawing;
  6. using System.Drawing.Drawing2D;
  7. #pragma warning disable
  8. namespace Svg
  9. {
  10. /// <summary>
  11. /// Represents the base class for all paint servers that are intended to be used as a fill or stroke.
  12. /// </summary>
  13. [TypeConverter(typeof(SvgPaintServerFactory))]
  14. public abstract class SvgPaintServer : SvgElement
  15. {
  16. public Func<SvgPaintServer> GetCallback { get; set; }
  17. /// <summary>
  18. /// An unspecified <see cref="SvgPaintServer"/>.
  19. /// </summary>
  20. public static readonly SvgPaintServer None = new SvgColourServer();
  21. /// <summary>
  22. /// Initializes a new instance of the <see cref="SvgPaintServer"/> class.
  23. /// </summary>
  24. public SvgPaintServer()
  25. {
  26. }
  27. /// <summary>
  28. /// Renders the <see cref="SvgElement"/> and contents to the specified <see cref="ISvgRenderer"/> object.
  29. /// </summary>
  30. /// <param name="renderer">The <see cref="ISvgRenderer"/> object to render to.</param>
  31. protected override void Render(ISvgRenderer renderer)
  32. {
  33. // Never render paint servers or their children
  34. }
  35. /// <summary>
  36. /// Gets a <see cref="Brush"/> representing the current paint server.
  37. /// </summary>
  38. /// <param name="styleOwner">The owner <see cref="SvgVisualElement"/>.</param>
  39. /// <param name="opacity">The opacity of the brush.</param>
  40. public abstract Brush GetBrush(SvgVisualElement styleOwner, ISvgRenderer renderer, float opacity, bool forStroke = false);
  41. /// <summary>
  42. /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
  43. /// </summary>
  44. /// <returns>
  45. /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
  46. /// </returns>
  47. public override string ToString()
  48. {
  49. return String.Format("url(#{0})", this.ID);
  50. }
  51. }
  52. }
  53. #pragma warning restore