[cairo] [ft-devel] one question answered, and another comes (Re: FT_Bitmap_Convert, and FreeType's bitmap format vs Cairo's)

Hin-Tak Leung htl10 at users.sourceforge.net
Tue Apr 25 16:23:17 UTC 2017


--------------------------------------------
On Tue, 25/4/17, Alexei Podtelezhnikov <apodtele at gmail.com> wrote:

...
> > How does one check if
 two shapes overlap, or two paths intersect, in
 cairo?
 
> Check if you
 have pixels with coverage more than 1. If coverage is
 capped at 1, render the components individually
 and see if the total
 coverage of individual
 components exceeds the coverage of the
 combo.

Thanks. I'll have a thought about it some more.

To put things in context, here is what I have now, with freetype-py +pycairo:

https://github.com/rougier/freetype-py/issues/45#issuecomment-297070166

I only managed to get the individial rectangle enclosing each 'Hello' not to overlap.

The original example is very slow and loop overs the pixels as a numerical array in various places.
However, it actually does the dot-product of currently-trying-to-ink part with the already-inked part,
so it can pack the 'Hello' a lot tighter, as it allows the containing ranctangle to overlap as long as the glyphs
themselves do not.

Certainly it is possible to dig in the pixels in C and sum them - the objective of the exercise is really rather how far using just scripting language without compiling C code can go :- ). (doing vector sums and loop over pixels in a scripting language is slow...)


More information about the cairo mailing list