:: Re: [DNG] filosofies behind program…
Góra strony
Delete this message
Reply to this message
Autor: Didier Kryn
Data:  
Dla: dng
Temat: Re: [DNG] filosofies behind programming languages
Le 05/11/2024 à 04:44, Steve Litt a écrit :
> Didier Kryn said on Mon, 4 Nov 2024 12:02:48 +0100
>
>
>>     About such corruptions, you can look at the SVG code produced by
>> design tools, even by Inkscape. I use to write SVG with Emacs.
>> Sometimes Inkscape is more productive, but I then clean up the result,
>> which makes it readable and typically divides the size by 2.
> Is your problem with Inkscape produced SVG all the translations it
> leaves intact rather than just placing and sizing things at production
> time? These translations are why I no longer put Inkscape SVGs on web
> pages, but instead convert them to .png first. I've made complicated
> SVGs that slowed the browser to a crawl because the browser had to do
> all the translations at load time.
>

    One of the issues with Inkscape is that it is superior with what
SVG can do. Consider a path. In SVG, it is a sequence of segments, arcs
and Bezier curves. A cursive line produced with a design tool is mostly
done of consecutive cubic Bézier curves, each being defined by its 2
attraction points and its end, the beginning being the current point. In
SVG, only the Bézier curves have properties; in Inkscape, the points
between them also have properties: they can be sharp or not, and also
they can force equal curvature on both sides. These properties of points
are pretty convenient for drawing. SVG allows the insertion of private
meta data, which permits Inkscape to store these data within the SVG
file instead of using a private file format, and this does not prevent
the image to be drawn or processed by another tool, but it is only
usefull if you want to reprocess the file with Inkscape. Once you have
finished, better store the file in raw SVG format (not Inkscape SVG),
and clean it up.

    Besides that, Inkscape gives meaningless names to all objects, even
when a name isn't necessary, and does not provide a way to name them
yourself. It uses a deprecated way to specify most of the properties of
the objects: instead of writing <rect x="0", y="5", width="25"
height="10" stroke="blue"/>, it replaces stroke="blue" with
style="stroke: blue; opacity: 1". The inline style fashion is deprecated
in SVG and uses more characters, and specifying an opacity of 1 is
useless since it is the default. This, together with all the private
metadata and the resources to process them is taking a lot of bytes.

    It is true also that, if you rework a lot your images with
Inkscape, you accumulate transformations. Transformations are sometimes
usefull, when they allow you to create an object with no or few decimal
numbers in the coordinates and then adjust the object accurately to a
size and position which need more precision: this may reduce the total
number of characters. To avoid piling up transformations in Inkscape,
you should not adjust and readjust the objects too many times.

    I don't know if png can store vector graphic or if it is a pixel
format.

--     Didier