Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » UPP Examples SVGView error (SVG rendering not correct)
UPP Examples SVGView error [message #61798] Sat, 20 September 2025 15:40 Go to next message
deep is currently offline  deep
Messages: 277
Registered: July 2011
Location: Bangalore
Experienced Member
I am getting wrong display for the enclosed SVG file when using Examples/SVGView

index.php?t=getfile&id=7111&private=0

Enclosing SVG file in next message.


Warm Regards

Deepak
Re: UPP Examples SVGView error [message #61799 is a reply to message #61798] Sat, 20 September 2025 15:44 Go to previous messageGo to next message
deep is currently offline  deep
Messages: 277
Registered: July 2011
Location: Bangalore
Experienced Member
Expected Image file

index.php?t=getfile&id=7112&private=0
  • Attachment: biplane.png
    (Size: 85.86KB, Downloaded 116 times)


Warm Regards

Deepak
Re: UPP Examples SVGView error [message #61800 is a reply to message #61798] Sat, 20 September 2025 15:48 Go to previous messageGo to next message
deep is currently offline  deep
Messages: 277
Registered: July 2011
Location: Bangalore
Experienced Member
SVG File attached.

This file is not rendered correctly with Examples/SVGView.
  • Attachment: biplane.svg
    (Size: 14.17KB, Downloaded 18 times)


Warm Regards

Deepak
Re: UPP Examples SVGView error [message #61804 is a reply to message #61798] Mon, 22 September 2025 07:46 Go to previous messageGo to next message
zouql is currently offline  zouql
Messages: 19
Registered: December 2020
Location: China
Promising Member
hello deep:
in the biplane.svg,
1. the <style> in <defs>, but Upp is not process <style> in <defs>.(add it)
2. the <style> .cls-1 is not a valid Id, p.ReadId() can't handle it.(use p.ReadIdh() replace it)
3. the svg path, upp can't process cxy,xy,...(add while(p.Char(',')); in PainterPath.cpp)
4. the svg path, (c,s) or (q, t) they are usually used in combination.
when the front of s is not c, the first control point is the last current point, but now upp not handle it.(add a branch to handle the previous command).
I modified the two files.(SvgParser.cpp, PainterPath.cpp) You can replace it, and will see the correct display. I will submit the code later.


Re: UPP Examples SVGView error [message #61805 is a reply to message #61804] Mon, 22 September 2025 07:48 Go to previous messageGo to next message
zouql is currently offline  zouql
Messages: 19
Registered: December 2020
Location: China
Promising Member
index.php?t=getfile&id=7117&private=0
  • Attachment: biplane.png
    (Size: 215.76KB, Downloaded 119 times)
Re: UPP Examples SVGView error [message #61808 is a reply to message #61798] Tue, 23 September 2025 10:47 Go to previous messageGo to next message
deep is currently offline  deep
Messages: 277
Registered: July 2011
Location: Bangalore
Experienced Member
Hi Zouql,

Thank you for quick response.

Your changes rendering correctly many other SVG files correctly.

I am attaching one more file which is not rendering fully.


Warm Regards

Deepak
Re: UPP Examples SVGView error [message #61809 is a reply to message #61804] Tue, 23 September 2025 16:45 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14271
Registered: November 2005
Ultimate Member
zouql wrote on Mon, 22 September 2025 07:46
hello deep:
in the biplane.svg,
1. the <style> in <defs>, but Upp is not process <style> in <defs>.(add it)
2. the <style> .cls-1 is not a valid Id, p.ReadId() can't handle it.(use p.ReadIdh() replace it)
3. the svg path, upp can't process cxy,xy,...(add while(p.Char(',')); in PainterPath.cpp)
4. the svg path, (c,s) or (q, t) they are usually used in combination.
when the front of s is not c, the first control point is the last current point, but now upp not handle it.(add a branch to handle the previous command).
I modified the two files.(SvgParser.cpp, PainterPath.cpp) You can replace it, and will see the correct display. I will submit the code later.



Thank you, fix adopted with small changes.
Re: UPP Examples SVGView error [message #61810 is a reply to message #61808] Wed, 24 September 2025 02:39 Go to previous messageGo to next message
zouql is currently offline  zouql
Messages: 19
Registered: December 2020
Location: China
Promising Member
Hi deep:
In the wooden-easter-egg-holder.svg, there have some <style> .cls-1, .cls-2, .cls-3 {...} , but now only support .cls-1 {...}.
I modified some code to support multiple Ids and hope you can do more testing.

Re: UPP Examples SVGView error [message #61811 is a reply to message #61810] Wed, 24 September 2025 09:09 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14271
Registered: November 2005
Ultimate Member
Thanks, applied the fix as well. Just a note:

					for(String& id : ids)
					{
						int index = classes.Find(id);
						if(index >= 0)
						{
							String tmp = classes.Get(id);
							tmp << style;
							classes.UnlinkKey(id);
							classes.Put(id, tmp);
						}
						else
						{
							classes.Add(id, style);
						}
					}


is quite clumsy, U++ is actually designed to do it like this

					for(const String& id : ids)
						classes.GetAdd(id) << style;
Re: UPP Examples SVGView error [message #61812 is a reply to message #61798] Wed, 24 September 2025 09:25 Go to previous messageGo to next message
zouql is currently offline  zouql
Messages: 19
Registered: December 2020
Location: China
Promising Member
Hi Mirek:
Thank you, I still need to learn more from you. Also, please merge the code.

zouql
Re: UPP Examples SVGView error [message #61813 is a reply to message #61812] Wed, 24 September 2025 09:39 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14271
Registered: November 2005
Ultimate Member
zouql wrote on Wed, 24 September 2025 09:25
Hi Mirek:
Thank you, I still need to learn more from you. Also, please merge the code.

zouql


I already did, thanks again.
Re: UPP Examples SVGView error [message #61814 is a reply to message #61808] Wed, 24 September 2025 09:57 Go to previous message
mirek is currently offline  mirek
Messages: 14271
Registered: November 2005
Ultimate Member
deep wrote on Tue, 23 September 2025 10:47
Hi Zouql,

Thank you for quick response.

Your changes rendering correctly many other SVG files correctly.

I am attaching one more file which is not rendering fully.


Thanks for testing, please continue Smile

(And have a fun with your brand new laser CNC! Smile
Previous Topic: Bézier Curve and animation Engine for U++ CoreLib
Next Topic: Technology lab vs External resources
Goto Forum:
  


Current Time: Fri Oct 03 01:24:31 CEST 2025

Total time taken to generate the page: 0.04271 seconds