← Back to team overview

kicad-developers team mailing list archive

Re: application for svg to png

 

converting the png to cpp files can be done the same how it is now
(using cmake), although it would really only be used on linux i would
also look at making it so that they all went into a single cpp file
rather than the numerous files it currently is.

On windows the files would end up as part of the "resource file" which
(not being up to date on windows) is either built into the app in the
resource part of the binary or there is a file but it still only looks
for it in once place

On OSX it looks in the resources folder of the application bundle

so there aren't the issues of it possibly being in many place which
exist with .so files at least and i think the same with dll files, but
on linux seeing as wxwidgets doesn't seem to like any of the icon
options they would just be built in as they currently are as xpm. If
you don't have the icon files on macOS (which is the only one that
stores them as physical files i believe) then it would be your fault
as you obviously must have deleted them from the bundle as they would
be part of the build process. Every other osx application has the
icons as resources in the resource folder or in one of the
language-dependent subfolders

http://docs.wxwidgets.org/trunk/group__group__funcmacro__gdi.html#ga30fc362d22b3045f58aed54fc808f203
as can be seen here the wxBITMAP_PNG macro automatically sorts out the
different places they can be found on each platform.

rsvg is one option for doing the svg->png conversion (its also fast on
OSX) not sure about other platforms but it is available for
linux/windows/macOS so theres no platform issues, however this could
equally be replaced with imagemagick instead which can use inkscape as
the backend if you have it installed but can also use rsvg as well (or
other options as well including an internal one) but this would not
give the same png/ascii file on all platforms obviously.

there is also the option of commiting the png files in place of the
icon cpp files that are currently committed and then on linux its just
a case of creating the cpp files from the png which shouldn't take too
long as its effectively just catting files. this would avoid the issue
of needing the same png created from the same svg on all platforms, if
we did want to use imagemagick




On 31 August 2017 at 07:21, jp charras <jp.charras@xxxxxxxxxx> wrote:
> Le 30/08/2017 à 20:54, Simon Wells a écrit :
>> my goal is more to move to using the wxBITMAP_PNG macro which would
>> use real files on osx and some weird resource hybrid on windows and
>> xpms on the other platforms that don't have a decent option. hence i
>> need to convert all the files into png
>>
>
> Perhaps you should explain *exactly* what you want to do.
>
> Before using svg files as sources, icons were stored in .xpm files, often created from a .png icon.
> Only ascii files can be included in .cpp or .h sources.
>
> This was really a pain to maintain icons, and I do do want back to .png files as sources.
> (note of course this is the .png files converted to an equivalent binary tab coded in .cpp file that
> are included in kicad sources, so Kicad uses currently .png icons internally, so I do not really
> understand the meaning of "using the wxBITMAP_PNG macro")
>
> Moreover I am not convinced using real files to store .png icons is a good idea.
> (what happens if these files are for some reason not found?
> We have already issues with .so or .dll or script files not found on all platforms)
>
> So my requirements are:
>
> - source icons must be .svg files.
> - avoid exotic tools to convert .svg files to ascii files. It must be easily available (and run
> without crash) on 3 platforms.
> - png files can be only intermediate files created by the build process (like any object file)
> - ideally, the same .svg file should give the same ascii file on all platforms.
>
>
>
> --
> Jean-Pierre CHARRAS
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp


Follow ups

References