Currently trying to set the skia-renderer position and scale inside the patch.
First thing, I do not get: What is the unit of the width/height-settings rectangle? Can’t be pixel, since my screen is 4k and the renderer is bigger than 100px. One guess could be, that it’s somehoe scaled by windows-scaling settings? Or is it something else?
Second problem: Setting the rectangle to an square (fe. 100 by 100) results in an rectangle but not a perfect square. 100 by 170 gives me in my case a square. Which let me guess, it’s also relative to my resolution aspect (16:9). But why? Shouldn’t it be absolute in pixel no mater which aspect my resolution has.
Did anyone tried the same already and found a solution to set the window to an exact position and scale in pixel?
Ha, great! I see many interesting nodes in your patch. :)
I did another version without any borders and without titlebar. in this case everything works as expected without further adding of magic numbers.
Only problem left: because my scaling factor is 1.5 I end up with after-comma-rounding-issue. but tried it with 100% and this was fine. Needed to restart gamma to get the correct new scaling value after changing this in the windows-display-settings.
public static float DIPFactor()
{
if ((double) DIPHelpers.FDIPFactor == -1.0)
{
using (Graphics graphics = Graphics.FromHwnd(IntPtr.Zero))
DIPHelpers.FDIPFactor = graphics.DpiX / 96f;
}
return DIPHelpers.FDIPFactor;
}
From what I can tell it might also fail when having multiple screens with different scaling settings (and/or resolutions).
Also since some pixel values cannot be set when using fractional scaling and DIP, it would be nice to have something like SetSize(Rectangle boundsInPixel). @devvvvs
The rectangle type is the standard Stride rectangle.
The white Input pin “Bounds” for now still is the System.Drawing.Rectangle.
I also added an experimental node “RenderWindow”, that has a Stride Rectangle Bounds input pin. But probably you don’t need this as you want to set the size manually. Right?