On 8/29/14 8:30 AM, Steve Litt wrote:
On Fri, 29 Aug 2014 04:40:34 -0600
Ken Springer <snowshed1@...3003...> wrote:
> On 8/28/14 8:24 PM, Steve Litt wrote:
>> Let's say the Inkscape programmers added a conversion to jpg. That's
>> one more lump of code that could have bugs or security violations.
>> The more complex and entangled a program gets, the more bug-prone it
>> becomes.
> Since this is open-source, can't you just use code that's already
> written and bug free? Obviously, the UI part would have to be
> written for Inkscape.
No. Here's why:
Bugs increase as a result of complexity. Even if there's not one single
bug in any of the pieces, interactions between the pieces, if put
together with "fat interfaces" including GUI, can cause bugs. Plus, the
difficulty of debugging goes up geometically with the complexity of the
program.
One relatively painless way to accomplish what you're talking about
would be for Inkscape to add an export menu that's nothing but space
for user-defined (perhaps with Inkscape default) conversion commands.
So if you chose jpg on the menu, Inkscape might run the convert
executable. This is very modular, and has little likelihood of
introducing bugs. But throwing source code from the convert
executable into Inkscape would be the kiss of death.
This might be the best
solution, overall, if anyone involved with the
program was interested in doing it.
http://en.wikipedia.org/wiki/Modular_programming
http://en.wikipedia.org/wiki/Encapsulation_%28object-oriented_programming%29
Take it from a guy who wrote code professionally for 14 years: if you
don't write code modularly, with very thin interfaces between modules,
you'll shed lots of tears. I found that out the hard way, early.
By far the thinnest interface is that of one executable program using
the output of another. Each program returns all its RAM. What program A
gives program B is clearly defined, and can be tested. Debugging can be
cleanly isolated to a specific executable, and if that executable is
small, it will be a quick fix indeed.
I'm familiar with the idea of modules.
There's a high end DTP program
that dates back to the early Atari computer days that uses the concept
in both programming and marketing. Don't want the vector drawing
module? Don't buy it. I still have the latest Atari version of the
software on my Hades 060 Atari clone.
As I understand it, the program is at the Quark Express/Adobe InDesign
level.
The user needn't be responsible for stringing together the executables:
The original programmer can provide a "shellscript" to do that. The
following program, which can be run from a menu or whatever, does just
that:
===================================================
#!/bin/bash
svgname=$1
jpgname=`echo $svgname | sed -e "s/\.svg$/.jpg/"`
convert $svgname $jpgname
===================================================
If the preceding script were called svg2jpg.bat, you could convert any
SVG by right clicking on it in a file browser, choosing "open with",
and choose svg2jpg.sh.
The preceding could be used for any .svg file, not just one in Inkscape.
What would
control the resulting size of the raster graphic? That's one
feature of the export routine in Inkscape I like.
In summary, the Inkscape developers could either add and debug
hundreds
of lines of code to include jpg export, or write the previously
mentioned four line shellscript.