ChunkInfo.cs 736 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #if MONOGAME || FNA
  2. using Microsoft.Xna.Framework;
  3. using Microsoft.Xna.Framework.Graphics;
  4. #elif STRIDE
  5. using Stride.Core.Mathematics;
  6. #else
  7. using System.Drawing;
  8. #endif
  9. namespace FontStashSharp.RichText
  10. {
  11. internal enum ChunkInfoType
  12. {
  13. Text,
  14. Space,
  15. Image
  16. }
  17. internal struct ChunkInfo
  18. {
  19. public ChunkInfoType Type;
  20. public int X;
  21. public int Y;
  22. public bool LineEnd;
  23. public int StartIndex, EndIndex;
  24. public IRenderable Renderable;
  25. public int Width
  26. {
  27. get
  28. {
  29. if (Type == ChunkInfoType.Image)
  30. {
  31. return Renderable.Size.X;
  32. }
  33. return X;
  34. }
  35. }
  36. public int Height
  37. {
  38. get
  39. {
  40. if (Type == ChunkInfoType.Image)
  41. {
  42. return Renderable.Size.Y;
  43. }
  44. return Y;
  45. }
  46. }
  47. }
  48. }