M Joonas Pihlaja <jpihl...@cc.helsinki.fi> writes:

> > 3. Automatic sampling rate: by default, when the filter is better than
> > nearest neighbor, the image's sampling rate is automatically adjusted
> > to match the transform.
> 
> Okay, this sounds like a good idea, and the results are indeed a vast 
> improvement!
> 
> > This can be turned off by explicitly setting a sampling rate using 
> > pixman_image_set_sampling_rate.
> 
> I don't think pixman needs to expose explicit controls over parameters 
> of a specific algorithm like this function does (it sets individual 
> rates for x and y.)  

For pixman, I think it's important that it is well-defined what it
does. The image pipeline that I'm always going on about:

        - extend the sample grid in all directions

        - convert to premultiplied argb

        - interpolate to define the image on a continuous domain

        - transform

        - resample

        - composite

Currently, the resample step is "point sample", which is why
downscaling looks so bad. It clearly needs to be fixed, but I really
don't want it to become "magic happens here to make it look good". It
should be such that within reason, you can predict what each pixel
will look like.

It may be that cairo should take a more magical approach though. If
so, it might make sense to have a

        pixman_image_set_transform_and_filter (image, transform)

that would set the transform and then compute good filter/sampling
settings based on that transform. 

Also consider that we'll like want to add better resampling to XRender
too. There magic seems even less desirable, so pixman would need to
expose some controls anyway.

> There are lots ways to sample and filter the 
> source, and walking across a regular sampling grid might not always be 
> the best way to go about it.

I agree that the regular super sampling is not necessarily the best
way to do it in all cases, or perhaps even most cases. For example if
people get serious about projective transforms, then adding
anisotropic filtering would make sense. Gradients would likely benefit
from adaptive sampling.

>From an API point of view, maybe a better approach would be to have 

        pixman_image_set_supersampling (image, filter, x, y),
        pixman_image_set_point_sampling (image);

or maybe

        pixman_image_set_sampling (image, algorithm, parameters...);

where algorithm would be { POINT, BOX, ... } and parameters would be
specific to the algorithm. This would leave the door open for adding
other algorithms later.

A concern is that many sampling algorithms only apply to certain types
of images. For example, area sampling a radial gradient would probably
be rather complicated.


Soren
_______________________________________________
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman

Reply via email to