NullRenderingPlatform.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using Avalonia.Media;
  5. using Avalonia.Platform;
  6. using Avalonia.UnitTests;
  7. using Avalonia.Media.Imaging;
  8. using Avalonia.Media.TextFormatting;
  9. using Microsoft.Diagnostics.Runtime;
  10. namespace Avalonia.Benchmarks
  11. {
  12. internal class NullRenderingPlatform : IPlatformRenderInterface, IPlatformRenderInterfaceContext
  13. {
  14. public IGeometryImpl CreateEllipseGeometry(Rect rect)
  15. {
  16. return new MockStreamGeometryImpl();
  17. }
  18. public IGeometryImpl CreateLineGeometry(Point p1, Point p2)
  19. {
  20. return new MockStreamGeometryImpl();
  21. }
  22. public IGeometryImpl CreateRectangleGeometry(Rect rect)
  23. {
  24. return new MockStreamGeometryImpl();
  25. }
  26. public IStreamGeometryImpl CreateStreamGeometry()
  27. {
  28. return new MockStreamGeometryImpl();
  29. }
  30. public IGeometryImpl CreateGeometryGroup(FillRule fillRule, IReadOnlyList<Geometry> children)
  31. {
  32. throw new NotImplementedException();
  33. }
  34. public IGeometryImpl CreateCombinedGeometry(GeometryCombineMode combineMode, Geometry g1, Geometry g2)
  35. {
  36. throw new NotImplementedException();
  37. }
  38. public IRenderTarget CreateRenderTarget(IEnumerable<object> surfaces)
  39. {
  40. throw new NotImplementedException();
  41. }
  42. public object TryGetFeature(Type featureType) => null;
  43. public IRenderTargetBitmapImpl CreateRenderTargetBitmap(PixelSize size, Vector dpi)
  44. {
  45. throw new NotImplementedException();
  46. }
  47. public IWriteableBitmapImpl CreateWriteableBitmap(PixelSize size, Vector dpi, PixelFormat format, AlphaFormat alphaFormat)
  48. {
  49. throw new NotImplementedException();
  50. }
  51. public IBitmapImpl LoadBitmap(string fileName)
  52. {
  53. throw new NotImplementedException();
  54. }
  55. public IBitmapImpl LoadBitmap(Stream stream)
  56. {
  57. throw new NotImplementedException();
  58. }
  59. public IWriteableBitmapImpl LoadWriteableBitmapToWidth(Stream stream, int width,
  60. BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
  61. {
  62. throw new NotImplementedException();
  63. }
  64. public IWriteableBitmapImpl LoadWriteableBitmapToHeight(Stream stream, int height,
  65. BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
  66. {
  67. throw new NotImplementedException();
  68. }
  69. public IWriteableBitmapImpl LoadWriteableBitmap(string fileName)
  70. {
  71. throw new NotImplementedException();
  72. }
  73. public IWriteableBitmapImpl LoadWriteableBitmap(Stream stream)
  74. {
  75. throw new NotImplementedException();
  76. }
  77. public IBitmapImpl LoadBitmap(PixelFormat format, AlphaFormat alphaFormat, IntPtr data, PixelSize size, Vector dpi, int stride)
  78. {
  79. throw new NotImplementedException();
  80. }
  81. public IBitmapImpl LoadBitmapToWidth(Stream stream, int width, BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
  82. {
  83. throw new NotImplementedException();
  84. }
  85. public IBitmapImpl LoadBitmapToHeight(Stream stream, int height, BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
  86. {
  87. throw new NotImplementedException();
  88. }
  89. public IBitmapImpl ResizeBitmap(IBitmapImpl bitmapImpl, PixelSize destinationSize, BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
  90. {
  91. throw new NotImplementedException();
  92. }
  93. public IFontManagerImpl CreateFontManager()
  94. {
  95. return new MockFontManagerImpl();
  96. }
  97. public IGeometryImpl BuildGlyphRunGeometry(GlyphRun glyphRun)
  98. {
  99. return new MockStreamGeometryImpl();
  100. }
  101. public IGlyphRunImpl CreateGlyphRun(IGlyphTypeface glyphTypeface, double fontRenderingEmSize, IReadOnlyList<GlyphInfo> glyphInfos)
  102. {
  103. return new MockGlyphRun();
  104. }
  105. public IPlatformRenderInterfaceContext CreateBackendContext(IPlatformGraphicsContext graphicsContext)
  106. {
  107. return this;
  108. }
  109. public bool SupportsIndividualRoundRects => true;
  110. public AlphaFormat DefaultAlphaFormat => AlphaFormat.Premul;
  111. public PixelFormat DefaultPixelFormat => PixelFormat.Rgba8888;
  112. public void Dispose()
  113. {
  114. }
  115. }
  116. }