How to get Horizontal fit normalisation for Skia renderer?

The default Space on a Skia renderer is ‘Normalized’, which is constrained to a vertical fit.

Two questions:
-How do you achieve a horizontal fit?
I had a look at WithinSpace and the helppatches and couldn’t work it out.

-The final goal is to achieve both: In a situation where the renderer is wider than ideal aspect ratio it normalises to vertical fit. When the renderer is less wide than ideal aspect ratio it normalises to horizontal fit. Either way all the content is always visible and displayed in correct aspect ratio and the user can see a letterbox/pillarbox if they choose to resize to a different ratio than the ideal one. Any way to achieve this with WithinSpace?

1 Like

I worked out a solution for now.
Not worth making a whole nuget so here it is if anyone is searching.

It’s not completely ideal because it compensates for being in the normalized space by transforming the layer.
It’s kind of a ‘space within a space’ which is a bit of a hack on the spaces concept IMO.
It also doesn’t automatically detect if the renderer is fullscreen or wether the window has a top bar which would improve ease of use.
But it gets the job done.

To use

  • Reference the document and put the ‘BestFitNormalized’ node between your drawing layer and the renderer.
  • Ensure the renderer is in ‘normalized’ common space
  • Specify your aspect ratio and if your render window has a top bar (which it does in the default sizable mode)
  • If you have display modes to go fullscreen (or otherwise not use the top bar) then set the top bar compensation option appropriately in those modes

BestFitNormalized.vl (37.1 KB)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.