NullRenderingPlatform.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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 bool IsLost => false;
  43. public object TryGetFeature(Type featureType) => null;
  44. public IRenderTargetBitmapImpl CreateRenderTargetBitmap(PixelSize size, Vector dpi)
  45. {
  46. throw new NotImplementedException();
  47. }
  48. public IWriteableBitmapImpl CreateWriteableBitmap(PixelSize size, Vector dpi, PixelFormat format, AlphaFormat alphaFormat)
  49. {
  50. throw new NotImplementedException();
  51. }
  52. public IBitmapImpl LoadBitmap(string fileName)
  53. {
  54. throw new NotImplementedException();
  55. }
  56. public IBitmapImpl LoadBitmap(Stream stream)
  57. {
  58. throw new NotImplementedException();
  59. }
  60. public IWriteableBitmapImpl LoadWriteableBitmapToWidth(Stream stream, int width,
  61. BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
  62. {
  63. throw new NotImplementedException();
  64. }
  65. public IWriteableBitmapImpl LoadWriteableBitmapToHeight(Stream stream, int height,
  66. BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
  67. {
  68. throw new NotImplementedException();
  69. }
  70. public IWriteableBitmapImpl LoadWriteableBitmap(string fileName)
  71. {
  72. throw new NotImplementedException();
  73. }
  74. public IWriteableBitmapImpl LoadWriteableBitmap(Stream stream)
  75. {
  76. throw new NotImplementedException();
  77. }
  78. public IBitmapImpl LoadBitmap(PixelFormat format, AlphaFormat alphaFormat, IntPtr data, PixelSize size, Vector dpi, int stride)
  79. {
  80. throw new NotImplementedException();
  81. }
  82. public IBitmapImpl LoadBitmapToWidth(Stream stream, int width, BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
  83. {
  84. throw new NotImplementedException();
  85. }
  86. public IBitmapImpl LoadBitmapToHeight(Stream stream, int height, BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
  87. {
  88. throw new NotImplementedException();
  89. }
  90. public IBitmapImpl ResizeBitmap(IBitmapImpl bitmapImpl, PixelSize destinationSize, BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
  91. {
  92. throw new NotImplementedException();
  93. }
  94. public IFontManagerImpl CreateFontManager()
  95. {
  96. return new MockFontManagerImpl();
  97. }
  98. public IGeometryImpl BuildGlyphRunGeometry(GlyphRun glyphRun)
  99. {
  100. return new MockStreamGeometryImpl();
  101. }
  102. public IGlyphRunImpl CreateGlyphRun(IGlyphTypeface glyphTypeface, double fontRenderingEmSize,
  103. IReadOnlyList<GlyphInfo> glyphInfos, Point baselineOrigin)
  104. {
  105. return new MockGlyphRun(glyphInfos);
  106. }
  107. public IPlatformRenderInterfaceContext CreateBackendContext(IPlatformGraphicsContext graphicsContext)
  108. {
  109. return this;
  110. }
  111. public bool SupportsIndividualRoundRects => true;
  112. public AlphaFormat DefaultAlphaFormat => AlphaFormat.Premul;
  113. public PixelFormat DefaultPixelFormat => PixelFormat.Rgba8888;
  114. public void Dispose()
  115. {
  116. }
  117. }
  118. }