Blog
SVG Debug Output For Rendering
Date: 2/5/2007
I've got a bug in my GPath code where in more complicated vector art it misses a segment out and draws incorrectly. So because I can't come up with a simple case to help debug it I've added a lot of logging to the code that is #define'd in and out. I wanted a way to visualize the segments being passed into the rendering stage and so I made the logging output paths in SVG format which I can paste into a file for viewing:

http://memecode.com/images/blog/path-debug.svg

What you see in that image is a lot of segments each making up a vertical part of the vector art. No segment can be horizontal or double back on itself, i.e. it's either purely upwards or purely downwards. The error is in the capital "C" where there is no vertical cap on the bottom ending of the stroke joining segment 32 to segment 37. Thus putting out the in/out segment count for those scan lines and creating a visual artifact to the right of that missing segment.

I created the random colours with:
printf("color=\"%06.6X\"", rand() % 0xffffff);


I just thought this method of creating visual debugging info was cute and might be useful to others working with graphical things.

Update: Bug is fixed. But man that code is a mess. I really never want to have to touch it again.
 
Reply
From:
Email (optional): (Will be HTML encoded to evade harvesting)
Message:
 
Remember username and/or email in a cookie.
Notify me of new posts in this thread via email.
BBcode:
[q]text[/q]
[url=link]description[/url]
[img]url_to_image[/img]
[pre]some_code[/pre]
[b]bold_text[/b]