It is currently March 29th, 2024, 3:00 pm

VectorConverter [V 0.1.3]

Skins that control functions in Windows or Rainmeter
User avatar
theAzack9
Developer
Posts: 522
Joined: March 2nd, 2016, 6:23 pm

Re: VectorConverter [V 0.1.2]

Post by theAzack9 »

eclectic-tech, fixed in the latest version :)

sephirotess i managed to make your svg run, but there are some visible artifacts and some parts that are not working. :/ there is too much code in the svg file for me to run through it all to narrow down that one little thing that doesn't work :/ if you manage to replicate it in a svg file that has smaller paths then i can look into it and fix it ;) Sorry for the inconvenience, but this tool is far from perfect :P (i hope to gradualy get it to be better)
I might try to trail through it if i find a few hours with nothing to do, but no promises :)

FreeRaider thanks and hehe ;)
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: VectorConverter [V 0.1.2]

Post by jsmorley »

With the latest VectorConverter_0.1.2.rmskin, this one used to work but now I get:

Script: Converter.lua:23: attempt to perform arithmetic on local 'y1' (a nil value)

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 viewBox="0 0 37.5 63" style="enable-background:new 0 0 37.5 63;" xml:space="preserve">
<style type="text/css">
	.st0{fill:none;stroke:#2A6D9B;stroke-width:4;}
	.st1{fill:#E09028;}
	.st2{fill:#2A6D9B;}
	.st3{fill:none;}
</style>
<path class="st0" d="M35,39.4c0,8.2-7.2,14.9-16,14.9S3,47.6,3,39.4C3,31.2,19,6.3,19,6.3S35,31.2,35,39.4z"/>
<path class="st1" d="M18.9,37.7c-8.7-6.2-11.7,0-11.7,0C7,38.1,7,38.6,7,39c0,6.2,5.4,11.2,12,11.2s12-5,12-11.2
	c0-0.4-0.1-0.8-0.1-1.3C30.9,37.7,27.5,43.9,18.9,37.7z"/>
<g>
	<path class="st2" d="M99.1,64c-0.1,0-0.3,0-0.4,0s-0.3,0-0.4,0s-0.2,0-0.4,0s-0.3,0-0.4,0"/>
</g>
<path id="_x3C_スライス_x3E__3_" class="st3" d="M289.7,9"/>
</svg>
User avatar
theAzack9
Developer
Posts: 522
Joined: March 2nd, 2016, 6:23 pm

Re: VectorConverter [V 0.1.3]

Post by theAzack9 »

jsmorley wrote:With the latest VectorConverter_0.1.2.rmskin, this one used to work but now I get:

Script: Converter.lua:23: attempt to perform arithmetic on local 'y1' (a nil value)

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 viewBox="0 0 37.5 63" style="enable-background:new 0 0 37.5 63;" xml:space="preserve">
<style type="text/css">
	.st0{fill:none;stroke:#2A6D9B;stroke-width:4;}
	.st1{fill:#E09028;}
	.st2{fill:#2A6D9B;}
	.st3{fill:none;}
</style>
<path class="st0" d="M35,39.4c0,8.2-7.2,14.9-16,14.9S3,47.6,3,39.4C3,31.2,19,6.3,19,6.3S35,31.2,35,39.4z"/>
<path class="st1" d="M18.9,37.7c-8.7-6.2-11.7,0-11.7,0C7,38.1,7,38.6,7,39c0,6.2,5.4,11.2,12,11.2s12-5,12-11.2
	c0-0.4-0.1-0.8-0.1-1.3C30.9,37.7,27.5,43.9,18.9,37.7z"/>
<g>
	<path class="st2" d="M99.1,64c-0.1,0-0.3,0-0.4,0s-0.3,0-0.4,0s-0.2,0-0.4,0s-0.3,0-0.4,0"/>
</g>
<path id="_x3C_スライス_x3E__3_" class="st3" d="M289.7,9"/>
</svg>
Fixed in latest version, thanks :)
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: VectorConverter [V 0.1.3]

Post by jsmorley »

One thing I would point out to all...

While I'm not speaking for theAzack9, it seems to me the intent of this is to help with creating complex shape meters, which can be a challenge to "hand craft" in Rainmeter.

The idea is:

Download an existing .svg (vector graphics) formatted drawing from the web. There are tons of sites with free vector "clipart" you can use.

Or:

Use a tool like Inkscape or Adobe Illustrator to create a drawing, and save it as .svg.

Then this can be used to convert that .svg file into what you need in a Rainmeter Shape meter. Just paste the code that will be in your clipboard into your skin, and you have a good start.

What this is NOT intended for is to turn .png / .jpg (raster graphics) "paint" images into shapes. First, converting .png to .svg is a non-trivial thing to do using the tracing tools in Inkscape or Illustrator. Second, the result with either of them is going to be spotty at best with a detailed .png image file. Third, it will create just GIGANTIC Shape meters, perhaps with many hundreds or even many thousands of Path options.

So while it's fine for a .png like this, assuming you can get it converted to .svg:
Chrome.png

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[ConvertedShape]
Meter=Shape
X=0
Y=0
Shape = Path Path1 | fill color 227, 55, 51 | StrokeWidth 0
Shape2 = Path Path2 | fill color 72, 175, 70 | StrokeWidth 0
Shape3 = Path Path3 | fill color 72, 175, 70 | StrokeWidth 0
Shape4 = Path Path4 | fill color 235, 235, 236 | StrokeWidth 0
Shape5 = Path Path5 | StrokeWidth 0
Shape6 = Combine Shape4 | XOR Shape5
Shape7 = Path Path6 | fill color 247, 203, 14 | StrokeWidth 0
Shape8 = Path Path7 | fill color 67, 133, 195 | StrokeWidth 0
Path1 = 45.19, 11.17 | CurveTo 97.17, 18.8, 62.38, 4.91, 82.51, 7.87 | CurveTo 113.93, 39.2, 104.17, 24.17, 110.61, 30.92 | CurveTo 68.82, 39.42, 98.9, 39.59, 83.86, 39.28 | CurveTo 44.58, 48.53, 59.86, 38.19, 50.21, 41.23 | CurveTo 39.96, 71.03, 39.37, 54.72, 38.3, 63.31 | CurveTo 17.67, 32.8, 32.19, 58.49, 25.12, 45.53 | CurveTo 45.19, 11.17, 23.89, 22.66, 34.09, 15.22 | ClosePath 1
Path2 = 8.01, 67.03 | CurveTo 17.67, 32.8, 7.5, 55.04, 10.43, 42.51 | CurveTo 39.96, 71.03, 25.12, 45.53, 32.19, 58.49 | CurveTo 57.11, 87.91, 42.66, 78.93, 48.88, 85.74 | CurveTo 81.03, 82.75, 65.41, 90.54, 74.18, 87.61 | CurveTo 70.63, 101.66, 78.31, 89.44, 74.07, 95.34 | CurveTo 60.02, 119.79, 66.97, 107.63, 64, 114.02 | CurveTo 27.99, 106.98, 48.28, 119.29, 36.98, 114.44 | CurveTo 8.01, 67.03, 16.27, 97.15, 8.6, 82.39 | ClosePath 1
Path3 = 106.33, 100.66 | CurveTo 106.63, 100.31, 106.4, 100.57, 106.55, 100.4 | CurveTo 106.33, 100.66, 106.55, 100.4, 106.4, 100.57 | ClosePath 1
Path4 = 44.58, 48.53 | CurveTo 68.82, 39.42, 50.21, 41.23, 59.86, 38.19 | CurveTo 84.31, 49.71, 74.9, 41.08, 80.74, 44.38 | CurveTo 86.18, 75.26, 89.6, 57.01, 90.26, 67.25 | CurveTo 81.03, 82.75, 84.8, 77.97, 82.84, 80.32 | CurveTo 57.11, 87.91, 74.18, 87.61, 65.41, 90.54 | CurveTo 39.96, 71.03, 48.88, 85.74, 42.66, 78.93 | CurveTo 44.58, 48.53, 38.3, 63.31, 39.37, 54.72
Path5 = 60.42, 43.58 | CurveTo 42.86, 63.99, 50.78, 45.14, 42.69, 54.08 | CurveTo 63, 85.37, 42.36, 74.99, 51.93, 85.33 | CurveTo 84.01, 70.93, 72.24, 86.12, 81.18, 79.6 | CurveTo 79.19, 49.83, 86.43, 63.73, 84.68, 55.18 | CurveTo 60.42, 43.58, 74.46, 44.82, 67.17, 42.59 | ClosePath 1
Path6 = 68.82, 39.42 | CurveTo 113.93, 39.2, 83.86, 39.28, 98.9, 39.59 | CurveTo 118.97, 53.07, 116.77, 43.24, 117.83, 48.32 | CurveTo 106.63, 100.31, 122.37, 69.61, 117.7, 87.56 | CurveTo 106.33, 100.66, 106.55, 100.4, 106.4, 100.57 | CurveTo 60.02, 119.79, 95.06, 113.88, 77.35, 121.24 | CurveTo 70.63, 101.66, 64, 114.02, 66.97, 107.63 | CurveTo 81.03, 82.75, 74.07, 95.34, 78.31, 89.44 | CurveTo 86.18, 75.26, 82.84, 80.32, 84.8, 77.97 | CurveTo 84.31, 49.71, 90.26, 67.25, 89.6, 57.01 | CurveTo 68.82, 39.42, 80.74, 44.38, 74.9, 41.08 | ClosePath 1
Path7 = 60.42, 43.58 | CurveTo 79.19, 49.83, 67.17, 42.59, 74.46, 44.82 | CurveTo 84.01, 70.93, 84.68, 55.18, 86.43, 63.73 | CurveTo 63, 85.37, 81.18, 79.6, 72.24, 86.12 | CurveTo 42.86, 63.99, 51.93, 85.33, 42.36, 74.99 | CurveTo 60.42, 43.58, 42.69, 54.08, 50.78, 45.14 | ClosePath 1
1.jpg
It is NOT intended for images like:


MonaLisa_1.0.rmskin
As you can see from the .rmskin, it's possible...
1.jpg
But just don't...
You do not have the required permissions to view the files attached to this post.
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: VectorConverter [V 0.1.3]

Post by FreeRaider »

I am trying this converter, but I get an error:
Script: Converter.lua:56: attempt to concatenate local 'b' (a nil value)

This is the image I use (I post directly the xml file)

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="497" height="470">
<g stroke="#f00" stroke-width="20" fill="none">
<path d="M140,20C
73,20 20,74 20,140
20,275 156,310 248,443
336,311 477,270 477,140
477,74 423,20 357,20
309,20 267,48 248,89
229,48 188,20 140,20Z"/>
</g>
</svg>
I report this error for future improvements.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: VectorConverter [V 0.1.3]

Post by jsmorley »

FreeRaider wrote:I am trying this converter, but I get an error:
Script: Converter.lua:56: attempt to concatenate local 'b' (a nil value)

This is the image I use (I post directly the xml file)

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="497" height="470">
<g stroke="#f00" stroke-width="20" fill="none">
<path d="M140,20C
73,20 20,74 20,140
20,275 156,310 248,443
336,311 477,270 477,140
477,74 423,20 357,20
309,20 267,48 248,89
229,48 188,20 140,20Z"/>
</g>
</svg>
I report this error for future improvements.
Sorry this is almost necro'ing this post, but I just happened to be revisiting this VectorConverter today.

If you bring that code into Inskscape, and then save it as a .svg so it has all the required attributes:
Note that even Inkscape is not thrilled about that code, which is missing all the "viewport" settings and who knows what else.

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   width="477"
   height="450.7988"
   version="1.1"
   id="svg831"
   sodipodi:docname="test1.svg"
   inkscape:version="0.92.3 (2405546, 2018-03-11)">
  <metadata
     id="metadata837">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <defs
     id="defs835" />
  <sodipodi:namedview
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1"
     objecttolerance="10"
     gridtolerance="10"
     guidetolerance="10"
     inkscape:pageopacity="0"
     inkscape:pageshadow="2"
     inkscape:window-width="716"
     inkscape:window-height="480"
     id="namedview833"
     showgrid="false"
     inkscape:zoom="0.47484909"
     inkscape:cx="238.5"
     inkscape:cy="225.7988"
     inkscape:window-x="0"
     inkscape:window-y="0"
     inkscape:window-maximized="1"
     inkscape:current-layer="svg831" />
  <g
     id="g829"
     style="fill:none;stroke:#ff0000;stroke-width:20"
     transform="translate(-10,-10)">
    <path
       d="M 140,20 C 73,20 20,74 20,140 20,275 156,310 248,443 336,311 477,270 477,140 477,74 423,20 357,20 309,20 267,48 248,89 229,48 188,20 140,20 Z"
       id="path827"
       inkscape:connector-curvature="0" />
  </g>
</svg>
Then the VectorConverter seems ok with it.

Code: Select all

[ConvertedShape]
Meter=Shape
X=0
Y=0
Shape = Path Path1 | fill color 0,0,0,0 | stroke color 255, 0, 0 | StrokeWidth 20
Path1 = 140, 20 | CurveTo 20, 140, 73, 20, 20, 74 | CurveTo 248, 443, 20, 275, 156, 310 | CurveTo 477, 140, 336, 311, 477, 270 | CurveTo 357, 20, 477, 74, 423, 20 | CurveTo 248, 89, 309, 20, 267, 48 | CurveTo 140, 20, 229, 48, 188, 20 | ClosePath 1
1.png
You do not have the required permissions to view the files attached to this post.
User avatar
Virginityrocks
Posts: 478
Joined: February 26th, 2011, 10:22 pm

Re: VectorConverter [V 0.1.3]

Post by Virginityrocks »

Great job on this. Keep up the good work :17good
F!.OW
Posts: 22
Joined: April 1st, 2018, 12:42 pm

Re: VectorConverter [V 0.1.3]

Post by F!.OW »

I'm grateful for this tool, it makes creating shapes SO much easier. :D

Thank you for your work, keep it up! :thumbup:
User avatar
2bndy5
Posts: 20
Joined: February 25th, 2015, 2:38 am

Re: VectorConverter [V 0.1.3]

Post by 2bndy5 »

This looks great! I've resorted to using imageMagick to convert svg to png in the past using a runcommand plugin measure, but I'm very interested in seeing how this develops.
User avatar
raiguard
Posts: 660
Joined: June 25th, 2015, 7:02 pm
Location: The Sky, USA

Re: VectorConverter [V 0.1.3]

Post by raiguard »

This is amazing! I have been getting really fed up with the Material Icons icon font, but I didn't want to switch to PNGs because they would take up a ton of space. Alas, now I can have the best of both worlds!

I have an issue though: For some reason I cannot get Transform modifiers to work. Can anyone help me? I feel like I'm making a really dumb mistake.

EDIT: And alas, I have already run into some SVGs that don't work. What are the chances of getting native SVG support in Rainmeter?

Code: Select all

[ConvertedShape]
Meter=Shape
X=0
Y=0
Shape = Path Path1 | StrokeWidth 0 | Extend Attributes
Shape2 = Path Path2 | StrokeWidth 0
Shape3 = Path Path3 | StrokeWidth 0
Shape4 = Path Path4 | StrokeWidth 0
Shape5 = Combine Shape1 | XOR Shape2 | XOR Shape3 | XOR Shape4 | Extend Transforms
Path1 = 448, 360 | LineTo 448, 24 | CurveTo 424, 0, 448, 10.7, 437.3, 0 | LineTo 96, 0 | CurveTo 0, 96, 43, 0, 0, 43 | LineTo 0, 416 | CurveTo 96, 512, 0, 469, 43, 512 | LineTo 424, 512 | CurveTo 448, 488, 437.3, 512, 448, 501.3 | LineTo 448, 472 | CurveTo 439.1, 453.3, 448, 464.5, 444.5, 457.7 | CurveTo 439.1, 378.6, 434.9, 437.9, 434.9, 394 | CurveTo 448, 360, 444.5, 374.3, 448, 367.5 | ClosePath 1
Path2 = 128, 134 | CurveTo 134, 128, 128, 130.7, 130.7, 128 | LineTo 346, 128 | CurveTo 352, 134, 349.3, 128, 352, 130.7 | LineTo 352, 154 | CurveTo 346, 160, 352, 157.3, 349.3, 160 | LineTo 134, 160 | CurveTo 128, 154, 130.7, 160, 128, 157.3 | LineTo 128, 134 | ClosePath 1
Path3 = 128, 198 | CurveTo 134, 192, 128, 194.7, 130.7, 192 | LineTo 346, 192 | CurveTo 352, 198, 349.3, 192, 352, 194.7 | LineTo 352, 218 | CurveTo 346, 224, 352, 221.3, 349.3, 224 | LineTo 134, 224 | CurveTo 128, 218, 130.7, 224, 128, 221.3 | LineTo 128, 198 | ClosePath 1
Path4 = 381.4, 448 | LineTo 96, 448 | CurveTo 64, 416, 78.3, 448, 64, 433.7 | CurveTo 96, 384, 64, 398.4, 78.4, 384 | LineTo 381.4, 384 | CurveTo 381.4, 448, 379.5, 401.1, 379.5, 430.9 | ClosePath 1
Attributes = Fill Color 137,190,250
Transforms = Scale 0.2,0.2 | Rotate 90
”We are pretty sure that r2922 resolves the regression in resolution caused by a reversion to a revision.” - jsmorley, 2017