{"id":3427,"date":"2016-01-15T16:39:44","date_gmt":"2016-01-15T08:39:44","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=3427"},"modified":"2016-01-15T17:46:27","modified_gmt":"2016-01-15T09:46:27","slug":"fmx-%e6%ad%a5%e6%ad%a5%e6%83%8a%e5%bf%83-fmx-canvas-%e7%a0%94%e7%a9%b6%e7%ac%94%e8%ae%b0","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=3427","title":{"rendered":"[FMX] \u6b65\u6b65\u60ca\u5fc3 &#8211; FMX Canvas \u7814\u7a76\u7b14\u8bb0"},"content":{"rendered":"<p><strong>\u3010\u6ce8\u3011\u4e0b\u9762\u7684\u5185\u5bb9\uff0c\u4ec5\u9002\u7528\u4e8e Delphi\/C++ Builder X\uff0c\u81f3\u4e8e\u5176\u5b83\u7248\u672c\uff0c\u4e0d\u505a\u4efb\u4f55\u4fdd\u8bc1\u3002<\/strong><\/p>\n<p>\u7814\u7a76\u4e00\u4e2a\u65b0\u7684\u4e1c\u897f\uff0c\u96be\u514d\u4f1a\u5c06\u8001\u7684\u89c2\u5ff5\u5e26\u8fdb\u6765\uff0c\u4e5f\u96be\u514d\u4f1a\u9047\u5230\u4e0d\u540c\u7684\u5751\uff0c\u6709\u4e9b\u5751\u662f\u81ea\u5df1\u6316\u7684\uff0c\u6709\u4e9b\u5751\u662f\u5382\u5546\u6216\u4f5c\u8005\u6316\u7684\uff0c\u4e00\u8def\u8d70\u6765\uff0c\u582a\u79f0\u6b65\u6b65\u60ca\u5fc3\u3002FMX \u76ee\u524d\u6765\u8bf4\uff0c\u6539\u8fdb\u5f88\u5927\uff0c\u4f46\u5751\u4ecd\u7136\u8fd8\u6709\u5f88\u591a\uff0c\u6162\u6162\u7814\u7a76\uff0c\u6162\u6162\u6478\u7d22\uff0c\u5e0c\u671b\u4e0e\u5927\u5bb6\u4e00\u540c\u8fdb\u6b65\u3002<\/p>\n<p>1\u3001\u4e0d\u8981\u4ee5\u4e3a\u4f60\u5728 VCL \u4e0b\u7684\u8bb8\u591a\u7ecf\u9a8c\u4e5f\u9002\u7528\u4e8e FMX\u3002<\/p>\n<p>1.1\u3001VCL \u4e2d Canvas \u7528 Lock\u3001Unlock \u6765\u9501\u5b9a\u753b\u5e03\uff0c\u800c\u5728 FMX \u4e2d\uff0c\u4f60\u5e94\u8be5\u4f7f\u7528 BeginScene\/EndScene \u6765\u7ba1\u7406\u753b\u5e03\u7684\u66f4\u65b0\u95ee\u9898\u3002<\/p>\n<p>1.2\u3001VCL \u4e2d Canvas.Brush \u5728 FMX \u4e2d\u4f60\u9700\u8981\u7528 Fill \u5c5e\u6027\u6765\u66ff\u4ee3\uff0c\u800c Pen \u5219\u88ab Stroke \u5c5e\u6027\u6765\u66ff\u4ee3\u3002\u5f53\u7136\u4e86\uff0c\u65b0\u7684\u5c5e\u6027\u529f\u80fd\u66f4\u5f3a\u5927\u3002\u4f46\u662f\uff0c\u6709\u4e00\u70b9\u8981\u6ce8\u610f\uff0c\u6709\u4e9b\u4e1c\u897f\u548c\u4f60\u60f3\u7684\u5e76\u4e0d\u4e00\u6837:)\u3002<\/p>\n<p>2\u3001\u4e0d\u8981\u4ee5\u4e3a\u4e0d\u540c\u5e73\u53f0\u4e0a\u7684 Canvas \u7684\u540c\u6837\u7684\u4ee3\u7801\u4e00\u5b9a\u80fd\u751f\u6210\u540c\u6837\u7684\u7ed3\u679c\u3002<\/p>\n<p>2.1\u3001\u5728 Windows \u5e73\u53f0\u4e0b\u548c Android \u5e73\u53f0\u4e0b\uff0c\u753b\u7b14 Stroke \u5b58\u5728\u4ee5\u4e0b\u4e0d\u540c\uff1a<\/p>\n<ul>\n<li>Android \u4e0b\u9762\u4e0d\u652f\u6301\u6e10\u53d8\uff0c\u867d\u7136\u4f60\u8bbe\u7f6e\u4e0d\u51fa\u9519\uff0c\u4f46\u662f\uff0c\u5b83\u5374\u4e0d\u751f\u6548\uff0c\u753b\u7684\u4f9d\u7136\u662f\u5b9e\u5fc3\u7684\u3002<\/li>\n<li>Android \u4e0b\u9762\u4e0d\u652f\u6301\u4f4d\u56fe\u753b\u7b14\uff0c\u5982\u679c\u4f60\u8bbe\u7f6e\u63a7\u4ef6\u7684 Stroke.Kind \u4e3aBitmap\uff0c\u662f\u65e0\u6548\u7684\u3002<\/li>\n<li>Android \u4e0b\u9762\uff0cStroke.Kind \u9ed8\u8ba4\u662f TBrushKind.None\uff0c\u800c Windows \u5e73\u53f0\u4e0b\uff0c\u9ed8\u8ba4\u7684\u662f TBrushKind.Solid\uff0c\u6240\u4ee5\uff0c\u5728 Android \u5e73\u53f0\u4e0b\uff0c\u4f60\u8c03\u7528 TCanvas.DrawLine \u3001DrawRect \u7b49\u9700\u8981\u753b\u7b14\u7684\u65b9\u6cd5\u65f6\uff0c\u8bf7\u5148\u8bbe\u7f6e\u753b\u7b14\u7684\u7c7b\u578b\u4e3a TBrushKind.Solid\uff0c\u5426\u5219\uff0c\u5565\u4e5f\u753b\u4e0d\u51fa\u6765\uff0c\u53ea\u80fd\u5e72\u7740\u6025\u3002<\/li>\n<li>Android \u4e0b\u9762\uff0c\u7cfb\u7edf\u7684 Stroke.Join \u4e0d\u652f\u6301\u4ec0\u4e48 Round\u3001Bevel \u5565\u7684\uff0c\u6240\u4ee5\uff0c\u4f60\u5982\u679c\u60f3\u8981\u753b\u51fa\u90a3\u79cd\u6548\u679c\uff0c\u81ea\u5df1\u60f3\u529e\u6cd5\u5427\u3002\u6240\u4ee5\uff0cStroke.StrokeThickness&gt;1 \u65f6\u4f1a\u51fa\u73b0\u795e\u5947\u7684\u6548\u679c\u3002\u5bf9\u6bd4\u4e0bAndroid \u548c Windows \u4e0b\u7684\u4e0d\u540c\u6548\u679c\u3002<br \/>\n<a href=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2016\/01\/FMX.Stroke.jpg\" rel=\"attachment wp-att-3430\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3430 aligncenter\" src=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2016\/01\/FMX.Stroke.jpg\" alt=\"FMX.Stroke\" width=\"375\" height=\"201\" srcset=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2016\/01\/FMX.Stroke.jpg 375w, https:\/\/blog.qdac.cc\/wp-content\/uploads\/2016\/01\/FMX.Stroke-300x161.jpg 300w\" sizes=\"auto, (max-width: 375px) 100vw, 375px\" \/><\/a>\u5b9e\u9645\u4e0a\uff0c\u8fd9\u4e2a\u6548\u679c\u81ea\u5df1\u53ef\u4ee5\u5f88\u5bb9\u6613\u7684\u4fee\u6b63\u4e0b\uff0c\u4e3b\u8981\u662f\u7ebf\u5bbd\u4e0d\u4e3a1\u65f6\uff0c\u9700\u8981\u8c03\u6574\u4e0b\u7ed8\u56fe\u7684\u8d77\u59cb\u5750\u6807\u4f4d\u7f6e\u5c31\u597d\uff0c\u4f46\u663e\u7136\uff0c\u622a\u6b62 DX Update 1\uff0c\u8fd9\u4e2a\u95ee\u9898\u6ca1\u6709\u4fee\u6b63\u3002<\/li>\n<\/ul>\n<p>2.2\u3001Fill \u5c5e\u6027\u5012\u662f\u6ca1\u6d4b\u8bd5\u53d1\u73b0\u4ec0\u4e48\u95ee\u9898\uff0c\u53ef\u4ee5\u6b63\u786e\u7684\u586b\u5145\u51fa\u6765\u6e10\u53d8\u7684\u6548\u679c\u3002<\/p>\n<p>3\u3001\u6e10\u53d8 TGradient \u63d0\u4f9b\u4e86\u4e00\u4e2a\u65b9\u6cd5 Gradient.InterpolateColor \u53ef\u4ee5\u8ba1\u7b97\u7279\u5b9a\u70b9\u7684\u989c\u8272\uff0c\u6ce8\u610f\u53c2\u6570 Offset \u662f 0-1 \u4e4b\u95f4\u7684\u4e00\u4e2a\u6d6e\u70b9\u6570\u3002\u53e6\u5916\u7684\u7248\u672cX\u3001Y\u4e5f\u662f\u4e00\u6837\u7684\uff0c\u522b\u60f3\u591a\u4e86\u3002<\/p>\n<p>4\u3001TBitmap \u5bf9\u8c61\u5728 Android \u4f7f\u7528\u4e4b\u524d\uff0c\u8bf7\u5148\u6307\u5b9a\u957f\u5bbd\uff0c\u5426\u5219\uff0c\u4f1a\u51fa\u5f02\u5e38\u3002\u5b83\u7684 Canvas \u9700\u8981\u6709\u5bbd\u548c\u9ad8\u624d\u80fd\u7528\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3010\u6ce8\u3011\u4e0b\u9762\u7684\u5185\u5bb9\uff0c\u4ec5\u9002\u7528\u4e8e Delphi [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[145,69,8,21],"tags":[535,149],"class_list":["post-3427","post","type-post","status-publish","format-standard","hentry","category-android","category-c-builder","category-delphi","category-misc","tag-canvas","tag-fmx"],"views":4610,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/3427","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3427"}],"version-history":[{"count":3,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/3427\/revisions"}],"predecessor-version":[{"id":3433,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/3427\/revisions\/3433"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3427"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3427"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3427"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}