[cairo] Pixels Are Not Little Squares

Bill Spitzak spitzak at gmail.com
Wed Jun 22 16:04:06 UTC 2016


No matter what shape you think a pixel is, as long as it is symmetric, 
there is a location on the screen that is the center. This location is 
at X+.5 and Y+.5 where X and Y are integers.

If you divide the plane up into domains defined by "which pixel center 
is closest" then you will get little squares, and the borders between 
them land on the integer coordinates.

Therefore there are "little squares" defined by the pixels, no matter 
what sampling method you are using.

Sampling that consists of integrating the image over this "little 
square" is not really very bad. It is just slow (except for some 
degenerate cases of images consisting of rectangles parallel with the 
axis). It is more accurate than quite a few methods Cairo is using, and 
useful as a goal to approximate when designing other methods.

I see absolutely nothing wrong with describing pixels as "little squares".

On 04/24/2016 06:07 PM, Krzysztof Kosiński wrote:
> As far as I know, Cairo does use an approximation of the box filter
> when sampling polygons, or at least does so by default. If it used
> point (impulse) samples, you would get jagged edges. Thus, for
> rendering polygons or lines (which is what is being done here), the
> "little square" model is reasonable.
>
> The "little square" model is not a good general description of how
> image processing works, but it is reasonably good lie-to-children when
> discussing box-filtered sampling.
> https://en.wikipedia.org/wiki/Lie-to-children
>
> 2016-04-22 14:37 GMT-07:00 Lawrence D'Oliveiro <ldo at geek-central.gen.nz>:
>> On Fri, 22 Apr 2016 13:22:19 -0700, Krzysztof Kosiński wrote:
>>
>>> The little square model is OK for Cairo, since it uses a box filter
>>> for sampling tje omage when rendering. This is necessary for
>>> antialiasing.
>>
>> No it doesn’t, and no it isn’t. You’re probably thinking of image
>> resampling, and Cairo offers a choice of filters for that
>> <http://cairographics.org/manual/cairo-cairo-pattern-t.html#cairo-filter-t>.
>> And the underlying Pixman layer offers even more.
>> --
>> cairo mailing list
>> cairo at cairographics.org
>> https://lists.cairographics.org/mailman/listinfo/cairo



More information about the cairo mailing list