ImageChunk.cs 698 B

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. #if MONOGAME || FNA
  3. using Microsoft.Xna.Framework;
  4. #elif STRIDE
  5. using Stride.Core.Mathematics;
  6. #else
  7. using System.Drawing;
  8. using System.Numerics;
  9. using Color = Veldrid.RgbaFloat;
  10. #endif
  11. namespace FontStashSharp.RichText
  12. {
  13. public class ImageChunk : BaseChunk
  14. {
  15. private readonly IRenderable _renderable;
  16. public override Point Size => _renderable.Size;
  17. public ImageChunk(IRenderable renderable)
  18. {
  19. if (renderable == null)
  20. {
  21. throw new ArgumentNullException(nameof(renderable));
  22. }
  23. _renderable = renderable;
  24. }
  25. public override void Draw(FSRenderContext context, Vector2 position, Color color)
  26. {
  27. _renderable.Draw(context, position, color);
  28. }
  29. }
  30. }