{"id":458,"date":"2012-01-04T01:25:25","date_gmt":"2012-01-04T09:25:25","guid":{"rendered":"http:\/\/new.joyofprocessing.com\/blog\/?p=458"},"modified":"2012-02-08T10:57:55","modified_gmt":"2012-02-08T18:57:55","slug":"how-to-draw-the-swiss-flag","status":"publish","type":"post","link":"https:\/\/joyofprocessing.com\/blog\/2012\/01\/how-to-draw-the-swiss-flag\/","title":{"rendered":"How to Draw the Swiss Flag"},"content":{"rendered":"<p>This is one a series of posts on how to draw world flags. Finding the specifications for these flags, and attempting to reproduce the flag perfectly, according to the specifications, is a great way to teach yourself basic graphics programming.<\/p>\n<p>Previously: <a href=\"\/blog\/2012\/01\/how-to-draw-the-kenyan-flag\/\">Kenya<\/a><\/p>\n<p><script type=\"application\/processing\">\/\/ Flag of Switzerland - Jim Bumgardner\n\n\/\/ Reference: http:\/\/en.wikipedia.org\/wiki\/Flag_of_Switzerland\n\nint kHeight = 300; \/\/ The only number that needs changing\n\n\/\/ Swiss govt suggests #FF0000 for red on web, but it looks like ass\n\/\/ so I'm using the suggested Pantone color instead.\ncolor redColor = color(220, 36, 31); \/\/ Pantone 485C\ncolor whiteColor = color(255, 255, 255);\n\nsize(kHeight, kHeight);\nnoStroke();\nsmooth();\n\n\/\/ Cross height to flag height is 5\/8\nfloat crossBarHeight = height * 5 \/ 8.0;\n\n\/\/ Arms extend 1\/6th longer than their width\nfloat crossBarWidth = crossBarHeight \/ (1 + 14\/6.0);\n\n\nfill(redColor);\nrect(0,0,width,height);\n\nfill(whiteColor);\ntranslate(width\/2, height\/2);\nrect(-crossBarWidth\/2, -crossBarHeight\/2, crossBarWidth, crossBarHeight);\nrect(-crossBarHeight\/2, -crossBarWidth\/2, crossBarHeight, crossBarWidth);\n\n\n<\/script><\/p>\n<div class=\"ps_cap\"><a href=\"\/showexample.php?ex=flags\/Flag_of_Switzerland\">source<\/a><\/div>\n<p>The last flag was pretty darned complicated, so I thought I&#8217;d throw in an easy one.  <\/p>\n<p><a href=\"http:\/\/en.wikipedia.org\/wiki\/Flag_of_Switzerland\">Wikipedia tells us<\/a> that this is one of only two flags that are perfectly square.  The other is Vatican City.  This particular square flag, however, is significantly easier to draw.<\/p>\n<p>Rather than thoroughly explain this one, I&#8217;m going to leave it as an exercise to you, the reader.  Instead of looking at my source code, try reading the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Flag_of_Switzerland\">Wikipedia article<\/a> and constructing this one yourself!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is one a series of posts on how to draw world flags. Finding the specifications for these flags, and attempting to reproduce the flag perfectly, according to the specifications, is a great way to teach yourself basic graphics programming. Previously: Kenya source The last flag was pretty darned complicated, so I thought I&#8217;d throw [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[7,5,6,15],"class_list":["post-458","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-beginner","tag-easy","tag-flag","tag-symmetry"],"_links":{"self":[{"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/posts\/458","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/comments?post=458"}],"version-history":[{"count":5,"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/posts\/458\/revisions"}],"predecessor-version":[{"id":490,"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/posts\/458\/revisions\/490"}],"wp:attachment":[{"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/media?parent=458"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/categories?post=458"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/tags?post=458"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}