{"id":517,"date":"2018-06-28T06:29:12","date_gmt":"2018-06-28T06:29:12","guid":{"rendered":"http:\/\/www.bverhue.nl\/delphisvg\/?p=517"},"modified":"2018-06-28T06:36:13","modified_gmt":"2018-06-28T06:36:13","slug":"v2-20-update-11","status":"publish","type":"post","link":"https:\/\/www.bverhue.nl\/delphisvg\/2018\/06\/28\/v2-20-update-11\/","title":{"rendered":"v2.20 update 11"},"content":{"rendered":"<p>Here are a couple of things that are new or improved in update 11. For a full list, see <a href=\"http:\/\/www.bverhue.nl\/delphisvg\/change-log\/\">the change log<\/a>.<\/p>\n<p><strong>Added &#8220;AspectRatioAlign&#8221; and &#8220;AspectRatioMeetOrSlice&#8221; to SVG controls<\/strong><\/p>\n<p>It was already possible to automatically add a viebox to SVG graphics that don&#8217;t have one defined with the property &#8220;AutoViewbox&#8221;.<\/p>\n<p>I have now added the properties &#8220;AspectRatioAlign&#8221; and &#8220;AspectRatioMeetOrSlice&#8221;. These properties give you further control how the SVG graphic is aligned within the control bounds.<\/p>\n<p>Below you see the effect of setting the &#8220;AutoViewbox&#8221; property.<\/p>\n<p><a href=\"http:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/Aspect-ratio-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-533\" src=\"http:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/Aspect-ratio-1-300x183.png\" alt=\"\" width=\"300\" height=\"183\" srcset=\"https:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/Aspect-ratio-1-300x183.png 300w, https:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/Aspect-ratio-1-600x366.png 600w, https:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/Aspect-ratio-1-768x469.png 768w, https:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/Aspect-ratio-1-1024x625.png 1024w, https:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/Aspect-ratio-1.png 1025w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>If &#8220;AutoViewbox&#8221; = FALSE, the SVG graphic will be rendered exactly as defined in the SVG graphic itself, if it is bigger than the SVG control, it will be clipped.<\/p>\n<p>If &#8220;AutoViewbox&#8221; = TRUE, the SVG graphic will be aligned within the control according to the &#8220;AspectRatioAlign&#8217; and &#8220;AsectRatioMeetOrSlice&#8221; settings, the default setting is &#8220;xMid yMid Meet&#8221;.<\/p>\n<p>&nbsp;<\/p>\n<p>Here you see different settings for &#8220;AspectRatioAlign&#8221; and &#8220;AspectRatioMeetOrSlice&#8221;, these are equivalent to the settings of the SVG &#8220;<a href=\"https:\/\/www.w3.org\/TR\/SVG\/coords.html#PreserveAspectRatioAttribute\">preserveAspectRatio<\/a>&#8221; attribute.<\/p>\n<p><a href=\"http:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/Aspect-ratio-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-514\" src=\"http:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/Aspect-ratio-2-300x173.png\" alt=\"\" width=\"300\" height=\"173\" srcset=\"https:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/Aspect-ratio-2-300x173.png 300w, https:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/Aspect-ratio-2-600x345.png 600w, https:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/Aspect-ratio-2-768x442.png 768w, https:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/Aspect-ratio-2-1024x589.png 1024w, https:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/Aspect-ratio-2.png 1032w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Improved rendering quality for rotated SVG graphics<\/strong><\/p>\n<p>On FMX you can rotate and scale controls. The SVG renderer in update 11 contains a new algorithm for calculating internal bitmap buffers, for things like filters and masks. This gives much better results for transformed controls.<\/p>\n<p>Below you see de difference between the graphic rendered with update 10 left, and update 11 right.<\/p>\n<table>\n<tbody>\n<tr>\n<td><a href=\"http:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/rotate_upd_10.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-519\" src=\"http:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/rotate_upd_10-300x261.png\" alt=\"\" width=\"300\" height=\"261\" srcset=\"https:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/rotate_upd_10-300x261.png 300w, https:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/rotate_upd_10.png 456w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/td>\n<td><a href=\"http:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/rotate_upd_11.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-520\" src=\"http:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/rotate_upd_11-300x259.png\" alt=\"\" width=\"300\" height=\"259\" srcset=\"https:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/rotate_upd_11-300x259.png 300w, https:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/rotate_upd_11.png 456w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>This also works on VCL, although in Delphi, you don&#8217;t have properties on the VCL controls to scale or rotate, you might have SVG graphics that have a transformation defined on the outer SVG element.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Support for &#8220;fill-rule&#8221; and &#8220;clip-rule&#8221; attributes<br \/>\n<\/strong><\/p>\n<p><a href=\"https:\/\/www.w3.org\/TR\/SVG\/painting.html#FillRuleProperty\">These attributes<\/a> give you control over how an path element is filled.<\/p>\n<p><a href=\"http:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/FillRule.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-537\" src=\"http:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/FillRule-300x197.png\" alt=\"\" width=\"300\" height=\"197\" srcset=\"https:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/FillRule-300x197.png 300w, https:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/FillRule-600x393.png 600w, https:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/FillRule.png 706w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>This attribute is not supported for all platforms, see table below.<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>SVG Render context<\/strong><\/td>\n<td><strong>VCL<\/strong><\/td>\n<td><strong>FMX<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Direct2D<\/td>\n<td>Yes<\/td>\n<td>n.a.<\/td>\n<\/tr>\n<tr>\n<td>GDI+<\/td>\n<td>No<\/td>\n<td>n.a.<\/td>\n<\/tr>\n<tr>\n<td>Aggpas<\/td>\n<td>Yes<\/td>\n<td>Yes<\/td>\n<\/tr>\n<tr>\n<td>FMX canvas<\/td>\n<td>n.a.<\/td>\n<td>No<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><em>The standard SVG render context for VCL is &#8220;Direct2D&#8221;, for FMX the standard is &#8220;FMX canvas&#8221;. You can overrule the stanard render context in the SVG control package by setting compiler directives in the &#8220;CompilerSettings.inc&#8221; file.<\/em><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Improved parsing speed for pathdata<\/strong><\/p>\n<p>For testing the parsing speed I use an SVG graphic with a very large amount of path elements: the\u00a0<a href=\"https:\/\/openclipart.org\/detail\/250855\/medium-poly-rose-breasted-groesbeck\">Rose-Breasted-Groesbeck.svg<\/a>. This SVG graphic has 36832 path elements.<\/p>\n<p><a href=\"http:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/Rose_breasted_groesbeck.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-524\" src=\"http:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/Rose_breasted_groesbeck-300x240.png\" alt=\"\" width=\"300\" height=\"240\" srcset=\"https:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/Rose_breasted_groesbeck-300x240.png 300w, https:\/\/www.bverhue.nl\/delphisvg\/wp-content\/uploads\/2018\/06\/Rose_breasted_groesbeck.png 548w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<table>\n<tbody>\n<tr>\n<td><\/td>\n<td>Update 10<\/td>\n<td>Update 11<\/td>\n<\/tr>\n<tr>\n<td>Parsing time in ms<\/td>\n<td>8703<\/td>\n<td>5766<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here are a couple of things that are new or improved in update 11. For a full list, see the change log. Added &#8220;AspectRatioAlign&#8221; and &#8220;AspectRatioMeetOrSlice&#8221; to SVG controls It was already possible to automatically add a viebox to SVG graphics that don&#8217;t have one defined with the property &#8220;AutoViewbox&#8221;. I have now added the &#8230; <a title=\"v2.20 update 11\" class=\"read-more\" href=\"https:\/\/www.bverhue.nl\/delphisvg\/2018\/06\/28\/v2-20-update-11\/\" aria-label=\"Read more about v2.20 update 11\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":514,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-517","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.bverhue.nl\/delphisvg\/wp-json\/wp\/v2\/posts\/517","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bverhue.nl\/delphisvg\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bverhue.nl\/delphisvg\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bverhue.nl\/delphisvg\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bverhue.nl\/delphisvg\/wp-json\/wp\/v2\/comments?post=517"}],"version-history":[{"count":17,"href":"https:\/\/www.bverhue.nl\/delphisvg\/wp-json\/wp\/v2\/posts\/517\/revisions"}],"predecessor-version":[{"id":672,"href":"https:\/\/www.bverhue.nl\/delphisvg\/wp-json\/wp\/v2\/posts\/517\/revisions\/672"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bverhue.nl\/delphisvg\/wp-json\/wp\/v2\/media\/514"}],"wp:attachment":[{"href":"https:\/\/www.bverhue.nl\/delphisvg\/wp-json\/wp\/v2\/media?parent=517"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bverhue.nl\/delphisvg\/wp-json\/wp\/v2\/categories?post=517"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bverhue.nl\/delphisvg\/wp-json\/wp\/v2\/tags?post=517"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}