{"id":19,"date":"2009-09-29T01:28:15","date_gmt":"2009-09-28T22:28:15","guid":{"rendered":"http:\/\/yesybl.org\/blogcn\/?p=19"},"modified":"2009-09-29T01:28:15","modified_gmt":"2009-09-28T22:28:15","slug":"%e5%af%b9goocanvas-manual%e7%9a%84%e7%bf%bb%e8%af%91%ef%bc%8d%e4%b9%8bcoordinate-spaces-and-limits","status":"publish","type":"post","link":"https:\/\/www.yesybl.com\/?p=19","title":{"rendered":"\u5bf9GooCanvas Manual\u7684\u7ffb\u8bd1\uff0d\u4e4bCoordinate Spaces and Limits"},"content":{"rendered":"<p>\u81ea\u5df1\u9605\u8bfbGooCanvas\u624b\u518c\u65f6\u7ffb\u8bd1\u7684\uff0c\u53ef\u80fd\u5f88\u591a\u5730\u65b9\u6709\u95ee\u9898\uff0c\u5982\u679c\u60a8\u53d1\u73b0\u9519\u8bef\uff0c\u8bf7\u6307\u6b63\uff01\u8c22\u8c22\uff01<br \/>\n\u82f1\u6587\u539f\u7248\u5730\u5740\uff1a<br \/>\n<a href=\"http:\/\/library.gnome.org\/devel\/goocanvas\/unstable\/goocanvas-coordinates.html\">http:\/\/library.gnome.org\/devel\/goocanvas\/unstable\/goocanvas-coordinates.html<\/a><\/p>\n<p>\u7ffb\u8bd1\u5185\u5bb9\uff1a<\/p>\n<pre lang=\"text\">\n\u5750\u6807\u7a7a\u95f4\u548c\u9650\u5b9a\n\n\u5750\u6807\u7a7a\u95f4\u548c\u9650\u5b9a\uff0d\u5750\u6807\u7cfb\u662f\u5982\u4f55\u88ab\u4f7f\u7528\u7684\n\n\u5750\u6807\u7a7a\u95f4\n\n\u753b\u5e03\u4e2d\u7684\u6784\u4ef6(items)\u901a\u5e38\u90fd\u6709\u7528\u4e00\u4e9b\u5c5e\u6027\uff0c\u4ee5\u4fbf\u6307\u660e\u5b83\u4eec\u7684\u4f4d\u7f6e\u548c\u5927\u5c0f\u3002\u4e3e\u4e2a\u4f8b\u5b50\uff0cGooCanvasRect\u6784\u4ef6\u5177\u6709\"x\", \"y\", \"width\"\u548c\"height\"\u5c5e\u6027\u3002\n\n\u6784\u4ef6\u8fd8\u62e5\u6709\u4e00\u4e2a\u53d8\u5316\u77e9\u9635(transformation matrix) (\u6bd4\u5982\uff1a\"transform\"\u5c5e\u6027)\u3002\u53d8\u5316\u77e9\u9635\u901a\u8fc7\u4e00\u4e9b\u65b9\u5f0f\u4fee\u6539\u6784\u4ef6\u7684\u5750\u6807\u7a7a\u95f4\u3002\u53d8\u5316\u5305\u62ec\uff1a\u5e73\u79fb (\u79fb\u52a8\u539f\u59cb\u7ec4\u4ef6)\u3001 \u65cb\u8f6c\u3001 \u7f29\u653e\u548c\u626d\u66f2\u4ee5\u53ca\u8fd9\u4e9b\u53d8\u5316\u7684\u7ec4\u5408\u3002\u5e94\u6b64\u7ec4\u4ef6\u5728\u753b\u5e03\u4e0a\u7684\u6700\u7ec8\u4f4d\u7f6e\u662f\u80fd\u591f\u88ab\u7a81\u7136\u6539\u53d8\u7684\u3002\n\n\u5728GooCanvas\u4e2d\u7684\u7b80\u5355\u7684\u52a8\u753b\u7279\u5f81\u662f\u901a\u8fc7\u968f\u7740\u65f6\u95f4\u4fee\u6539\u6784\u4ef6\u7684\u53d8\u5316\u77e9\u9635\u6765\u5b9e\u73b0\u7684\u3002\uff08\u53c2\u770bgoo_canbas_item_animate()\u3002\uff09\n\n\u7531\u4e8e\u7ec4\u4ef6\u4eec\u662f\u5b58\u5728\u5728\u4e00\u4e2a\u5206\u5c42\u7ed3\u6784\u4e2d\uff0c\u6240\u4ee5\u6709\u53ef\u80fd\u901a\u8fc7\u7b80\u5355\u5730\u6539\u53d8\u4e00\u4e2a\u7ec4\u7684\u53d8\u5316\u77e9\u9635\u53bb\u79fb\u52a8\u6216\u65cb\u8f6c\u6574\u4e2a\u7ec4\u7684\u7ec4\u4ef6\u3002\n\n\u5728\u7ec4\u4ef6\u81ea\u8eab\u5185\u4f7f\u7528\u7684\u5750\u6807\u7a7a\u95f4\u662f\u53c2\u7167\u4e8e\u201c\u7ec4\u4ef6\u7a7a\u95f4\u201d\u7684\uff08\u6bd4\u5982\u4e00\u4e2aGooCanvasRect\u7684\"x\"\u548c\"y\"\u5c5e\u6027\u88ab\u6307\u660e\u7684\u5730\u65b9\uff09\u3002\u6574\u4e2a\u753b\u5e03\u6240\u4f7f\u7528\u7684\u5750\u6807\u7a7a\u95f4\u662f\u53c2\u7167\u4e8e\u201c\u8bbe\u5907\u7a7a\u95f4\u201d\u7684\u3002\u201c\u7ec4\u4ef6\u7a7a\u95f4\u201d\u548c\u201c\u8bbe\u5907\u7a7a\u95f4\u201d\u53ef\u80fd\u4e00\u6837\u4e5f\u53ef\u80fd\u4e0d\u4e00\u6837\uff0c \u8fd9\u53d6\u51b3\u4e8e\u8be5\u7ec4\u4ef6\u6216\u5b83\u7684\u4efb\u610f\u4e00\u4e2a\u7236\u7ec4\u4ef6\u662f\u5426\u62e5\u6709\u4e00\u4e2a\u53d8\u5316\u77e9\u9635\u96c6\uff08set, \u4e5f\u8bb8\u662f\u8bbe\u5b9a)\u3002\uff08\u6ce8\u610f\uff1a\u6574\u4e2a\u753b\u5e03\u662f\u53ef\u4ee5\u540c\u6837\u88ab\u5377\u52a8\u6216\u7f29\u653e\u7684\uff0c\u8fd9\u4e5f\u5c31\u610f\u5473\u7740\u5728\u201c\u8bbe\u5907\u7a7a\u95f4\u201d\u4e0a\u6709\u4e00\u4e2a\u9644\u52a0\u7684\u53d8\u5316\u3002\n\n\u7528\u4e8e\u8f6c\u6362\u4e24\u4e2a\u5750\u6807\u7a7a\u95f4\u7684\u51fd\u6570\uff0c\u4f8b\u5982goo_canvas_convert_to_item_space()\u548cgoo_canvas_convert_from_item_space()\u7528\u4e8e\u8fdb\u884c\u8bbe\u5907\u7a7a\u95f4\u5750\u6807\u7cfb\u548c\u7ec4\u4ef6\u7a7a\u95f4\u4e4b\u95f4\u7684\u76f8\u4e92\u8f6c\u6362\u3002\n\n\n\u5750\u6807\u9650\u5b9a (\u6682\u4e0d\u7ffb\u8bd1\uff09\n\nGooCanvas uses the Cairo graphics library to render canvas items. For performance reasons Cairo uses 32-bit fixed point integers\ninternally when rendering graphics, with 24 bits used for the integer part of values and 8 bits used for the fractional part. This means\nthat values are limited to roughly +\/- 8,388,608. (Prior to Cairo 1.6 16 bits were used for the integer part and 16 bits for the\nfractional part, meaning values were limited to +\/- 32,768.)\n\nGooCanvas includes code to work around the Cairo limits to some extent. Subclasses of GooCanvasItemSimple (including all builtin items)\ncan use any desired translation using a transformation matrix. But item space coordinates (modified by any scale, rotation or skew) must\nbe within the Cairo limits.\n\nIt is possible to create new canvas items that avoid the Cairo limits completely. For an example of this see the \"Large Items\" page in\nthe GooCanvas demo application, and the corresponding code.\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<a href=\"https:\/\/www.yesybl.com\/?p=19\" rel=\"bookmark\" title=\"Permalink to \u5bf9GooCanvas Manual\u7684\u7ffb\u8bd1\uff0d\u4e4bCoordinate Spaces and Limits\"><p>\u81ea\u5df1\u9605\u8bfbGooCanvas\u624b\u518c\u65f6\u7ffb\u8bd1\u7684\uff0c\u53ef\u80fd\u5f88\u591a\u5730\u65b9\u6709\u95ee\u9898\uff0c\u5982\u679c\u60a8\u53d1\u73b0\u9519\u8bef\uff0c\u8bf7\u6307\u6b63\uff01\u8c22\u8c22\uff01 \u82f1\u6587\u539f\u7248\u5730\u5740\uff1a http:\/\/library.gnome.org\/devel\/goocanvas\/unstable\/goocanvas-coordinates.html \u7ffb\u8bd1\u5185\u5bb9\uff1a \u5750\u6807\u7a7a\u95f4\u548c\u9650\u5b9a \u5750\u6807\u7a7a\u95f4\u548c\u9650\u5b9a\uff0d\u5750\u6807\u7cfb\u662f\u5982\u4f55\u88ab\u4f7f\u7528\u7684 \u5750\u6807\u7a7a\u95f4 \u753b\u5e03\u4e2d\u7684\u6784\u4ef6(items)\u901a\u5e38\u90fd\u6709\u7528\u4e00\u4e9b\u5c5e\u6027\uff0c\u4ee5\u4fbf\u6307\u660e\u5b83\u4eec\u7684\u4f4d\u7f6e\u548c\u5927\u5c0f\u3002\u4e3e\u4e2a\u4f8b\u5b50\uff0cGooCanvasRect\u6784\u4ef6\u5177\u6709&#8221;x&#8221;, &#8220;y&#8221;, &#8220;width&#8221;\u548c&#8221;height&#8221;\u5c5e\u6027\u3002 \u6784\u4ef6\u8fd8\u62e5\u6709\u4e00\u4e2a\u53d8\u5316\u77e9\u9635(transformation matrix) (\u6bd4\u5982\uff1a&#8221;transform&#8221;\u5c5e\u6027)\u3002\u53d8\u5316\u77e9\u9635\u901a\u8fc7\u4e00\u4e9b\u65b9\u5f0f\u4fee\u6539\u6784\u4ef6\u7684\u5750\u6807\u7a7a\u95f4\u3002\u53d8\u5316\u5305\u62ec\uff1a\u5e73\u79fb (\u79fb\u52a8\u539f\u59cb\u7ec4\u4ef6)\u3001 \u65cb\u8f6c\u3001 \u7f29\u653e\u548c\u626d\u66f2\u4ee5\u53ca\u8fd9\u4e9b\u53d8\u5316\u7684\u7ec4\u5408\u3002\u5e94\u6b64\u7ec4\u4ef6\u5728\u753b\u5e03\u4e0a\u7684\u6700\u7ec8\u4f4d\u7f6e\u662f\u80fd\u591f\u88ab\u7a81\u7136\u6539\u53d8\u7684\u3002 \u5728GooCanvas\u4e2d\u7684\u7b80\u5355\u7684\u52a8\u753b\u7279\u5f81\u662f\u901a\u8fc7\u968f\u7740\u65f6\u95f4\u4fee\u6539\u6784\u4ef6\u7684\u53d8\u5316\u77e9\u9635\u6765\u5b9e\u73b0\u7684\u3002\uff08\u53c2\u770bgoo_canbas_item_animate()\u3002\uff09 \u7531\u4e8e\u7ec4\u4ef6\u4eec\u662f\u5b58\u5728\u5728\u4e00\u4e2a\u5206\u5c42\u7ed3\u6784\u4e2d\uff0c\u6240\u4ee5\u6709\u53ef\u80fd\u901a\u8fc7\u7b80\u5355\u5730\u6539\u53d8\u4e00\u4e2a\u7ec4\u7684\u53d8\u5316\u77e9\u9635\u53bb\u79fb\u52a8\u6216\u65cb\u8f6c\u6574\u4e2a\u7ec4\u7684\u7ec4\u4ef6\u3002 \u5728\u7ec4\u4ef6\u81ea\u8eab\u5185\u4f7f\u7528\u7684\u5750\u6807\u7a7a\u95f4\u662f\u53c2\u7167\u4e8e\u201c\u7ec4\u4ef6\u7a7a\u95f4\u201d\u7684\uff08\u6bd4\u5982\u4e00\u4e2aGooCanvasRect\u7684&#8221;x&#8221;\u548c&#8221;y&#8221;\u5c5e\u6027\u88ab\u6307\u660e\u7684\u5730\u65b9\uff09\u3002\u6574\u4e2a\u753b\u5e03\u6240\u4f7f\u7528\u7684\u5750\u6807\u7a7a\u95f4\u662f\u53c2\u7167\u4e8e\u201c\u8bbe\u5907\u7a7a\u95f4\u201d\u7684\u3002\u201c\u7ec4\u4ef6\u7a7a\u95f4\u201d\u548c\u201c\u8bbe\u5907\u7a7a\u95f4\u201d\u53ef\u80fd\u4e00\u6837\u4e5f\u53ef\u80fd\u4e0d\u4e00\u6837\uff0c \u8fd9\u53d6\u51b3\u4e8e\u8be5\u7ec4\u4ef6\u6216\u5b83\u7684\u4efb\u610f\u4e00\u4e2a\u7236\u7ec4\u4ef6\u662f\u5426\u62e5\u6709\u4e00\u4e2a\u53d8\u5316\u77e9\u9635\u96c6\uff08set, \u4e5f\u8bb8\u662f\u8bbe\u5b9a)\u3002\uff08\u6ce8\u610f\uff1a\u6574\u4e2a\u753b\u5e03\u662f\u53ef\u4ee5\u540c\u6837\u88ab\u5377\u52a8\u6216\u7f29\u653e\u7684\uff0c\u8fd9\u4e5f\u5c31\u610f\u5473\u7740\u5728\u201c\u8bbe\u5907\u7a7a\u95f4\u201d\u4e0a\u6709\u4e00\u4e2a\u9644\u52a0\u7684\u53d8\u5316\u3002 \u7528\u4e8e\u8f6c\u6362\u4e24\u4e2a\u5750\u6807\u7a7a\u95f4\u7684\u51fd\u6570\uff0c\u4f8b\u5982goo_canvas_convert_to_item_space()\u548cgoo_canvas_convert_from_item_space()\u7528\u4e8e\u8fdb\u884c\u8bbe\u5907\u7a7a\u95f4\u5750\u6807\u7cfb\u548c\u7ec4\u4ef6\u7a7a\u95f4\u4e4b\u95f4\u7684\u76f8\u4e92\u8f6c\u6362\u3002 \u5750\u6807\u9650\u5b9a (\u6682\u4e0d\u7ffb\u8bd1\uff09 GooCanvas uses the Cairo graphics library to render canvas items. For performance reasons Cairo uses 32-bit fixed point integers internally when rendering graphics, with 24 bits used for the integer part [&hellip;]<\/p>\n<\/a>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pa4z28-j","_links":{"self":[{"href":"https:\/\/www.yesybl.com\/index.php?rest_route=\/wp\/v2\/posts\/19"}],"collection":[{"href":"https:\/\/www.yesybl.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yesybl.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yesybl.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yesybl.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=19"}],"version-history":[{"count":0,"href":"https:\/\/www.yesybl.com\/index.php?rest_route=\/wp\/v2\/posts\/19\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yesybl.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yesybl.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yesybl.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}