Are all WPF render conversions double precision?

WPF stores all of its data in double precision. I just want to confirm that all conversions, etc. They are performed with double precision.

I am working on a WPF canvas that is very large (40,000,000 x 40,000,000), translating and scaling to make it larger - overlaying tiles containing satellite imagery. To scale and translate, I am using a TransformGroup containing a ScaleTransform and a TranslateTransform.

When the image gets close, the tiles seem to wobble as you slightly adjust the scaletransform shape, as if their position on the canvas has changed slightly, even though all I'm changing is the scaletransform shape. I am concerned that conversions are not done in double precision, but sent to hardware and done in single precision.

Is there a way to control the rendering accuracy? Or at least to confirm that it is using double precision and not single precision?

Thank.

+1


source to share


1 answer


a while ago I noticed the same thing: rendering bitmaps would be severely distorted when using extreme transforms. Some of the tests I did then convinced me that WPF actually translates the conversions to the GPU, which then uses single precision processing instead of double precision.

The only workaround I've found is to simplify the transformations. For example, instead of providing an image with a size of 100,000 by 100,000 units and a scale factor of 0.0001, give it a size of 1 unit and a scale factor of 10. The same applies to the translation.



Depending on your design, this could mean that your layout logic becomes much more complex as you have to do some manual calculations that WPF would otherwise do for you. For an application that allows a large range of zoom levels (e.g. from the point of view of the entire ground to one building), it looks like there is no other way.

+3


source







All Articles