Vixen
02b45cc4
csharp
public readonly record struct VideoPlacement

Where a picture lands and which part of it is shown.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

⚠ Two answers rather than one, because the two scalings need different halves. Contain shrinks the rectangle and leaves the texture coordinates alone; Cover keeps the rectangle and crops the coordinates. A helper that returned only a rectangle could not express the second, and one that returned only coordinates would have to paint the letterbox bars itself — which is wrong the moment the video is drawn over something, because those bars are opaque black over whatever was behind.

Fields and properties (3)

  • public Rectangle Target

    The rectangle to draw, in the caller's own units.

  • public Vector2 TextureScale

    What to multiply a 0–1 texture coordinate by.

  • public Vector2 TextureOffset

    What to add to it afterwards.

Methods (2)

  • public VideoPlacement(Rectangle Target, Vector2 TextureScale, Vector2 TextureOffset)

    Where a picture lands and which part of it is shown.

  • public static VideoPlacement Filling(Rectangle target)

    The whole of a rectangle, with the whole of the picture.

Used by (4)

  • VideoDrawVixen.Video.Rendering
  • VideoFitVixen.Video
  • VideoFitTestsVixen.Video.Tests
  • VideoSurfaceUploaderVixen.Video.Rendering