since the Xojo framework is obsolete, I just created the <https://xojo.com/issue/54948> concerning the conversion of the integer properties of REALbasic.Point/Rect/Size to Double. Since I use these classes again and again in connection with Graphics drawing routines and all coordinate and size properties are available in Double, this would be a very, very good addition.
I would be happy if some of the users here could add the feedback case to their favorites and give it a few points so that the Xojo developers can do this as soon as possible.
Sure, that’s a workaround. I am interested in the consistent, complete modernization of the Xojo framework. From my point of view the update is only the logical consequence of the Graphics adaptations last year.
Double-precision drawing is a double-edged sword, becasuse you cannot draw with subpixel accuracy. At the end of the day, a pixel is a pixel. So heres a real world example of the problem.
Say youre centering a drawing: Left = (Parent.Width - Child.Width) / 2. 50% of the time, the result will end a half coordinate. With integer-precision drawing, the decimal place would be dropped, so youre still only drawing at whole pixels.
As a result, without even changing your code, the drawing will look blurry half the time just by updating your version of Xojo. The renderer will draw that 1px black line as a 2px black line at 50% opacity, since its trying to give you what you asked for.
So you still should not draw with greater accuracy than the screen can provide. This is why when designing HiDPI graphics, you always start with a vector at 1x and increase resolution to create 2x and 3x versions.
In my code, I ended up creating a function to round the coordinates to the nearest multiple that can be accurately drawn at the current scale factor. So on 1x, its always a multiple of 1, 2x of 0.5, and 3x of 0.33.
In my opinion, double-precision drawing is a fancy way to make drawing more difficult for very little tangible payoff. If youre already doing everything with integer, keep doing it.
[quote=425098:@Jean-Yves Pochez]what bothers me more is the “REALBasic” just before … it’s 10+ years obsolete …
why not a Xojo.rect, or event a simple Rect type ?[/quote]
Because changing it may break peoples code. For example. If you have code like this in a method:
dim rect as String
You can no longer do this:
dim r as Rect
Youve got to do this:
dim r as Realbasic.Rect
…and before you say that users shouldnt do that… code that was written before Rect was implemented in the framework was perfectly legitimate.
I support this. This shouldn’t break legacy code. Since the macOS is all about float when it comes to drawing, you would want to have the same precision when defining a rectangle. The under-the-hood casting of a float to integer by Xojo removes the benefits of the operating system, which would take care of how to map it to the appropriate pixel. Xojo should follow suit. Staying with integers based on the notion that it might otherwise break code is a win32 argument running on a 64-bit machine. It’s gonna hurt sooner or later.