Using ADD operator to prevent seams (was: Clarification Re: [cairo] Mac Tiger Core Image)

Carl Worth cworth at cworth.org
Sat Mar 19 08:24:54 PST 2005


On Fri, 18 Mar 2005 23:03:24 -0500, MenTaLguY wrote:
> "By 'fly there', I'm going to make the simplifying assumption that you'd
> like to see a method to go really fast from here to the intended
> location, (as opposed to a method which involves actually leaving the
> ground and travelling through the air to get there)."

Heh, OK.

But, honestly, I didn't know which problem you were interested in, and
you can't really blame me for trying the easier one first, can you? :)

And, even then, it wasn't immediately obvious to me how to solve the
simpler problem.

> I really needed some way to render the pieces as presented in the SVG
> file.

OK. So let's tackle that next.

>  1) write my own renderer using a different approach for dealing with
>     partial coverage (because the solution already involved most of the 
>     computation you'd need for rasterization anyway...)

Yeah, ignoring cairo doesn't sound like an appealing approach here.

>  2) modify an existing partial-coverage-simulating renderer (e.g. cairo)
>     so that partial coverage simulation can be turned off; antialiasing,
>     if required, can be achieved by rendering at a higher resolution
>     and filtering

If you did the antialiasing in the application, it still sounds to me
like you'd be ignoring cairo. So that doesn't sound ideal. And my gut
feeling is that the memory requirements of this approach would be
prohibitive, (at least to get to the same quality in rendering). But I
don't have solid evidence to back that feeling up.

> Modifying cairo's image backend so it can optionally draw shapes without
> trying to simulate partial coverage using the alpha channel is
> comparatively trivial, though.

David Reveman posted a patch sometime back that allows the user to
select the format of the intermediate surface used within cairo to
hold the shape. It's CAIRO_FORMAT_A8 by default and with the patch the
user can set it to CAIRO_FORMAT_A1. That covers the "disable
antialiasing" part, (and the patch is really tiny). But, as I said,
that still puts a burden on the application in order to get
high-quality results.

> Manually constructing nontrivial documents that way requires preplanning
> and a certain level of mathematical rigor that I think is unrealistic to
> expect of a graphic artist who is just incrementally experimenting to
> draw something that looks good.

Well, part of an answer might be that if the artist can see the seams
during the incremental experiments, then the artist can do whatever it
takes to get rid of them.

Though, I'm still intrigued by the problem, and I'd be interested to
come up with something better.

> Besides that, the seams are an avoidable rendering artifact, not part of
> the data.  Any decent renderer should at least provide some means to
> avoid them.  In fact, renderers used by professional design software
> generally do not use alpha-based partial coverage simulation precisely
> because of these kinds of artifacts.

Do you have a recommendation for what cairo should do instead?

> Subject to the normal code review process, would you be willing to
> accept the image backend patch if I wrote it?

I would be happy to see a patch that really solves the problem. We've
got the "disable antialiasing" thing already, and I'll probably be
convinced to commit it eventually. But, for almost every problem for
which it has been proposed, (not just the current topic), I don't see
it as providing a complete solution.

> Alternatively, how easy is it for a client application to provide its
> own cairo backend?

That can't really be done right now. We're intentionally not exposing
the backend interface yet, since it's still in so much flux. Sometime
down the road, when we feel like we know it's doing what we want, we
will feel it's stable enough to expose.

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050319/3f0c4ccf/attachment.pgp


More information about the cairo mailing list