2 ms·
If you're describing an image format where all subobjects are bitmaps and not vectors, and all math is done with integers, then pixel perfection is possible. O
by nayuki 4y ago
If you're describing an image format where all subobjects are bitmaps and not vectors, and all math is done with integers, then pixel perfection is possible.
Once you introduce any mildly interesting vector or typesetting feature, you will not get pixel perfection. Examples:
* You want to draw a circle. Antialiasing is desirable because jaggies look really ugly. Do you want to prescribe the exact antialiasing algorithm? What about other ones that are faster or more accurate? Which AA convolution kernel are you using - box, Gaussian, sinc?
* Which approximation algorithm will you use to draw cubic Bézier curves? I don't think there is a closed-form solution for them.
* You support affine transformations. Define a 10×10 square. Scale it by 1/100. Scale it by 100. What if, due to floating-point rounding errors, your square is now 9.999×9.999 and now renders to 9×9 pixels without antialiasing?
* You support automatic text wrapping. One renderer uses float32, looks at how wide each word is, and decides to break at some point in the sentence. Another renderer uses float64, looks at how wide each word is, and decides to break at a different point in the sentence.