Cruisers Forum
 


Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 01-06-2016, 11:58   #1
Registered User

Join Date: Aug 2009
Location: oriental
Boat: crowther trimaran 33
Posts: 4,414
svg icons

I am trying to create a style for opencpn using only svg graphics. The problem is, the svg graphics created with gimp or other programs don't display. The smaller svg files don't seem to work, but the huge ones (which would be smaller in png) are working.

Is there some problem with wxsvg?
seandepagnier is offline   Reply With Quote
Old 01-06-2016, 12:14   #2
bcn
Registered User

Join Date: May 2011
Location: underway whenever possible
Boat: Rangeboat 39
Posts: 4,706
Re: svg icons

Have you created svg icons with Inkscape - taking it as a reference?
What is "small" for you? The same icon just with different sizes, so same description, just different scale(d) x/y points?
bcn is offline   Reply With Quote
Old 01-06-2016, 19:21   #3
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,536
Images: 2
Re: svg icons

Yes inkscape is better. Gilletarom used to convert many opencpn icons for bdbcat and pavel, i believe.
rgleason is online now   Reply With Quote
Old 01-06-2016, 22:11   #4
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,198
Re: svg icons

Sean...
Forget gimp and send me some of your "huge" svgs. I will tell you what to do with it.

Pavel


Sent from my iPhone using Cruisers Sailing Forum
nohal is online now   Reply With Quote
Old 02-06-2016, 04:59   #5
Registered User

Join Date: Aug 2009
Location: oriental
Boat: crowther trimaran 33
Posts: 4,414
Re: svg icons

here is an example
Attached Files
File Type: doc GRIB-gimp.svg.doc (5.5 KB, 23 views)
File Type: doc GRIB-inkscape.svg.doc (6.7 KB, 24 views)
seandepagnier is offline   Reply With Quote
Old 02-06-2016, 05:32   #6
bcn
Registered User

Join Date: May 2011
Location: underway whenever possible
Boat: Rangeboat 39
Posts: 4,706
Re: svg icons

Sean,

what I see in your two files is a Raster image embedded in svg.
Does that make sense?

What one would expect is a vector drawing which you can export then as a rasterized icon - Inkscape does that perfectly. However the nice thing for different screen sizes and resolutions is to work with vector as it is scalable. An embedded raster will not scale (or better, will getting blurred).

As an example the master as svg vector from Inkscape, a screenshot and then two exports with 99x70 and 48x30px

Or do we get you wrong?

Hubert
Attached Thumbnails
Click image for larger version

Name:	2016-06-02 14_21_53-Pilotfish.svg - Inkscape.png
Views:	172
Size:	71.2 KB
ID:	125363  
Attached Images
  
Attached Files
File Type: doc Pilotfish.svg.doc (11.3 KB, 50 views)
bcn is offline   Reply With Quote
Old 02-06-2016, 07:58   #7
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,198
Re: svg icons

Sean...
Hubert is of course correct - creating SVG files containing just a bitmap makes absolutely no sense. We are definitely not using SVG to decrease size here, but to improve quality at high resolution without having to have several bitmap files.
Once the SVG file is vector, there are a few tricks to make it smaller, as tools like Inkscape or Illustrator tend to fill it with useless junk.

Pavel
nohal is online now   Reply With Quote
Old 02-06-2016, 08:04   #8
bcn
Registered User

Join Date: May 2011
Location: underway whenever possible
Boat: Rangeboat 39
Posts: 4,706
Re: svg icons

Quote:
Originally Posted by nohal View Post
Once the SVG file is vector, there are a few tricks to make it smaller, as tools like Inkscape or Illustrator tend to fill it with useless junk.

Pavel
Yes, especially the headers contain al lot of "backward compatibility".
And by the way: all modern browser do open svg files directly.
A quick way to test how they look and feel when designing.
bcn is offline   Reply With Quote
Old 02-06-2016, 11:49   #9
Registered User

Join Date: Aug 2009
Location: oriental
Boat: crowther trimaran 33
Posts: 4,414
Red face Re: svg icons

Quote:
Originally Posted by bcn View Post
Sean,

what I see in your two files is a Raster image embedded in svg.
Does that make sense?
Why can inkscape not vectorize my bitmap drawing? Why doesn't wxsvg support embedded raster images?

Quote:
Originally Posted by nohal View Post
Sean...
Hubert is of course correct - creating SVG files containing just a bitmap makes absolutely no sense.
I agree in theory, but I want all my icons all in separate files, and somehow opencpn first searches for an svg file with the same name, then it will look in a single png file which I don't want to deal with. If I could have separate png files it would be ok...
Code:
+#ifdef ocpnUSE_SVG
+    wxString fullFilePath = myConfigFileDir + this->sysname + wxFileName::GetPathSeparator() + name + ".svg";
+    if( wxFileExists( fullFilePath ) )
+        bm = LoadSVG( fullFilePath, icon->size.x, icon->size.y);
+    else
+    {
+        wxLogMessage( _T("Can't find SVG icon: ") + fullFilePath );
+#endif // ocpnUSE_SVG
+        wxRect location( icon->iconLoc, icon->size );
+        bm = graphics->GetSubBitmap( location );
+#ifdef ocpnUSE_SVG
+    }
+#endif // ocpnUSE_SVG
please elaborate on the commit message:
Quote:
Add 2 testing toolbar icons (cairo does not like SVG files optimized with svgo and scour, but we should definitely investigate further as they save 80-90% of the size in comparison with SVGs saved by Inkscape)
seandepagnier is offline   Reply With Quote
Old 03-06-2016, 07:44   #10
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,198
Re: svg icons

Quote:
Originally Posted by boat_alexandra View Post
Why can inkscape not vectorize my bitmap drawing? Why doesn't wxsvg support embedded raster images?
Because it simply does not work well enough - it of course is possible to vectorize bitmaps, but the results are terrible most of the time.
Quote:
I agree in theory, but I want all my icons all in separate files, and somehow opencpn first searches for an svg file with the same name, then it will look in a single png file which I don't want to deal with. If I could have separate png files it would be ok...
Code:
+#ifdef ocpnUSE_SVG
+    wxString fullFilePath = myConfigFileDir + this->sysname + wxFileName::GetPathSeparator() + name + ".svg";
+    if( wxFileExists( fullFilePath ) )
+        bm = LoadSVG( fullFilePath, icon->size.x, icon->size.y);
+    else
+    {
+        wxLogMessage( _T("Can't find SVG icon: ") + fullFilePath );
+#endif // ocpnUSE_SVG
+        wxRect location( icon->iconLoc, icon->size );
+        bm = graphics->GetSubBitmap( location );
+#ifdef ocpnUSE_SVG
+    }
+#endif // ocpnUSE_SVG
Send a pull request implementing it if you feel it is needed...
Quote:
please elaborate on the commit message:
Optimized SVGs simply appear visually broken, different object sizing issues. Try yourself. Not worth looking into, IMO.

Pave
nohal is online now   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile O+OD for SVG Icons rgleason OpenCPN 8 18-01-2016 17:34
Converting Png to Svg for O Icons rgleason OpenCPN 8 10-01-2016 03:16
seasonal winds and currents in SVG Jana Atlantic & the Caribbean 1 20-05-2013 02:49
SVG Rating? snort Monohull Sailboats 3 03-03-2013 18:54
howto rebuild SVG icon ? manuprenlair OpenCPN 2 17-12-2011 11:35

Advertise Here


All times are GMT -7. The time now is 05:52.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.