Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Rate Thread Display Modes
Old 01-06-2016, 12:58   #1
Registered User
 
boat_alexandra's Avatar

Join Date: Aug 2009
Location: chesapeake bay
Boat: bristol 27
Posts: 2,810
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?
__________________

__________________
boat_alexandra is offline   Reply With Quote
Old 01-06-2016, 13:14   #2
bcn
Registered User

Join Date: May 2011
Location: underway whenever possible
Boat: Rangeboat 39
Posts: 2,761
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, 20:21   #3
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 9,398
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, 23:11   #4
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,018
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 offline   Reply With Quote
Old 02-06-2016, 05:59   #5
Registered User
 
boat_alexandra's Avatar

Join Date: Aug 2009
Location: chesapeake bay
Boat: bristol 27
Posts: 2,810
Re: svg icons

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

Join Date: May 2011
Location: underway whenever possible
Boat: Rangeboat 39
Posts: 2,761
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:	40
Size:	71.2 KB
ID:	125363  
Attached Images
  
Attached Files
File Type: doc Pilotfish.svg.doc (11.3 KB, 10 views)
__________________
bcn is offline   Reply With Quote
Old 02-06-2016, 08:58   #7
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,018
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 offline   Reply With Quote
Old 02-06-2016, 09:04   #8
bcn
Registered User

Join Date: May 2011
Location: underway whenever possible
Boat: Rangeboat 39
Posts: 2,761
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, 12:49   #9
Registered User
 
boat_alexandra's Avatar

Join Date: Aug 2009
Location: chesapeake bay
Boat: bristol 27
Posts: 2,810
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)
__________________
boat_alexandra is offline   Reply With Quote
Old 03-06-2016, 08:44   #10
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,018
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 offline   Reply With Quote
Reply

Thread Tools
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 18:34
Converting Png to Svg for O Icons rgleason OpenCPN 8 10-01-2016 04:16
seasonal winds and currents in SVG Jana Atlantic & the Caribbean 1 20-05-2013 03:49
SVG Rating? snort Monohull Sailboats 3 03-03-2013 19:54
howto rebuild SVG icon ? manuprenlair OpenCPN 2 17-12-2011 12:35



Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -7. The time now is 22:49.


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

ShowCase vBulletin Plugins by Drive Thru Online, Inc.