[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft-devel] one question answered, and another comes (Re: FT_Bitmap_C
From: |
Hin-Tak Leung |
Subject: |
Re: [ft-devel] one question answered, and another comes (Re: FT_Bitmap_Convert, and FreeType's bitmap format vs Cairo's) |
Date: |
Tue, 25 Apr 2017 16:23:17 +0000 (UTC) |
--------------------------------------------
On Tue, 25/4/17, Alexei Podtelezhnikov <address@hidden> 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...)