Vixen
dd8b0a81
csharp
public readonly record struct UiImageView

How an image draw shows the numbers it samples: which channels, through which curve.

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

Remarks

What this is for: #611. ImageView shipped a channel picker and a colour-space toggle that changed nothing about the picture, because the image command carried a tint and a source rectangle and nothing else — and a tint multiplies, where isolating the alpha as a grey is a swizzle and undoing a transfer function is a curve. This is the field that was missing.

⚠ The default is the identity, unlike DrawCommand.Filter's. A zeroed UiColorMatrix maps every colour to black, which is why that field is nullable; a zeroed one of these is All with no curve, which is precisely what every image drawn before #611 asked for. So this rides DrawCommand as a plain value and a caller that has never heard of it is already correct.

⚠ ShowStoredValues is named for what it does rather than for a colour space, and the rename is the point. The control one assembly up calls the two choices sRGB and linear, which describes what is *in* the texture; a draw command cannot know that — the same texture is a colour to one viewer and a roughness field to the next. What it can say is where the numbers should land: UiWindowSurface presents to a Bgra8UNormSrgb target, so the hardware encodes on write and a stored 0.5 reaches the glass as 188/255. Setting this decodes first, the two cancel, and 0.5 shows as 128/255 — the number the author typed.

Carried per vertex, on three components of shape that this pipeline never read. That is what keeps two images asking for different channels in one batch: a per-draw uniform would have split the batch, and a new vertex attribute would have moved the stride, UiVertex.vert.spv, the hand-written GLSL twin and every other pipeline with it. See Shape.

Fields and properties (3)

  • public UiImageChannel Channel

    Which channel, or All for the colour.

  • public bool ShowStoredValues

    Whether the stored numbers reach the screen unchanged rather than as colour.

  • public bool IsIdentity

    Whether this asks for anything at all — the colour, unaltered.

Methods (2)

  • public UiImageView(UiImageChannel Channel, bool ShowStoredValues)

    How an image draw shows the numbers it samples: which channels, through which curve.

  • public Vector4 Shape(float premultiplied = 0)

    This request as the y and z of the shape stream, with x given.

Used by (9)

  • DrawCommandVixen.Ui
  • DrawContextVixen.Ui
  • ImageViewVixen.Ui.Controls.Advanced
  • ImageViewBarTestsVixen.Ui.Controls.Advanced.Tests
  • ImageViewTestsVixen.Ui.Controls.Advanced.Tests
  • UiGeometryBuilderVixen.Ui
  • UiImageViewTestsVixen.Graphics.Golden.Tests
  • UiRavenAgreementTestsVixen.Graphics.Golden.Tests
  • ImageViewBarWiringTestsVixen.Editor.Texturing.Tests