UI: Allow Theme Coloring for Color SVG Extraction

For the times we need to obtain the bitmap of an SVG icon, send these
through the new theme coloring callback if they are multi-color. This
removes some code duplication by adding a new function that gets an
imBuf from SVG Icon. This allows, for "About" logo, Dialog icons, and
file system icons the optional ability to use a single SVG source file
that works as both monochrome (themed by text color) or multicolor with
internal parts themed.

Pull Request: https://projects.blender.org/blender/blender/pulls/126215
This commit is contained in:
Harley Acheson
2024-08-13 03:31:43 +02:00
committed by Harley Acheson
parent ddc9f92777
commit 99a4bc325e
13 changed files with 71 additions and 49 deletions

View File

@@ -1 +1 @@
<svg id="svg12" height="1600" viewBox="0 0 5780 1599.9999" width="5780" xmlns="http://www.w3.org/2000/svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"><sodipodi:namedview pagecolor="#303030" showgrid="true"><inkscape:grid id="grid5" units="px" spacingx="100" spacingy="100" color="#4772b3" opacity="0.2" visible="true" /></sodipodi:namedview><g fill="#fff"><path id="text10" d="m2258.6147 768.86279q0 8.74024-6.2011 14.94141-6.1768 6.17676-14.917 6.17676-8.7403 0-14.9414-6.17676-6.1768-6.20117-6.1768-14.94141 0-8.74023 6.1768-14.91699 6.2011-6.20117 14.9414-6.20117 8.7402 0 14.917 6.20117 6.2011 6.17676 6.2011 14.91699zm-4.6386 0q0-6.81152-4.834-11.69433-4.8096-4.90723-11.6211-4.90723-6.8115 0-11.6455 4.90723-4.8096 4.88281-4.8096 11.69433 0 6.81153 4.8096 11.71875 4.834 4.88282 11.6455 4.88282 6.8115 0 11.6211-4.88282 4.834-4.90722 4.834-11.71875zm-4.6143 10.00977h-6.6162l-6.3721-7.71485h-2.0996v7.71485h-5.1758v-21.02051h7.9834q2.2217 0 3.5645.1709 1.3428.1709 2.6611.87891 1.4405.80566 2.0996 1.95312.6836 1.14746.6836 2.85645 0 2.29492-1.2939 3.78418-1.294 1.48925-3.3692 2.31933zm-9.0332-14.77051q0-.65918-.293-1.19629-.2685-.56152-.9277-.90332-.6103-.3418-1.416-.41504-.7813-.0977-1.7822-.0977h-1.6358v5.93261h1.2451q1.294 0 2.2217-.1709.9278-.19531 1.4893-.63476.5615-.41504.8301-1.02539.2685-.61035.2685-1.48926z" transform="matrix(3.1163629 0 0 3.1163604 -1352.9709 -1732.2538)"/><g transform="matrix(30.525434 0 0 30.52541 -6419.8918 11070.755)"><path id="path10" d="m378.806-323.943v-14.405h4.825v.89c1.445-1.74 2.974-2.606 4.713-2.606.345 0 .779.056 1.356.113v4.107c-.465-.061-.983-.061-1.533-.061-2.805 0-4.536 1.85-4.536 4.996v6.966z"/><path id="path4" d="m364.467-333.746c.171-1.908 1.646-3.118 3.899-3.118 2.256 0 3.73 1.21 3.901 3.118zm7.569 4.711c-.577 1.414-1.937 2.251-3.784 2.251-2.313 0-3.87-1.444-3.933-3.725h13.297v-.671c0-5.714-3.354-8.925-9.364-8.925-5.836 0-9.365 3.241-9.365 8.324 0 5.114 3.584 8.35 9.365 8.35 3.469 0 6.159-1.189 7.817-3.279z"/><path id="path8" d="m352.876-331.538c0 2.685-1.794 4.446-4.57 4.446-2.778 0-4.572-1.701-4.572-4.415 0-2.754 1.77-4.454 4.572-4.454 2.776 0 4.57 1.73 4.57 4.423zm0-6.157c-1.219-1.307-2.983-2.024-5.435-2.024-5.29 0-8.902 3.262-8.902 8.151 0 4.793 3.587 8.146 8.815 8.146 2.397 0 4.157-.606 5.522-1.965v1.444h4.825v-20.861l-4.825 1.244z"/><path id="path7" d="m319.81-338.348h4.822v1.168c1.707-1.822 3.757-2.743 6.069-2.743 2.663 0 4.679.921 5.72 2.489.869 1.295.926 2.858.926 4.912v8.579h-4.829v-7.538c0-3.128-.629-4.572-3.375-4.572-2.775 0-4.511 1.653-4.511 4.428v7.682h-4.822z"/><path id="path5" d="m305.468-333.737c.176-1.908 1.651-3.118 3.906-3.118 2.252 0 3.726 1.21 3.899 3.118zm7.574 4.711c-.578 1.418-1.937 2.255-3.788 2.255-2.309 0-3.87-1.448-3.931-3.73h13.294v-.667c0-5.717-3.353-8.929-9.363-8.929-5.839 0-9.361 3.242-9.361 8.325 0 5.114 3.582 8.35 9.361 8.35 3.468 0 6.16-1.185 7.821-3.278z"/></g><path id="path6" d="m262.6971779-382.7926808h12.7747431v52.26322172h-12.7747431z" stroke-width="2.66418" transform="matrix(11.457722 0 0 11.457713 -458.1641 4969.374)"/><path id="path9" d="m282.947-335.961c2.804 0 4.567 1.7 4.567 4.454 0 2.714-1.791 4.415-4.567 4.415-2.774 0-4.566-1.761-4.566-4.446 0-2.693 1.792-4.423 4.566-4.423zm-4.566-7.599-4.827-1.244v20.861h4.827v-1.444c1.358 1.359 3.121 1.965 5.52 1.965 5.231 0 8.813-3.353 8.813-8.146 0-4.889-3.613-8.151-8.9-8.151-2.457 0-4.22.717-5.433 2.024z" transform="matrix(30.525434 0 0 30.52541 -6419.8918 11070.755)"/><path id="path2" d="m243.13-333.715c.106-1.891 1.032-3.557 2.429-4.738 1.37-1.16 3.214-1.869 5.226-1.869 2.01 0 3.854.709 5.225 1.869 1.396 1.181 2.322 2.847 2.429 4.736.106 1.943-.675 3.748-2.045 5.086-1.397 1.361-3.384 2.215-5.609 2.215s-4.216-.854-5.612-2.215c-1.371-1.338-2.15-3.143-2.043-5.084z" transform="matrix(30.525434 0 0 30.52541 -6419.8918 11070.755)"/><path id="path3" d="m230.94-329.894c.013.74.249 2.178.603 3.301.744 2.377 2.006 4.576 3.762 6.514 1.802 1.992 4.021 3.592 6.584 4.728 2.694 1.193 5.613 1.801 8.645 1.796 3.027-.004 5.946-.624 8.64-1.826 2.563-1.147 4.78-2.754 6.579-4.747 1.755-1.946 3.015-4.149 3.761-6.526.375-1.201.612-2.42.707-3.643.093-1.205.054-2.412-.117-3.618-.334-2.35-1.147-4.555-2.399-6.565-1.145-1.847-2.621-3.464-4.376-4.825l.004-.003-17.711-13.599c-.016-.012-.029-.025-.046-.036-1.162-.892-3.116-.889-4.394.005-1.292.904-1.44 2.399-.29 3.342l-.005.005 7.387 6.007-22.515.024h-.03c-1.861.002-3.65 1.223-4.004 2.766-.364 1.572.9 2.876 2.835 2.883l-.003.007 11.412-.022-20.364 15.631c-.026.019-.054.039-.078.058-1.921 1.471-2.542 3.917-1.332 5.465 1.228 1.574 3.839 1.577 5.78.009l11.114-9.096s-.162 1.228-.149 1.965zm28.559 4.112c-2.29 2.333-5.496 3.656-8.965 3.663-3.474.006-6.68-1.305-8.97-3.634-1.119-1.135-1.941-2.441-2.448-3.832-.497-1.367-.69-2.818-.562-4.282.121-1.431.547-2.796 1.227-4.031.668-1.214 1.588-2.311 2.724-3.239 2.226-1.814 5.06-2.796 8.024-2.8 2.967-.004 5.799.969 8.027 2.777 1.134.924 2.053 2.017 2.721 3.229.683 1.234 1.106 2.594 1.232 4.029.126 1.462-.067 2.911-.564 4.279-.508 1.395-1.327 2.701-2.446 3.841z" transform="matrix(30.525434 0 0 30.52541 -6419.8918 11070.755)"/></g></svg>
<svg id="svg13" clip-rule="evenodd" fill-rule="evenodd" height="1600" stroke-linejoin="round" stroke-miterlimit="1.41421" viewBox="0 0 5236.3638 1600" width="5236.3638" xmlns="http://www.w3.org/2000/svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"><sodipodi:namedview pagecolor="#303030" showgrid="true"><inkscape:grid id="grid5" units="px" spacingx="100" spacingy="100" color="#4772b3" opacity="0.2" visible="true" /></sodipodi:namedview><g id="blender_logo_socket" clip-rule="evenodd" fill="none" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.41421" transform="matrix(2.8213013 0 0 2.9510891 -223.57633 -1941.9237)"><g id="blender.white" fill="none"><path id="path1" clip-rule="evenodd" d="m387.513-348.729s-117.336 0-120.645 0c-.074-.057-.141-.126-.212-.181-.018-.017-17.749-13.638-18.282-14.05-.031-.023-.061-.046-.061-.046-2.841-2.175-7.061-2.221-10.052-.125-1.871 1.309-2.995 3.289-3.079 5.431-.002.085-.007.171-.007.258 0 1.111.295 2.184.828 3.148-5.49.005-11.012.011-11.012.011-4.118.003-7.842 2.781-8.692 6.462-.121.528-.182 1.06-.182 1.588 0 1.54.512 3.033 1.481 4.259 1.091 1.371 2.665 2.294 4.461 2.654-5.187 3.983-10.37 7.96-10.375 7.965-.037.027-.067.052-.093.069-2.08 1.598-3.45 3.912-3.76 6.348-.046.357-.068.711-.068 1.062 0 1.754.56 3.422 1.622 4.785 1.293 1.654 3.201 2.704 5.374 2.951 2.49.288 5.11-.51 7.183-2.186.013-.01 2.58-2.115 5.287-4.329.993 2.397 2.386 4.619 4.186 6.606 2.316 2.559 5.131 4.581 8.362 6.011 3.396 1.505 7.035 2.265 10.817 2.256 3.785-.007 7.422-.776 10.813-2.29 3.238-1.449 6.047-3.478 8.354-6.033.339-.378.651-.776.963-1.176h116.789c9.226 0 16.723-7.053 16.723-15.722 0-8.671-7.497-15.726-16.723-15.726z" stroke-linejoin="round" stroke-miterlimit="1.41421" transform="matrix(9.3753293 0 0 8.9629942 -1861.0917 3942.8175)"/></g><g><g id="blender.logo_blue" fill="#ffffff"><path id="text10" clip-rule="evenodd" d="m2258.6147 768.86279q0 8.74024-6.2011 14.94141-6.1768 6.17676-14.917 6.17676-8.7403 0-14.9414-6.17676-6.1768-6.20117-6.1768-14.94141 0-8.74023 6.1768-14.91699 6.2011-6.20117 14.9414-6.20117 8.7402 0 14.917 6.20117 6.2011 6.17676 6.2011 14.91699zm-4.6386 0q0-6.81152-4.834-11.69433-4.8096-4.90723-11.6211-4.90723-6.8115 0-11.6455 4.90723-4.8096 4.88281-4.8096 11.69433 0 6.81153 4.8096 11.71875 4.834 4.88282 11.6455 4.88282 6.8115 0 11.6211-4.88282 4.834-4.90722 4.834-11.71875zm-4.6143 10.00977h-6.6162l-6.3721-7.71485h-2.0996v7.71485h-5.1758v-21.02051h7.9834q2.2217 0 3.5645.1709 1.3428.1709 2.6611.87891 1.4405.80566 2.0996 1.95312.6836 1.14746.6836 2.85645 0 2.29492-1.2939 3.78418-1.294 1.48925-3.3692 2.31933zm-9.0332-14.77051q0-.65918-.293-1.19629-.2685-.56152-.9277-.90332-.6103-.3418-1.416-.41504-.7813-.0977-1.7822-.0977h-1.6358v5.93261h1.2451q1.294 0 2.2217-.1709.9278-.19531 1.4893-.63476.5615-.41504.8301-1.02539.2685-.61035.2685-1.48926z" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.41421" transform="matrix(.95713393 0 0 .91503835 -304.87922 183.54967)"/><g fill-rule="nonzero" transform="matrix(9.3753293 0 0 8.9629942 -1861.0917 3942.8175)"><path id="rect5" d="m273.55408-344.804v20.86091h4.82696v-1.44383c1.358 1.359 3.12105 1.96489 5.52005 1.96489 5.23098 0 8.81285-3.35302 8.81285-8.146 0-4.889-3.61295-8.15095-8.89995-8.15095-2.45698 0-4.21995.71703-5.43295 2.02403v-5.865zm84.14695 0-4.82502 1.24405v5.865c-1.219-1.307-2.98311-2.02403-5.43511-2.02403-5.28998 0-8.90188 3.26195-8.90188 8.15095 0 4.79298 3.58702 8.146 8.815 8.146 2.397 0 4.15699-.60589 5.52199-1.96489v1.44383h4.82502zm-63.79401 1.24405v19.61686h4.79491v-19.61686zm74.34487 3.45496c-5.83598 0-9.36488 3.24108-9.36488 8.32406 0 5.114 3.5839 8.34987 9.36488 8.34987 3.469 0 6.15919-1.18905 7.81719-3.27905l-4.033-2.32488c-.577 1.414-1.93719 2.25091-3.78419 2.25091-2.313 0-3.86978-1.44384-3.93278-3.72484h13.2968v-.67117c0-5.71398-3.35402-8.9249-9.36402-8.9249zm-58.9978.008c-5.83898 0-9.36101 3.24215-9.36101 8.32513 0 5.114 3.58203 8.34987 9.36101 8.34987 3.468 0 6.15984-1.18497 7.82084-3.27797l-4.033-2.32595c-.578 1.418-1.93684 2.25499-3.78784 2.25499-2.309 0-3.87006-1.44802-3.93106-3.73h13.29401v-.66708c0-5.717-3.35297-8.92899-9.36295-8.92899zm79.08989.0331c-1.739 0-3.26798.86595-4.71298 2.60595v-.89008h-4.82502v14.40496h4.82502v-6.96582c0-3.146 1.73101-4.99599 4.53599-4.99599.55 0 1.06808-.00014 1.53308.0609v-4.10698c-.577-.057-1.01109-.1129-1.35609-.1129zm-57.64301.14086c-2.31198 0-4.36206.92115-6.06906 2.74315v-1.16814h-4.82201v14.40496h4.82201v-7.68193c0-2.775 1.73605-4.42804 4.51105-4.42804 2.74598 0 3.37495 1.44414 3.37495 4.57212v7.53785h4.8291v-8.57889c0-2.054-.057-3.61712-.92599-4.91212-1.041-1.568-3.05705-2.48896-5.72005-2.48896zm37.66511 3.05905c2.256 0 3.72996 1.20998 3.90096 3.11798h-7.79998c.171-1.908 1.64604-3.11798 3.89902-3.11798zm-58.99199.009c2.25198 0 3.72582 1.20998 3.8988 3.11798h-7.80492c.176-1.908 1.65112-3.11798 3.90612-3.11798zm-26.42717.89396c2.804 0 4.56718 1.70008 4.56718 4.45406 0 2.714-1.79118 4.41493-4.56718 4.41493-2.774 0-4.56588-1.76091-4.56588-4.44589 0-2.693 1.79188-4.4231 4.56588-4.4231zm65.35912 0c2.776 0 4.56997 1.7301 4.56997 4.4231 0 2.68498-1.79397 4.44589-4.56997 4.44589-2.778 0-4.57212-1.70093-4.57212-4.41493 0-2.75398 1.77012-4.45406 4.57212-4.45406z"/><path id="path2" clip-rule="evenodd" d="m243.13-333.715c.106-1.891 1.032-3.557 2.429-4.738 1.37-1.16 3.214-1.869 5.226-1.869 2.01 0 3.854.709 5.225 1.869 1.396 1.181 2.322 2.847 2.429 4.736.106 1.943-.675 3.748-2.045 5.086-1.397 1.361-3.384 2.215-5.609 2.215s-4.216-.854-5.612-2.215c-1.371-1.338-2.15-3.143-2.043-5.084z" stroke-linejoin="round" stroke-miterlimit="1.41421"/></g></g><g id="blender.logo_orange" fill="#ffffff"><path id="path3" clip-rule="evenodd" d="m230.94-329.894c.013.74.249 2.178.603 3.301.744 2.377 2.006 4.576 3.762 6.514 1.802 1.992 4.021 3.592 6.584 4.728 2.694 1.193 5.613 1.801 8.645 1.796 3.027-.004 5.946-.624 8.64-1.826 2.563-1.147 4.78-2.754 6.579-4.747 1.755-1.946 3.015-4.149 3.761-6.526.375-1.201.612-2.42.707-3.643.093-1.205.054-2.412-.117-3.618-.334-2.35-1.147-4.555-2.399-6.565-1.145-1.847-2.621-3.464-4.376-4.825l.004-.003-17.711-13.599c-.016-.012-.029-.025-.046-.036-1.162-.892-3.116-.889-4.394.005-1.292.904-1.44 2.399-.29 3.342l-.005.005 7.387 6.007-22.515.024c-.011 0-.022 0-.03 0-1.861.002-3.65 1.223-4.004 2.766-.364 1.572.9 2.876 2.835 2.883l-.003.007 11.412-.022-20.364 15.631c-.026.019-.054.039-.078.058-1.921 1.471-2.542 3.917-1.332 5.465 1.228 1.574 3.839 1.577 5.78.009l11.114-9.096s-.162 1.228-.149 1.965zm28.559 4.112c-2.29 2.333-5.496 3.656-8.965 3.663-3.474.006-6.68-1.305-8.97-3.634-1.119-1.135-1.941-2.441-2.448-3.832-.497-1.367-.69-2.818-.562-4.282.121-1.431.547-2.796 1.227-4.031.668-1.214 1.588-2.311 2.724-3.239 2.226-1.814 5.06-2.796 8.024-2.8 2.967-.004 5.799.969 8.027 2.777 1.134.924 2.053 2.017 2.721 3.229.683 1.234 1.106 2.594 1.232 4.029.126 1.462-.067 2.911-.564 4.279-.508 1.395-1.327 2.701-2.446 3.841z" fill-rule="nonzero" stroke-linejoin="round" stroke-miterlimit="1.41421" transform="matrix(9.3753293 0 0 8.9629942 -1861.0917 3942.8175)"/></g></g></g></svg>

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

@@ -1 +1 @@
<svg id="svg5" height="1600" viewBox="0 0 1600 1599.9999" width="1600" xmlns="http://www.w3.org/2000/svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"><sodipodi:namedview pagecolor="#303030" showgrid="true"><inkscape:grid id="grid5" units="px" spacingx="100" spacingy="100" color="#4772b3" opacity="0.2" visible="true" /></sodipodi:namedview><g transform="matrix(26.923423 0 0 26.923423 -3507.7961 -61.577)"><g id="g4" fill="none" fill-rule="evenodd"><path id="path2" d="m186 22.059c0-.531-.211-1.039-.586-1.414l-14.059-14.059c-.375-.375-.883-.586-1.414-.586h-19.882c-.531 0-1.039.211-1.414.586l-14.059 14.059c-.375.375-.586.883-.586 1.414v19.882c0 .531.211 1.039.586 1.414l14.059 14.059c.375.375.883.586 1.414.586h19.882c.531 0 1.039-.211 1.414-.586l14.059-14.059c.375-.375.586-.883.586-1.414zm-3 .828c0-.265-.105-.519-.293-.707l-12.887-12.887c-.188-.188-.442-.293-.707-.293h-18.226c-.265 0-.519.105-.707.293l-12.887 12.887c-.188.188-.293.442-.293.707v18.226c0 .265.105.519.293.707l12.887 12.887c.188.188.442.293.707.293h18.226c.265 0 .519-.105.707-.293l12.887-12.887c.188-.188.293-.442.293-.707z" fill="#fff"/></g><path id="path3" d="m150.10053 19.686508c-.256 0-.51202.097496-.70752.292496l-1.41403 1.414022c-.39.390999-.39 1.023965 0 1.414965l9.19202 9.192013-9.19202 9.192014c-.39.391-.39 1.023965 0 1.414965l1.41403 1.414022c.391.39 1.02396.39 1.41496 0l9.19201-9.192013 9.19202 9.192013c.391.39 1.02404.39 1.41504 0l1.41395-1.414022c.39-.391.39-1.023965 0-1.414965l-9.19202-9.192014 9.19202-9.192013c.39-.391.39-1.023966 0-1.414965l-1.41395-1.414022c-.391-.39-1.02404-.39-1.41504 0l-9.19202 9.192013-9.19201-9.192013c-.1955-.195-.45145-.292496-.70744-.292496z" fill="#fff"/></g></svg>
<svg id="svg5" height="1600" viewBox="0 0 1600 1599.9999" width="1600" xmlns="http://www.w3.org/2000/svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"><sodipodi:namedview pagecolor="#303030" showgrid="true"><inkscape:grid id="grid5" units="px" spacingx="100" spacingy="100" color="#4772b3" opacity="0.2" visible="true" /></sodipodi:namedview><g transform="matrix(26.923423 0 0 26.923423 -3507.7961 -61.577)"><g id="blender.error" fill="none"><path id="path1" d="m183.05322 22.7471c0-.270966-.10532-.530681-.2939-.722911l-12.92693-13.1769239c-.18857-.1922299-.44337-.2995889-.70919-.2995889h-18.28246c-.26582 0-.52061.107359-.70919.2995889l-12.92692 13.1769239c-.18859.19223-.29391.451945-.29391.722911v18.636029c0 .270964.10532.53068.29391.722909l12.92692 13.176912c.18858.192231.44337.299601.70919.299601h18.28246c.26582 0 .52062-.10737.70919-.299601l12.92693-13.176912c.18858-.192229.2939-.451945.2939-.722909z" stroke-width=".037616"/></g><g id="blender.text" fill="#ffffff" fill-rule="evenodd"><path id="path3" d="m150.10053 19.686508c-.256 0-.51202.097496-.70752.292496l-1.41403 1.414022c-.39.390999-.39 1.023965 0 1.414965l9.19202 9.192013-9.19202 9.192014c-.39.391-.39 1.023965 0 1.414965l1.41403 1.414022c.391.39 1.02396.39 1.41496 0l9.19201-9.192013 9.19202 9.192013c.391.39 1.02404.39 1.41504 0l1.41395-1.414022c.39-.391.39-1.023965 0-1.414965l-9.19202-9.192014 9.19202-9.192013c.39-.391.39-1.023966 0-1.414965l-1.41395-1.414022c-.391-.39-1.02404-.39-1.41504 0l-9.19202 9.192013-9.19201-9.192013c-.1955-.195-.45145-.292496-.70744-.292496z"/><path id="path2" d="m186 22.059c0-.531-.211-1.039-.586-1.414l-14.059-14.059c-.375-.375-.883-.586-1.414-.586h-19.882c-.531 0-1.039.211-1.414.586l-14.059 14.059c-.375.375-.586.883-.586 1.414v19.882c0 .531.211 1.039.586 1.414l14.059 14.059c.375.375.883.586 1.414.586h19.882c.531 0 1.039-.211 1.414-.586l14.059-14.059c.375-.375.586-.883.586-1.414zm-3 .828c0-.265-.105-.519-.293-.707l-12.887-12.887c-.188-.188-.442-.293-.707-.293h-18.226c-.265 0-.519.105-.707.293l-12.887 12.887c-.188.188-.293.442-.293.707v18.226c0 .265.105.519.293.707l12.887 12.887c.188.188.442.293.707.293h18.226c.265 0 .519-.105.707-.293l12.887-12.887c.188-.188.293-.442.293-.707z"/></g></g></svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -1 +1 @@
<svg id="svg4" height="1600" viewBox="0 0 1600 1599.9999" width="1600" xmlns="http://www.w3.org/2000/svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"><sodipodi:namedview pagecolor="#303030" showgrid="true"><inkscape:grid id="grid5" units="px" spacingx="100" spacingy="100" color="#4772b3" opacity="0.2" visible="true" /></sodipodi:namedview><g fill="#fff" transform="matrix(26.915787 0 0 26.915787 -5229.2863 -61.278)"><g id="g3" fill-rule="evenodd"><path id="path2" d="m224 6c14.35 0 26 11.65 26 26s-11.65 26-26 26-26-11.65-26-26 11.65-26 26-26zm0 3c12.694 0 23 10.306 23 23s-10.306 23-23 23-23-10.306-23-23 10.306-23 23-23z"/></g><path id="ellipse3" d="m230 21a3.5 3 0 0 1 -3.5 3 3.5 3 0 0 1 -3.5-3 3.5 3 0 0 1 3.5-3 3.5 3 0 0 1 3.5 3z"/><path id="path3" d="m217.675 29.977.232-1.395s2.519-1.582 5.587-1.582c3.067 0 4.005 1.542 4.005 3.758 0 3.17-2.242 7.836-2.242 10.262 0 1.379.725 1.645 1.861 1.645.945 0 1.921-.136 2.367-.57l-.492 1.602s-2.626 1.303-5.207 1.303c-3.241 0-4.297-1.5-4.28-3.758.018-2.4 2.249-7.276 2.249-10.099 0-1.734-1.269-1.641-1.917-1.641-1.32 0-2.163.475-2.163.475z"/></g></svg>
<svg id="svg4" height="1600" viewBox="0 0 1600 1599.9999" width="1600" xmlns="http://www.w3.org/2000/svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"><sodipodi:namedview pagecolor="#303030" showgrid="true"><inkscape:grid id="grid5" units="px" spacingx="100" spacingy="100" color="#4772b3" opacity="0.2" visible="true" /></sodipodi:namedview><g transform="matrix(26.915787 0 0 26.915787 -5229.2863 -61.278)"><g id="blender.info" fill="none"><path id="path1" d="m795.10098 164.2357c346.73982 0 628.25092 284.75466 628.25092 635.48747 0 350.73493-281.5111 635.48943-628.25092 635.48943-346.73777 0-628.2489-284.7545-628.2489-635.48943 0-350.73281 281.51113-635.48747 628.2489-635.48747z" fill="none" stroke-width="1.02068" transform="matrix(.03715292 0 0 .03715292 194.28324 2.276656)"/></g><g id="blender.text" fill="#ffffff" fill-rule="evenodd"><path id="ellipse3" d="m226.49997 18.000032a3.5 3 0 0 0 -3.49999 2.999953 3.5 3 0 0 0 3.49999 3.000026 3.5 3 0 0 0 3.49999-3.000026 3.5 3 0 0 0 -3.49999-2.999953zm-3.00597 9.000004c-3.068 0-5.58702 1.581974-5.58702 1.581974l-.23199 1.394976s.843-.475006 2.163-.475006c.648 0 1.917-.092957 1.917 1.641042 0 2.822997-2.23098 7.698992-2.24898 10.09899-.017 2.257997 1.03899 3.757959 4.27998 3.757959 2.581 0 5.207-1.302964 5.207-1.302964l.49199-1.602002c-.446.434-1.42198.569992-2.36698.569992-1.136 0-1.86098-.266033-1.86098-1.645032 0-2.425998 2.24202-7.091973 2.24202-10.261969 0-2.215998-.93805-3.75796-4.00504-3.75796z"/><path id="path2" d="m224 6c14.35 0 26 11.65 26 26s-11.65 26-26 26-26-11.65-26-26 11.65-26 26-26zm0 3c12.694 0 23 10.306 23 23s-10.306 23-23 23-23-10.306-23-23 10.306-23 23-23z"/></g></g></svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -1 +1 @@
<svg id="svg4" height="1600" viewBox="0 0 1600 1599.9999" width="1600" xmlns="http://www.w3.org/2000/svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"><sodipodi:namedview pagecolor="#303030" showgrid="true"><inkscape:grid id="grid5" units="px" spacingx="100" spacingy="100" color="#4772b3" opacity="0.2" visible="true" /></sodipodi:namedview><g fill="#fff" transform="matrix(26.924199 0 0 26.917795 -1784.6771 -61.216)"><g id="g3" fill-rule="evenodd"><path id="path2" d="m96 6c14.35 0 26 11.65 26 26s-11.65 26-26 26-26-11.65-26-26 11.65-26 26-26zm0 3c12.694 0 23 10.306 23 23s-10.306 23-23 23-23-10.306-23-23 10.306-23 23-23z"/></g><path id="circle2" d="m99 44a3 3 0 0 1 -3 3 3 3 0 0 1 -3-3 3 3 0 0 1 3-3 3 3 0 0 1 3 3z"/><path id="path3" d="m90.549 23.479-1.513-3.293c-.002-.011 3.28-2.209 7.964-2.186 3.557.018 5.213 1.34 5.855 1.849 1.185.939 2.131 2.714 2.131 5.105 0 .741-.095 1.683-.424 2.567-.292.787-.706 1.528-1.226 2.142-.883 1.042-2.347 2.273-2.825 2.656-.477.382-1.73 1.348-2.411 2.341-.48.7-.6 1.743-.6 2.485v.855h-3.5v-1.236c0-.269.032-2.339.716-3.511.709-1.212 1.371-1.885 2.599-2.906 1.204-1.002 2.275-1.967 2.841-2.814.54-.81.637-1.629.637-2.399s-.167-1.716-1.036-2.482c-.797-.702-2.36-.865-3.257-.865-1.083 0-1.867.158-2.99.526-1.448.475-2.961 1.166-2.961 1.166z"/></g></svg>
<svg id="svg4" height="1600" viewBox="0 0 1600 1599.9999" width="1600" xmlns="http://www.w3.org/2000/svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"><sodipodi:namedview pagecolor="#303030" showgrid="true"><inkscape:grid id="grid5" units="px" spacingx="100" spacingy="100" color="#4772b3" opacity="0.2" visible="true" /></sodipodi:namedview><g id="blender.info" fill="none"><path id="path1" d="m799.78455 179.90086c342.43575 0 620.55515 277.73924 620.55515 620.0115 0 342.27234-278.1194 620.50664-620.55515 620.50664-342.43441 0-620.16037-278.2343-620.16037-620.50664 0-342.27226 277.72596-620.0115 620.16037-620.0115z" stroke-width="1.00181"/></g><g id="blender.text" fill="#ffffff" fill-rule="evenodd" transform="matrix(26.924199 0 0 26.917795 -1784.6771 -61.216)"><path id="path3" d="m90.549 23.479-1.513-3.293c-.002-.011 3.28-2.209 7.964-2.186 3.557.018 5.213 1.34 5.855 1.849 1.185.939 2.131 2.714 2.131 5.105 0 .741-.095 1.683-.424 2.567-.292.787-.706 1.528-1.226 2.142-.883 1.042-2.347 2.273-2.825 2.656-.477.382-1.73 1.348-2.411 2.341-.48.7-.6 1.743-.6 2.485v.855h-3.5v-1.236c0-.269.032-2.339.716-3.511.709-1.212 1.371-1.885 2.599-2.906 1.204-1.002 2.275-1.967 2.841-2.814.54-.81.637-1.629.637-2.399s-.167-1.716-1.036-2.482c-.797-.702-2.36-.865-3.257-.865-1.083 0-1.867.158-2.99.526-1.448.475-2.961 1.166-2.961 1.166z"/><path id="circle2" d="m99 44a3 3 0 0 1 -3 3 3 3 0 0 1 -3-3 3 3 0 0 1 3-3 3 3 0 0 1 3 3z"/><path id="path2" d="m96 6c14.35 0 26 11.65 26 26s-11.65 26-26 26-26-11.65-26-26 11.65-26 26-26zm0 3c12.694 0 23 10.306 23 23s-10.306 23-23 23-23-10.306-23-23 10.306-23 23-23z"/></g></svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -1 +1 @@
<svg id="svg4" height="1600" viewBox="0 0 1745 1599.9999" width="1745" xmlns="http://www.w3.org/2000/svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"><sodipodi:namedview pagecolor="#303030" showgrid="true"><inkscape:grid id="grid5" units="px" spacingx="100" spacingy="100" color="#4772b3" opacity="0.2" visible="true" /></sodipodi:namedview><g id="g3" fill="#f9f9f9" fill-rule="evenodd" transform="matrix(28.565059 0 0 28.565059 -42.7349 -99.745)"><path id="path2" d="m37.212 10.038c-1.066-1.878-3.059-3.038-5.218-3.038s-4.152 1.16-5.218 3.038l-21 37c-1.054 1.858-1.042 4.135.033 5.981s3.049 2.981 5.185 2.981h42c2.136 0 4.11-1.135 5.185-2.981s1.087-4.123.033-5.981zm-2.609 1.481 21 37c.527.929.521 2.068-.016 2.991-.538.922-1.525 1.49-2.593 1.49h-42c-1.068 0-2.055-.568-2.593-1.49-.537-.923-.543-2.062-.016-2.991 0 0 21-37 21-37 .533-.939 1.529-1.519 2.609-1.519s2.076.58 2.609 1.519z"/></g><g fill="#fff"><circle id="circle2" cx="871.346988" cy="1199.9651845" r="71.4126475" stroke-width="28.565059"/><path id="path3" d="m32 23c1.38 0 2.5 1.12 2.5 2.5l-1.5 14.5h-2l-1.5-14.5c0-1.38 1.12-2.5 2.5-2.5z" transform="matrix(28.565059 0 0 28.565059 -42.7349 -99.745)"/></g></svg>
<svg id="svg4" height="1600" viewBox="0 0 1745 1599.9999" width="1745" xmlns="http://www.w3.org/2000/svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"><sodipodi:namedview pagecolor="#303030" showgrid="true"><inkscape:grid id="grid5" units="px" spacingx="100" spacingy="100" color="#4772b3" opacity="0.2" visible="true" /></sodipodi:namedview><g id="blender.warning" fill="none" fill-rule="evenodd" transform="matrix(28.565059 0 0 28.565059 -42.7349 -99.745)"><path id="path1" d="m946.53126 228.63836 606.91274 1069.96064c15.2306 26.8649 15.0571 59.802-.4624 86.4933-15.5485 26.6622-44.0732 43.0874-74.9393 43.0874h-1213.82607c-30.8656 0-59.39035-16.4252-74.93889-43.0874-15.51999-26.6913-15.69302-59.6284-.46246-86.4933l606.91279-1069.96064c15.40404-27.154 44.18921-43.92644 75.40179-43.92644 31.21257 0 59.99776 16.77244 75.4018 43.92644z" stroke-width="1.01205" transform="matrix(.0350078 0 0 .0350078 1.496055 3.491854)"/></g><g id="blender.text" fill="#ffffff"><path id="path2" d="m37.212 10.038c-1.066-1.878-3.059-3.038-5.218-3.038s-4.152 1.16-5.218 3.038l-21 37c-1.054 1.858-1.042 4.135.033 5.981s3.049 2.981 5.185 2.981h42c2.136 0 4.11-1.135 5.185-2.981s1.087-4.123.033-5.981zm-2.609 1.481 21 37c.527.929.521 2.068-.016 2.991-.538.922-1.525 1.49-2.593 1.49h-42c-1.068 0-2.055-.568-2.593-1.49-.537-.923-.543-2.062-.016-2.991l21-37c.533-.939 1.529-1.519 2.609-1.519s2.076.58 2.609 1.519z" transform="matrix(28.565059 0 0 28.565059 -42.7349 -99.745)"/><circle id="circle2" cx="871.346988" cy="1199.965185" r="71.412648" stroke-width="28.565059"/><path id="path3" d="m32 23c1.38 0 2.5 1.12 2.5 2.5l-1.5 14.5h-2l-1.5-14.5c0-1.38 1.12-2.5 2.5-2.5z" transform="matrix(28.565059 0 0 28.565059 -42.7349 -99.745)"/></g></svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -157,7 +157,12 @@ void BLF_draw_svg_icon(uint icon_id,
blender::FunctionRef<void(std::string &)> edit_source_cb = nullptr);
blender::Array<uchar> BLF_svg_icon_bitmap(
uint icon_id, float size, int *r_width, int *r_height, bool multicolor = false);
uint icon_id,
float size,
int *r_width,
int *r_height,
bool multicolor = false,
blender::FunctionRef<void(std::string &)> edit_source_cb = nullptr);
typedef bool (*BLF_GlyphBoundsFn)(const char *str,
size_t str_step_ofs,

View File

@@ -632,13 +632,17 @@ void BLF_draw_svg_icon(uint icon_id,
#endif /* WITH_HEADLESS */
}
blender::Array<uchar> BLF_svg_icon_bitmap(
uint icon_id, float size, int *r_width, int *r_height, bool multicolor)
blender::Array<uchar> BLF_svg_icon_bitmap(uint icon_id,
float size,
int *r_width,
int *r_height,
bool multicolor,
blender::FunctionRef<void(std::string &)> edit_source_cb)
{
#ifndef WITH_HEADLESS
FontBLF *font = global_font[0];
if (font) {
return blf_svg_icon_bitmap(font, icon_id, size, r_width, r_height, multicolor);
return blf_svg_icon_bitmap(font, icon_id, size, r_width, r_height, multicolor, edit_source_cb);
}
#else
UNUSED_VARS(icon_id, size, r_width, r_height, multicolor);

View File

@@ -571,12 +571,17 @@ void blf_draw_svg_icon(FontBLF *font,
blf_glyph_cache_release(font);
}
blender::Array<uchar> blf_svg_icon_bitmap(
FontBLF *font, uint icon_id, float size, int *r_width, int *r_height, bool multicolor)
blender::Array<uchar> blf_svg_icon_bitmap(FontBLF *font,
uint icon_id,
float size,
int *r_width,
int *r_height,
bool multicolor,
blender::FunctionRef<void(std::string &)> edit_source_cb)
{
blf_font_size(font, size);
GlyphCacheBLF *gc = blf_glyph_cache_acquire(font);
GlyphBLF *g = blf_glyph_ensure_icon(gc, icon_id, multicolor);
GlyphBLF *g = blf_glyph_ensure_icon(gc, icon_id, multicolor, edit_source_cb);
if (!g) {
blf_glyph_cache_release(font);

View File

@@ -112,7 +112,13 @@ void blf_draw_svg_icon(FontBLF *font,
blender::FunctionRef<void(std::string &)> edit_source_cb = nullptr);
blender::Array<uchar> blf_svg_icon_bitmap(
FontBLF *font, uint icon_id, float size, int *r_width, int *r_height, bool multicolor = false);
FontBLF *font,
uint icon_id,
float size,
int *r_width,
int *r_height,
bool multicolor = false,
blender::FunctionRef<void(std::string &)> edit_source_cb = nullptr);
blender::Vector<blender::StringRef> blf_font_string_wrap(FontBLF *font,
blender::StringRef str,

View File

@@ -98,6 +98,8 @@ void UI_icon_draw_ex(float x,
const IconTextOverlay *text_overlay,
const bool inverted = false);
ImBuf *UI_svg_icon_bitmap(uint icon_id, float size, bool multicolor = false);
void UI_icons_free();
void UI_icons_free_drawinfo(void *drawinfo);

View File

@@ -2005,6 +2005,38 @@ void UI_icon_draw_ex(float x,
inverted);
}
ImBuf *UI_svg_icon_bitmap(uint icon_id, float size, bool multicolor)
{
if (icon_id >= ICON_BLANK_LAST_SVG_ITEM) {
return nullptr;
}
ImBuf *ibuf = nullptr;
int width;
int height;
blender::Array<uchar> bitmap;
if (multicolor) {
bitmap = BLF_svg_icon_bitmap(icon_id, size, &width, &height, true, icon_source_edit_cb);
}
else {
bitmap = BLF_svg_icon_bitmap(icon_id, size, &width, &height, false, nullptr);
}
if (!bitmap.is_empty()) {
ibuf = IMB_allocFromBuffer(bitmap.data(), nullptr, width, height, 4);
}
if (ibuf) {
IMB_flipy(ibuf);
if (multicolor) {
IMB_premultiply_alpha(ibuf);
}
}
return ibuf;
}
void UI_icon_text_overlay_init_from_count(IconTextOverlay *text_overlay,
const int icon_indicator_number)
{
@@ -2025,8 +2057,6 @@ ImBuf *UI_icon_alert_imbuf_get(eAlertIcon icon, float size)
return nullptr;
#else
constexpr bool show_color = false;
int icon_id = ICON_NONE;
switch (icon) {
case ALERT_ICON_WARNING:
@@ -2049,17 +2079,6 @@ ImBuf *UI_icon_alert_imbuf_get(eAlertIcon icon, float size)
return nullptr;
}
int width;
int height;
blender::Array<uchar> bitmap = BLF_svg_icon_bitmap(icon_id, size, &width, &height, show_color);
if (bitmap.is_empty()) {
return nullptr;
}
ImBuf *ibuf = IMB_allocFromBuffer(bitmap.data(), nullptr, width, height, 4);
IMB_flipy(ibuf);
if (show_color) {
IMB_premultiply_alpha(ibuf);
}
return ibuf;
return UI_svg_icon_bitmap(icon_id, size, false);
#endif
}

View File

@@ -1134,15 +1134,7 @@ void filelist_setlibrary(FileList *filelist, const AssetLibraryReference *asset_
static ImBuf *fileimage_from_icon(int icon_id)
{
int width;
int height;
blender::Array<uchar> bitmap = BLF_svg_icon_bitmap(icon_id, 256.0f, &width, &height);
if (bitmap.is_empty()) {
return nullptr;
}
ImBuf *ibuf = IMB_allocFromBuffer(bitmap.data(), nullptr, width, height, 4);
IMB_flipy(ibuf);
return ibuf;
return UI_svg_icon_bitmap(icon_id, 256.0f, false);
}
void filelist_init_icons()

View File

@@ -314,21 +314,10 @@ static uiBlock *wm_block_about_create(bContext *C, ARegion *region, void * /*arg
#ifndef WITH_HEADLESS
float size = 0.2f * dialog_width;
ImBuf *ibuf = nullptr;
int width;
int height;
blender::Array<uchar> bitmap = BLF_svg_icon_bitmap(
ICON_BLENDER_LOGO_LARGE, size, &width, &height, show_color);
if (!bitmap.is_empty()) {
ibuf = IMB_allocFromBuffer(bitmap.data(), nullptr, width, height, 4);
}
ImBuf *ibuf = UI_svg_icon_bitmap(ICON_BLENDER_LOGO_LARGE, size, show_color);
if (ibuf) {
IMB_flipy(ibuf);
if (show_color) {
IMB_premultiply_alpha(ibuf);
}
bTheme *btheme = UI_GetTheme();
const uchar *color = btheme->tui.wcol_menu_back.text_sel;