{"id":5738,"date":"2018-11-13T22:42:11","date_gmt":"2018-11-13T13:42:11","guid":{"rendered":"http:\/\/www.gisdeveloper.co.kr\/?p=5738"},"modified":"2020-05-28T13:14:50","modified_gmt":"2020-05-28T04:14:50","slug":"go-fogleman%ec%9d%98-go-graphics-%eb%9d%bc%ec%9d%b4%eb%b8%8c%eb%9f%ac%eb%a6%ac","status":"publish","type":"post","link":"http:\/\/www.gisdeveloper.co.kr\/?p=5738","title":{"rendered":"[Go] fogleman\uc758 Go Graphics \ub77c\uc774\ube0c\ub7ec\ub9ac"},"content":{"rendered":"<p>Go\ub294 \uadf8 \ubaa9\uc801\uc774 \uc2dc\uc2a4\ud15c \ubc0f \uc11c\ubc84 \ud504\ub85c\uadf8\ub798\ubc0d\uc5d0 \uc788\uc74c\uc73c\ub85c \uadf8\ub9ac\uae30(Draw) API\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294\ub2e4. \uadf8\ub7ec\ub098 Go \uc5b8\uc5b4\uc5d0\ub294 \uc774\ub7ec\ud55c \ubd80\uc871\ud55c \ubd80\ubd84\uc744 \ucc44\uc6cc\uc904 \ub9e4\uc6b0 \ub9ce\uc740 \uadf8\ub798\ud53d \ub77c\uc774\ube0c\ub7ec\ub9ac \uc874\uc7ac\ud558\ub294\ub370, \uadf8 \uc911\uc5d0 \ud558\ub098\uac00 fogleman\uc774 \uac1c\ubc1c\ud55c Go Graphic \ub77c\uc774\ube0c\ub7ec(https:\/\/github.com\/fogleman\/gg)\uc774\ub2e4. <\/p>\n<p>\uc544\ub798\uc758 \ucf54\ub4dc\ub294 \uc774 \ub77c\uc774\ube0c\ub7ec\ub9ac\ub97c \uc774\uc6a9\ud574 \ud544\uc790\uac00 \uc791\uc131\ud55c \ud14c\uc2a4\ud2b8 \ucf54\ub4dc\uc774\ub2e4. (\uc0ac\uc2e4 \uc774\uae00\uc740 Go \ub9c8\uc2a4\ud130\ud558\uae30 \ub77c\ub294 \ucc45\uc744 \ub2e4 \ubcf4\uace0, \ub2e4\uc2dc \ud55c\ubc88 \ub354 \ubcfc \uc694\ub7c9\uc73c\ub85c \ud30c\uc77c\uc744 \uc815\ub9ac\ud558\ub358 \uc911\uc5d0 \ucf54\ub4dc\ub97c \uc774 \ube14\ub85c\uadf8\uc5d0 \uc800\uc7a5\ud558\uae30 \uc704\ud55c \ubaa9\uc801\uc744 \uac16\ub294\ub2e4.)<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"go\">\r\npackage main\r\n\r\nimport \"github.com\/fogleman\/gg\"\r\n\r\nfunc main() {\r\n\tconst S = 256\r\n\r\n\tdc := gg.NewContext(S, S)\r\n\r\n\tdc.SetRGB(1, 1, 1)\r\n\tdc.Clear()\r\n\r\n\tif err := dc.LoadFontFace(\"font.ttf\", 36); err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\r\n\tdc.SetRGB(0, 0, 0)\r\n\r\n\ts := \"\ud55c\uae00ABC\"\r\n\tn := 3 \/\/ \"stroke\" size\r\n\r\n\tfor dy := -n; dy <= n; dy++ {\r\n\t\tfor dx := -n; dx <= n; dx++ {\r\n\t\t\tif dx*dx+dy*dy >= n*n {\r\n\t\t\t\t\/\/ give it rounded corners\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\t\t\tx := S\/2 + float64(dx)\r\n\t\t\ty := S\/2 + float64(dy)\r\n\t\t\tdc.DrawStringAnchored(s, x, y, 0.5, 0.5)\r\n\t\t}\r\n\t}\r\n\tdc.SetRGB(1, 1, 0)\r\n\tdc.DrawStringAnchored(s, S\/2, S\/2, 0.5, 0.5)\r\n\r\n\tdc.SavePNG(\"out.png\")\r\n}\r\n<\/pre>\n<p>\uacb0\uacfc\ub294 \uc544\ub798\uc640 \uac19\uc740 out.png \ud30c\uc77c\uc744 \uc0dd\uc131\ud55c\ub2e4\ub294 \uac83\uc774\ub2e4. \ud30c\uc77c\ub85c \uc0dd\uc131\ud558\ub294 \uac83\uc740 \ud544\uc790\uc758 \ubaa9\uc801\uc5d0 \ub9de\uae30 \ub54c\ubb38\uc778\ub370, \uc774\ub807\uac8c \uc0dd\uc131\ud55c \uc774\ubbf8\uc9c0\ub97c \ub124\ud2b8\uc6cc\ud06c\ub97c \ud0c0\uace0 \ud074\ub77c\uc774\uc5b8\ud2b8\uc5d0 \uc804\uc1a1\ub418\ub294 \uac83\uc774 \ubaa9\uc801\uc774\ub2e4. \ub610\ub294 \uce90\uc26c \ub418\uac70\ub098&#8230;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.gisdeveloper.co.kr\/wp-content\/uploads\/2018\/11\/out.png\" alt=\"\" width=\"256\" height=\"256\" class=\"aligncenter size-full wp-image-5741\" \/><\/p>\n<p>\uc704\uc758 \uacb0\uacfc \uc678\uc5d0\ub3c4 \uc774 \ub77c\uc774\ube0c\ub7ec\ub9ac\uc758 \uac1c\ubc1c\uc790\uac00 \uc5b8\uae09\ud55c, \ud45c\ud604 \uac00\ub2a5\ud55c \uacb0\uacfc\ubb3c\uc740 \uc544\ub798\uc640 \uac19\uc73c\ub2c8 \ucc38\uace0 \ubc14\ub780\ub2e4.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.gisdeveloper.co.kr\/wp-content\/uploads\/2018\/11\/go_graphics_libaray_images.png\" alt=\"\" width=\"2660\" height=\"1596\" class=\"aligncenter size-full wp-image-5744\" \/><\/p>\n<p>\ub0b4\uc6a9 \uc815\ub9ac \ub05d\ub0c8\uc73c\ub2c8, \uad00\ub828 \uc18c\uc2a4 \ud30c\uc77c\uc740 \uc0ad\uc81c .. !<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Go\ub294 \uadf8 \ubaa9\uc801\uc774 \uc2dc\uc2a4\ud15c \ubc0f \uc11c\ubc84 \ud504\ub85c\uadf8\ub798\ubc0d\uc5d0 \uc788\uc74c\uc73c\ub85c \uadf8\ub9ac\uae30(Draw) API\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294\ub2e4. \uadf8\ub7ec\ub098 Go \uc5b8\uc5b4\uc5d0\ub294 \uc774\ub7ec\ud55c \ubd80\uc871\ud55c \ubd80\ubd84\uc744 \ucc44\uc6cc\uc904 \ub9e4\uc6b0 \ub9ce\uc740 \uadf8\ub798\ud53d \ub77c\uc774\ube0c\ub7ec\ub9ac \uc874\uc7ac\ud558\ub294\ub370, \uadf8 \uc911\uc5d0 \ud558\ub098\uac00 fogleman\uc774 \uac1c\ubc1c\ud55c Go Graphic \ub77c\uc774\ube0c\ub7ec(https:\/\/github.com\/fogleman\/gg)\uc774\ub2e4. \uc544\ub798\uc758 \ucf54\ub4dc\ub294 \uc774 \ub77c\uc774\ube0c\ub7ec\ub9ac\ub97c \uc774\uc6a9\ud574 \ud544\uc790\uac00 \uc791\uc131\ud55c \ud14c\uc2a4\ud2b8 \ucf54\ub4dc\uc774\ub2e4. (\uc0ac\uc2e4 \uc774\uae00\uc740 Go \ub9c8\uc2a4\ud130\ud558\uae30 \ub77c\ub294 \ucc45\uc744 \ub2e4 \ubcf4\uace0, \ub2e4\uc2dc \ud55c\ubc88 \ub354 \ubcfc \uc694\ub7c9\uc73c\ub85c \ud30c\uc77c\uc744 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.gisdeveloper.co.kr\/?p=5738\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;[Go] fogleman\uc758 Go Graphics \ub77c\uc774\ube0c\ub7ec\ub9ac&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[113],"tags":[],"class_list":["post-5738","post","type-post","status-publish","format-standard","hentry","category-golang"],"_links":{"self":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/5738","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5738"}],"version-history":[{"count":8,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/5738\/revisions"}],"predecessor-version":[{"id":9562,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/5738\/revisions\/9562"}],"wp:attachment":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5738"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5738"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5738"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}