freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft-devel] SVG Rendering Library


From: Moazin Khatri
Subject: Re: [ft-devel] SVG Rendering Library
Date: Sat, 15 Jun 2019 12:18:16 +0500

Hi Toshiya,

I wanted to add a thought here. 

For this email I am going to refer to "all of the code that the svg rendering callback hooks point to" as the `rendering port'.

I think we can off-load all of the rendering and the `bitmap_left' and `bitmap_top' extraction part to the rendering port. Two libraries so far provide a `get_bbox' feature. SVG Native can provide one very soon too. Of course, none of these take into account clipping. But note that "not accounting clipping" only leads to a bigger bounding box than the actual one AFAIK. A very simple and relatively efficient check can be done to confirm whether the box is "tight" or not. Something like the following:

Imagine we just rendered a 1000 by 1000 pixel image that we think is "tight" but we aren't sure, since we don't know whether there was clipping or not. We can simply iterate the boundary of this bitmap and if at least one pixel is `inked' we can be sure that the box is tight. Thus, we can straightaway calculate `bitmap_left' and `bitmap_top' and be sure that they are the right values. If that's not the case, we can then run a algorithm to get a tighter bounding box.

Let me know what you think and please point out if I have made logical mistakes here.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]