chunky
chunky copied to clipboard
Downscale JavaFX Scene Preview
This takes the JavaFX preview window and downscales the preview view to fit within the JavaFX canvas sizes, thus avoiding crashes that might otherwise happen. If using fit-to-screen, there should be little to no noticeable difference on most standard scenes. Scenes that are very tall and thin, or wide and short may be downsized somewhat.
Most of this was pulled out of #786. This will fix #314 and should fix #27.
This allows for renders of sizes larger than 4k on all computers without crashing (as opposed to crashing on different computers at different sizes above 4k). This makes the new effective largest size 26.7k square, or 18* 1920x1080 (34560 x19440) before crashing due to maxing out the SampleBuffer (This can be solved by replacing the double[] with a double[][], as done in #786)
Here is what the canvas scale dropdown looks like now when the canvas is large enough to be scaled (previously, only had the % value on the right):

An addition to this could be to crop the displayed area (at full resolution) instead of downscaling (but keeping the whole image). Will look into this.
Most of this is from commit 33152565 in #786 (minor changes have been added since).
tbh I don't get what the new context menu options do. Also the preview is terribly slow for high resolutions. Maybe we could always render the preview at the preview size and only render the real image at full resolution? :thinking:
tbh I don't get what the new context menu options do. Also the preview is terribly slow for high resolutions. Maybe we could always render the preview at the preview size and only render the real image at full resolution? 🤔
render at preview size would be... more difficult. I can look into changing it to that later.
The menu with the size percents is telling you what its displaying it as is effectively 400% if it were the full image, but since it was downscaled its only zooming 200% on the downscaled image, as an example. I wanted to convey both values, because otherwise when you set the zoom, it may appear blurry or pixelated at a low zoom, and you might get confused about canvas size vs preview size (like I did at one point). idk how to otherwise convey both values.
(If you are below the size where it scales the preview though, it will just have the standard %s and not mention downscaling.)

12800x12800 ~22,650.7MB
Well.. I can't really test the upper bounds of this fix due to how much memory it is using so far but it doesn't crash.... available options are a bit complex.
Any ideas on how to make the options better?
As lemaik has pointed out the scaling options are confusing..

Surely instead of downscaling it should read upscaled/zoomed if above 100%? Would be a bit less confusing.
As lemaik has pointed out the scaling options are confusing.. [image]
Surely instead of downscaling it should read
upscaled/zoomedif above 100%? Would be a bit less confusing.
hmmm yeah that wording is a bit strange. It should be describing that the preview is zoomed to 400%, but due to downscaling, that 400% is down scaled 100% (or same zoom level as the output file will be), but since its zoom is 400% in javafx, its only displaying 1/16th of the pixels.
Does that make sense? I didnt really know how else to describe it in a couple words...