{"id":16058,"date":"2016-10-13T16:57:11","date_gmt":"2016-10-13T20:57:11","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=16058"},"modified":"2019-03-13T15:21:14","modified_gmt":"2019-03-13T19:21:14","slug":"drawing-hairlines","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2016\/10\/13\/drawing-hairlines\/","title":{"rendered":"Drawing Hairlines"},"content":{"rendered":"<p><a href=\"http:\/\/www.figure.ink\/blog\/2016\/9\/11\/hairlines\">Joshua Emmons<\/a>:<\/p>\n<blockquote cite=\"http:\/\/www.figure.ink\/blog\/2016\/9\/11\/hairlines\">\n<p>Or, graphically, for any Y in the shaded area, we need to either round it up to the top dashed line or round it down to the bottom dashed line to draw a perfect non-antialiased line.<\/p>\n<p>How do we choose if we want to draw above or below our given coordinate? It depends on the situation. If we&rsquo;re trying to draw a line at the very top of a clipping view, we&rsquo;ll want to draw slightly below the Y we give it. Otherwise it will clip and not be visible. The same goes in reverse for drawing at the bottom of a view.<\/p>\n<p>[&#8230;]<\/p>\n<p>Sadly, we don&rsquo;t want to draw perfect single <em>point<\/em> lines. We want to draw perfect single <em>pixel<\/em> lines. On non-retina devices, those are the same thing. But on everything else, each point is made up of several pixels. <\/p>\n<p>&ldquo;Plus&rdquo; model iPhones, for example, actually have three pixels per point, represented by the yellow lines here.<\/p>\n<\/blockquote>\n<p>Update (2016-10-13): Previously: <a href=\"http:\/\/mjtsai.com\/blog\/2014\/11\/25\/iphone-6-pixel-peeping\/\">iPhone 6 Pixel Peeping<\/a> (via <a href=\"https:\/\/twitter.com\/olebegemann\/status\/786713798140891136\">Ole Begemann<\/a>).<\/p>","protected":false},"excerpt":{"rendered":"<p>Joshua Emmons: Or, graphically, for any Y in the shaded area, we need to either round it up to the top dashed line or round it down to the bottom dashed line to draw a perfect non-antialiased line. How do we choose if we want to draw above or below our given coordinate? It depends [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2019-03-13T19:21:16Z","apple_news_api_id":"8420ce9f-cfab-481f-b879-d3a5c7bc8edb","apple_news_api_modified_at":"2019-03-13T19:21:18Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/AhCDOn8-rSB-4edOlx7yO2w","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[619,31,1380,71,178,83,901],"class_list":["post-16058","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-graphics","tag-ios","tag-ios-10","tag-programming","tag-quartz","tag-retina","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/16058","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=16058"}],"version-history":[{"count":4,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/16058\/revisions"}],"predecessor-version":[{"id":24591,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/16058\/revisions\/24591"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=16058"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=16058"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=16058"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}