Monday, December 9, 2013

From concept to reality in 6 weeks - part 16

Today is thankfully a new day as I just want to completely forget everything that happened this weekend as it was all just a bad dream, or at least that is what I want to tell myself. It was all personal problems with my family that is just getting worse with every passing day. That is the challenge of balancing family and work life. No client of mine pays me to moan and groan about my personal and family issues. They are paying me for super first class high quality results. Part of experience of getting old is to be able to separate family and work and put 100% effort into work every when things are going terribly at home. I really learned this two jobs ago when my best friend was dying of cancer in front of me daily at work. He definitely rose above his circumstances and did his absolute best even when feeling horrible from chemotherapy or radiation. He was a trooper until the end and I have to remember those 3 years for the rest of my life.

Now it is time to refocus on the task at hand as I am half way thru the project. Elapsed time wise I have 4 calendar weeks left to go. I realize that does not mean I have 20 days as I want to spend time with my family during Christmas and New Year's Day. Today my task is to finish off the final layer and resolve the layer icon issues so they all look correct by color and size. Before I start on that I need to check the label changes I made and learn about latitude for the millionth time it seems. I quickly go to Wikipedia so I can see a visual picture in my head so maybe just maybe I will remember this time that longitudes or meridians go thru the poles and latitudes are parallel to the equator. I change my debug statements to show the extend of the markers for N/S latitudes and E/W longitudes. I then need to fix my labels to show altitudes as whole numbers as I see decimal points being displayed, so I switch back over to the C# number formatting documentation asI have been there before. The secret was to use "N0" to show a number with no values after the decimal point. Two problems resolved just like that.

Now to solve the markers. I have decided to automate this whole process by using ImageMagick convert program since I don't want to edit the SVG files and generate PNGs each manually as that is too time consuming. I had to regenerate the triangle in Inkscape so I had to look that up as it is not obvious how to do that. The first thing is how to set the transparent pixel which is done with -transparent option. The second thing is how to account for the case when the background color is not an exact single color and that is fixed by using the -fuzz option. Then I need a way to change the default foreground pixel color as it needs to change for each marker depending on elevation and that is done with the -fill option. Now I just need to figure out the colors that match each of the icons and I am done. ImageMagick definitely helps me here as it supports many color syntax values. I have RGBA values stored in C# so I am going to use those values in my Bash script that will auto-image-magickally do every thing for me. As an aside, this has to be one of the worst names in all of UNIX, the shebang marker at the top of the UNIX shell script which I add to my script. I always run it with the time command so I know how long it takes to run:
$ time ./convert.sh 

real 0m1.388s
user 0m0.443s
sys 0m0.278s
This is what my script looks like in general:
convert -fill 'rgba(181,13,33,235)' -fuzz 20% -transparent white A.svg A.png
The last thing I had to do in my script was copy each output PNG file into the Windows Store project Assets folder so I can easily add them into the VSE project on my Windows laptop. I am still not happy with the icons as I need to find a way to use vector icons as generating the PNG files just don't look good at all. The functionality is working, but it looks bad, so I need to address that somehow.

The whole rest of the day was fixing, changing, editing and resizing icons to make sure they look really good as they are essential to the app. Gimp and Inkscape were my constant companions all day long. It took way too long to fix all of the images it had to be done either programatically or manually. I am just glad that it all looks good and I can call it a day.

No comments: