├── @Resources
├── Fonts
│ ├── A-15-BIT.ttf
│ ├── AUSTRALIA-TITLE.otf
│ ├── Agatha Needs Flesh - Terms of Use End User Lisence Agreement.txt
│ ├── Agatha Needs Flesh.ttf
│ ├── AlteHaasGroteskBold.ttf
│ ├── AlteHaasGroteskRegular.ttf
│ ├── Avantgarde.ttf
│ ├── BLACKOUT.TTF
│ ├── BebasNeue Light.ttf
│ ├── Elegant Lux Mager.otf
│ ├── FUTRFW.TTF
│ ├── Fiesta.ttf
│ ├── Future.ttf
│ ├── Futurist Fixed-width Bold.ttf
│ ├── Galano Grotesque Alt DEMO Bold.otf
│ ├── Galano Grotesque DEMO Bold.otf
│ ├── GeosansLight.ttf
│ ├── GlacialIndifference-Bold.otf
│ ├── GlacialIndifference-Regular.otf
│ ├── GracedScript_PersonalUseOnly.ttf
│ ├── Grunge Strokes 01.ttf
│ ├── HunDIN1451.ttf
│ ├── LeviReBrushed.ttf
│ ├── Lions.ttf
│ ├── Material icons 2.ttf
│ ├── MaterialIcons-Regular.ttf
│ ├── Museo Sans Cyrl 300.otf
│ ├── NOVUM-Regular.ttf
│ ├── NoirMedium.ttf
│ ├── Pacifico.ttf
│ ├── Product Sans Regular.ttf
│ ├── Retro Mono Wide.ttf
│ ├── Roboto-Light.ttf
│ ├── Roboto-Medium.ttf
│ ├── Roboto-Thin.ttf
│ └── SF_Collegiate_Solid.ttf
└── Scripts
│ ├── ColorKeywords.lua
│ ├── FileLoader.lua
│ ├── HelperFunctions.lua
│ ├── ModifierHandler.lua
│ ├── PathTypes
│ ├── A.lua
│ ├── C.lua
│ ├── H.lua
│ ├── L.lua
│ ├── M.lua
│ ├── Q.lua
│ ├── S.lua
│ ├── T.lua
│ ├── V.lua
│ └── Z.lua
│ ├── SvgTypes
│ ├── circle.lua
│ ├── defs.lua
│ ├── g.lua
│ ├── path.lua
│ ├── polygon.lua
│ ├── rect.lua
│ ├── style.lua
│ └── svg.lua
│ ├── XmlParser.lua
│ └── lol
│ ├── ColorKeywords.lua
│ ├── Converter.lua
│ ├── FileLoader.lua
│ ├── HelperFunctions.lua
│ ├── ModifierHandler.lua
│ ├── MouseHandler.lua
│ ├── PathTypes
│ ├── A.lua
│ ├── C.lua
│ ├── H.lua
│ ├── L.lua
│ ├── M.lua
│ ├── Q.lua
│ ├── S.lua
│ ├── T.lua
│ ├── V.lua
│ └── Z.lua
│ ├── ReplaceText.lua
│ ├── SvgTypes
│ ├── circle.lua
│ ├── defs.lua
│ ├── g.lua
│ ├── path.lua
│ ├── polygon.lua
│ ├── rect.lua
│ ├── style.lua
│ └── svg.lua
│ ├── WindowHandler.lua
│ └── XmlParser.lua
├── Bit
├── Bit.ini
├── Converter.lua
└── ReplaceText.lua
├── Clear Futurist
└── Clear Futurist.ini
├── Clock Future Style
└── Clock Future Style.ini
├── Clock Hun Style
└── Clock Hun Style.ini
├── Clock Neo Style
└── Clock Neo Style.ini
├── College
├── College.ini
├── Converter.lua
├── ReplaceText.lua
└── ReplaceText2.lua
├── Exclusive
├── Converter.lua
├── Exclusive.ini
└── ReplaceText.lua
├── Glacial Contrast
├── Converter.lua
├── Glacial Contrast.ini
└── ReplaceText.lua
├── Lion
└── Lion.ini
├── Pacific Futurist
└── Pacific Futurist.ini
├── Pacific
└── Pacific.ini
├── Product
└── Product.ini
├── README.md
├── Retro
└── Retro.ini
├── Ribbon
├── Converter.lua
├── ReplaceText.lua
└── Ribbon.ini
├── Roll
└── Roll.ini
├── Straight Hidden
├── Converter.lua
├── ReplaceText.lua
└── Straight Hidden.ini
├── Stroke
├── Stroke.ini
├── apr.png
├── aug.png
├── dec.png
├── feb.png
├── jan.png
├── jul.png
├── jun.png
├── mar.png
├── may.png
├── nov.png
├── oct.png
├── sep.png
└── template.psd
├── Tilt Reveal
├── Converter.lua
├── ReplaceText.lua
└── Tilt Reveal.ini
└── Vertical Lineup
└── Vertical Lineup.ini
/@Resources/Fonts/A-15-BIT.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/A-15-BIT.ttf
--------------------------------------------------------------------------------
/@Resources/Fonts/AUSTRALIA-TITLE.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/AUSTRALIA-TITLE.otf
--------------------------------------------------------------------------------
/@Resources/Fonts/Agatha Needs Flesh - Terms of Use End User Lisence Agreement.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/Agatha Needs Flesh - Terms of Use End User Lisence Agreement.txt
--------------------------------------------------------------------------------
/@Resources/Fonts/Agatha Needs Flesh.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/Agatha Needs Flesh.ttf
--------------------------------------------------------------------------------
/@Resources/Fonts/AlteHaasGroteskBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/AlteHaasGroteskBold.ttf
--------------------------------------------------------------------------------
/@Resources/Fonts/AlteHaasGroteskRegular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/AlteHaasGroteskRegular.ttf
--------------------------------------------------------------------------------
/@Resources/Fonts/Avantgarde.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/Avantgarde.ttf
--------------------------------------------------------------------------------
/@Resources/Fonts/BLACKOUT.TTF:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/BLACKOUT.TTF
--------------------------------------------------------------------------------
/@Resources/Fonts/BebasNeue Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/BebasNeue Light.ttf
--------------------------------------------------------------------------------
/@Resources/Fonts/Elegant Lux Mager.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/Elegant Lux Mager.otf
--------------------------------------------------------------------------------
/@Resources/Fonts/FUTRFW.TTF:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/FUTRFW.TTF
--------------------------------------------------------------------------------
/@Resources/Fonts/Fiesta.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/Fiesta.ttf
--------------------------------------------------------------------------------
/@Resources/Fonts/Future.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/Future.ttf
--------------------------------------------------------------------------------
/@Resources/Fonts/Futurist Fixed-width Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/Futurist Fixed-width Bold.ttf
--------------------------------------------------------------------------------
/@Resources/Fonts/Galano Grotesque Alt DEMO Bold.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/Galano Grotesque Alt DEMO Bold.otf
--------------------------------------------------------------------------------
/@Resources/Fonts/Galano Grotesque DEMO Bold.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/Galano Grotesque DEMO Bold.otf
--------------------------------------------------------------------------------
/@Resources/Fonts/GeosansLight.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/GeosansLight.ttf
--------------------------------------------------------------------------------
/@Resources/Fonts/GlacialIndifference-Bold.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/GlacialIndifference-Bold.otf
--------------------------------------------------------------------------------
/@Resources/Fonts/GlacialIndifference-Regular.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/GlacialIndifference-Regular.otf
--------------------------------------------------------------------------------
/@Resources/Fonts/GracedScript_PersonalUseOnly.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/GracedScript_PersonalUseOnly.ttf
--------------------------------------------------------------------------------
/@Resources/Fonts/Grunge Strokes 01.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/Grunge Strokes 01.ttf
--------------------------------------------------------------------------------
/@Resources/Fonts/HunDIN1451.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/HunDIN1451.ttf
--------------------------------------------------------------------------------
/@Resources/Fonts/LeviReBrushed.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/LeviReBrushed.ttf
--------------------------------------------------------------------------------
/@Resources/Fonts/Lions.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/Lions.ttf
--------------------------------------------------------------------------------
/@Resources/Fonts/Material icons 2.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/Material icons 2.ttf
--------------------------------------------------------------------------------
/@Resources/Fonts/MaterialIcons-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/MaterialIcons-Regular.ttf
--------------------------------------------------------------------------------
/@Resources/Fonts/Museo Sans Cyrl 300.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/Museo Sans Cyrl 300.otf
--------------------------------------------------------------------------------
/@Resources/Fonts/NOVUM-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/NOVUM-Regular.ttf
--------------------------------------------------------------------------------
/@Resources/Fonts/NoirMedium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/NoirMedium.ttf
--------------------------------------------------------------------------------
/@Resources/Fonts/Pacifico.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/Pacifico.ttf
--------------------------------------------------------------------------------
/@Resources/Fonts/Product Sans Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/Product Sans Regular.ttf
--------------------------------------------------------------------------------
/@Resources/Fonts/Retro Mono Wide.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/Retro Mono Wide.ttf
--------------------------------------------------------------------------------
/@Resources/Fonts/Roboto-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/Roboto-Light.ttf
--------------------------------------------------------------------------------
/@Resources/Fonts/Roboto-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/Roboto-Medium.ttf
--------------------------------------------------------------------------------
/@Resources/Fonts/Roboto-Thin.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/Roboto-Thin.ttf
--------------------------------------------------------------------------------
/@Resources/Fonts/SF_Collegiate_Solid.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/khanhas/mnmlUI/4c86060b120c5e97708701b3a6a0937281e1235d/@Resources/Fonts/SF_Collegiate_Solid.ttf
--------------------------------------------------------------------------------
/@Resources/Scripts/ColorKeywords.lua:
--------------------------------------------------------------------------------
1 | local keywords = {}
2 |
3 | keywords["aliceblue"] = "240, 248, 255"
4 | keywords["antiquewhite"] = "250, 235, 215"
5 | keywords["aqua"] = "0, 255, 255"
6 | keywords["aquamarine"] = "127, 255, 212"
7 | keywords["azure"] = "240, 255, 255"
8 | keywords["beige"] = "245, 245, 220"
9 | keywords["bisque"] = "255, 228, 196"
10 | keywords["black"] = "0, 0, 0"
11 | keywords["blanchedalmond"] = "255, 235, 205"
12 | keywords["blue"] = "0, 0, 255"
13 | keywords["blueviolet"] = "138, 43, 226"
14 | keywords["brown"] = "165, 42, 42"
15 | keywords["burlywood"] = "222, 184, 135"
16 | keywords["cadetblue"] = "95, 158, 160"
17 | keywords["chartreuse"] = "127, 255, 0"
18 | keywords["chocolate"] = "210, 105, 30"
19 | keywords["coral"] = "255, 127, 80"
20 | keywords["cornflowerblue"] = "100, 149, 237"
21 | keywords["cornsilk"] = "255, 248, 220"
22 | keywords["crimson"] = "220, 20, 60"
23 | keywords["cyan"] = "0, 255, 255"
24 | keywords["darkblue"] = "0, 0, 139"
25 | keywords["darkcyan"] = "0, 139, 139"
26 | keywords["darkgoldenrod"] = "184, 134, 11"
27 | keywords["darkgray"] = "169, 169, 169"
28 | keywords["darkgreen"] = "0, 100, 0"
29 | keywords["darkgrey"] = "169, 169, 169"
30 | keywords["darkkhaki"] = "189, 183, 107"
31 | keywords["darkmagenta"] = "139, 0, 139"
32 | keywords["darkolivegreen"] = "85, 107, 47"
33 | keywords["darkorange"] = "255, 140, 0"
34 | keywords["darkorchid"] = "153, 50, 204"
35 | keywords["darkred"] = "139, 0, 0"
36 | keywords["darksalmon"] = "233, 150, 122"
37 | keywords["darkseagreen"] = "143, 188, 143"
38 | keywords["darkslateblue"] = "72, 61, 139"
39 | keywords["darkslategray"] = "47, 79, 79"
40 | keywords["darkturquoise"] = "0, 206, 209"
41 | keywords["darkviolet"] = "148, 0, 211"
42 | keywords["deeppink"] = "255, 20, 147"
43 | keywords["deepskyblue"] = "0, 191, 255"
44 | keywords["dimgray"] = "105, 105, 105"
45 | keywords["dodgerblue"] = "30, 144, 255"
46 | keywords["firebrick"] = "178, 34, 34"
47 | keywords["floralwhite"] = "255, 250, 240"
48 | keywords["forestgreen"] = "34, 139, 34"
49 | keywords["fuchsia"] = "255, 0, 255"
50 | keywords["gainsboro"] = "220, 220, 220"
51 | keywords["ghostwhite"] = "248, 248, 255"
52 | keywords["gold"] = "255, 215, 0"
53 | keywords["goldenrod"] = "218, 165, 32"
54 | keywords["gray"] = "128, 128, 128"
55 | keywords["green"] = "0, 128, 0"
56 | keywords["greenyellow"] = "173, 255, 47"
57 | keywords["honeydew"] = "240, 255, 240"
58 | keywords["hotpink"] = "255, 105, 180"
59 | keywords["indianred"] = "205, 92, 92"
60 | keywords["indigo"] = "75, 0, 130"
61 | keywords["ivory"] = "255, 255, 240"
62 | keywords["khaki"] = "240, 230, 140"
63 | keywords["lavender"] = "230, 230, 250"
64 | keywords["lavenderblush"] = "255, 240, 245"
65 | keywords["lawngreen"] = "124, 252, 0"
66 | keywords["lemonchiffon"] = "255, 250, 205"
67 | keywords["lightblue"] = "173, 216, 230"
68 | keywords["lightcoral"] = "240, 128, 128"
69 | keywords["lightcyan"] = "224, 255, 255"
70 | keywords["lightgoldenrodyellow"] = "250, 250, 210"
71 | keywords["lightgray"] = "211, 211, 211"
72 | keywords["lightgreen"] = "144, 238, 144"
73 | keywords["lightpink"] = "255, 182, 193"
74 | keywords["lightsalmon"] = "255, 160, 122"
75 | keywords["lightseagreen"] = "32, 178, 170"
76 | keywords["lightskyblue"] = "135, 206, 250"
77 | keywords["lightslategray"] = "119, 136, 153"
78 | keywords["lightsteelblue"] = "176, 196, 222"
79 | keywords["lightyellow"] = "255, 255, 224"
80 | keywords["lime"] = "0, 255, 0"
81 | keywords["limegreen"] = "50, 205, 50"
82 | keywords["linen"] = "250, 240, 230"
83 | keywords["magenta"] = "255, 0, 255"
84 | keywords["maroon"] = "128, 0, 0"
85 | keywords["mediumaquamarine"] = "102, 205, 170"
86 | keywords["mediumblue"] = "0, 0, 205"
87 | keywords["mediumorchid"] = "186, 85, 211"
88 | keywords["mediumpurple"] = "147, 112, 219"
89 | keywords["mediumseagreen"] = "60, 179, 113"
90 | keywords["mediumslateblue"] = "123, 104, 238"
91 | keywords["mediumspringgreen"] = "0, 250, 154"
92 | keywords["mediumturquoise"] = "72, 209, 204"
93 | keywords["mediumvioletred"] = "199, 21, 133"
94 | keywords["midnightblue"] = "25, 25, 112"
95 | keywords["mintcream"] = "245, 255, 250"
96 | keywords["mistyrose"] = "255, 228, 225"
97 | keywords["moccasin"] = "255, 228, 181"
98 | keywords["navajowhite"] = "255, 222, 173"
99 | keywords["navy"] = "0, 0, 128"
100 | keywords["oldlace"] = "253, 245, 230"
101 | keywords["olive"] = "128, 128, 0"
102 | keywords["olivedrab"] = "107, 142, 35"
103 | keywords["orange"] = "255, 165, 0"
104 | keywords["orangered"] = "255, 69, 0"
105 | keywords["orchid"] = "218, 112, 214"
106 | keywords["palegoldenrod"] = "238, 232, 170"
107 | keywords["palegreen"] = "152, 251, 152"
108 | keywords["paleturquoise"] = "175, 238, 238"
109 | keywords["palevioletred"] = "219, 112, 147"
110 | keywords["papayawhip"] = "255, 239, 213"
111 | keywords["peachpuff"] = "255, 218, 185"
112 | keywords["peru"] = "205, 133, 63"
113 | keywords["pink"] = "255, 192, 203"
114 | keywords["plum"] = "221, 160, 221"
115 | keywords["powderblue"] = "176, 224, 230"
116 | keywords["purple"] = "128, 0, 128"
117 | keywords["red"] = "255, 0, 0"
118 | keywords["rosybrown"] = "188, 143, 143"
119 | keywords["royalblue"] = "65, 105, 225"
120 | keywords["saddlebrown"] = "139, 69, 19"
121 | keywords["salmon"] = "250, 128, 114"
122 | keywords["sandybrown"] = "244, 164, 96"
123 | keywords["seagreen"] = "46, 139, 87"
124 | keywords["seashell"] = "255, 245, 238"
125 | keywords["sienna"] = "160, 82, 45"
126 | keywords["silver"] = "192, 192, 192"
127 | keywords["skyblue"] = "135, 206, 235"
128 | keywords["slateblue"] = "106, 90, 205"
129 | keywords["slategray"] = "112, 128, 144"
130 | keywords["slategrey"] = "112, 128, 144"
131 | keywords["snow"] = "255, 250, 250"
132 | keywords["springgreen"] = "0, 255, 127"
133 | keywords["steelblue"] = "70, 130, 180"
134 | keywords["tan"] = "210, 180, 140"
135 | keywords["teal"] = "0, 128, 128"
136 | keywords["thistle"] = "216, 191, 216"
137 | keywords["tomato"] = "255, 99, 71"
138 | keywords["turquoise"] = "64, 224, 208"
139 | keywords["violet"] = "238, 130, 238"
140 | keywords["wheat"] = "245, 222, 179"
141 | keywords["white"] = "255, 255, 255"
142 | keywords["whitesmoke"] = "245, 245, 245"
143 | keywords["yellow"] = "255, 255, 0"
144 | keywords["yellowgreen"] = "154, 205, 50"
145 |
146 | keywords["none"] = "0,0,0,0" -- Custom transparent
147 |
148 | return keywords
--------------------------------------------------------------------------------
/@Resources/Scripts/FileLoader.lua:
--------------------------------------------------------------------------------
1 | local FileLoadQueue = {}
2 | local IsLoading = false
3 | FileLoadFinishedCallback = {}
4 |
5 | function LoadFilesCallback()
6 | local measure = SKIN:GetMeasure("FileReader")
7 | local files = measure:GetStringValue()
8 | local allFiles = split(files, "\n")
9 |
10 | if #FileLoadQueue > 0 then
11 | local top = FileLoadQueue[1]
12 | top[2](allFiles)
13 | table.remove(FileLoadQueue, 1)
14 | end
15 |
16 | if #FileLoadQueue > 0 then
17 | local top = FileLoadQueue[1]
18 | local path = top[1]
19 | SKIN:Bang("[!SetOption FileReader StartInFolder \"".. path.. "\"][!UpdateMeasure FileReader][!CommandMeasure FileReader Run]")
20 | else
21 | IsLoading = false
22 | for _,j in pairs(FileLoadFinishedCallback) do j() end
23 | end
24 | end
25 |
26 | function LoadFiles(path, functionCallback)
27 | FileLoadQueue[#FileLoadQueue + 1] = {path, functionCallback}
28 | if not IsLoading then
29 | SKIN:Bang("[!SetOption FileReader StartInFolder \"".. path.. "\"][!UpdateMeasure FileReader][!CommandMeasure FileReader Run]")
30 | IsLoading = true
31 | end
32 | end
33 |
34 | function IsFilesLoading() return IsLoading end
--------------------------------------------------------------------------------
/@Resources/Scripts/HelperFunctions.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | Removes spaces before and after the string
4 |
5 | --]]
6 | function trim(s)
7 | if s == nil then return nil end
8 | return (s:gsub("^%s*(.-)%s*$", "%1"))
9 | end
10 |
11 | --[[
12 |
13 | Merges two tables, t2 takes priority and will overwrite values in t1
14 |
15 | --]]
16 |
17 | function tableMerge(t1, t2)
18 | for k,v in pairs(t2) do
19 | if type(v) == "table" then
20 | if type(t1[k] or false) == "table" then
21 | t1[k] = tableMerge(t1[k] or {}, t2[k] or {})
22 | else
23 | t1[k] = v
24 | end
25 | else
26 | t1[k] = v
27 | end
28 | end
29 | return t1
30 | end
31 |
32 | --[[
33 |
34 | Splits string at separator
35 |
36 | --]]
37 |
38 | function split(inputstr, sep)
39 | if sep == nil then
40 | sep = "%s"
41 | end
42 | local t={} ; i=1
43 | for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
44 | t[i] = str
45 | i = i + 1
46 | end
47 | return t
48 | end
49 |
50 |
51 | --[[
52 |
53 | No regex, so manual number crunching.
54 |
55 | Takes a string and parses it into a table of numbers
56 | Warning, svg numbers can be very compressed and are therefore quite difficult to parse manually.
57 | e.g "4.2,3.1-2.3-.3,2-3.2" = {4.2, 3.1, -2.3, -0.3, 2, -3.2}
58 |
59 | --]]
60 |
61 | function parseSvgNumbers(parameters)
62 | local parsedNumbers = {}
63 | local pos = 0
64 | while pos <= #parameters do
65 | local prefix = parameters:find("-", pos)
66 | local nextNumberMax = false
67 | if prefix == nil then prefix = #parameters end
68 |
69 | local dot = parameters:find("%.", pos)
70 | if dot == nil then dot = #parameters end
71 |
72 | local number = parameters:find("[%d]+", pos)
73 | if number == nil then number = #parameters end
74 | local strNum = parameters:match("[%d]+", pos)
75 | if strNum ~= nil then
76 | local nextNumber = parameters:find("[%d]+", number + #strNum)
77 | if nextNumber == nil then nextNumber = #parameters nextNumberMax = true end
78 | local nextStrNum = parameters:match("[%d]+", number + #strNum)
79 |
80 | local separator = parameters:find("%s", pos)
81 | if separator == nil then separator = #parameters end
82 | if separator < number then
83 | separator = number + 1
84 | separator = parameters:find("%s", separator)
85 | if separator == nil then separator = #parameters end
86 | end
87 | local separator2 = parameters:find("%,", pos)
88 | if separator2 == nil then separator2 = #parameters end
89 | if separator2 < number then
90 | separator2 = number + 1
91 | separator2 = parameters:find("%,", separator2)
92 | if separator2 == nil then separator2 = #parameters end
93 | end
94 | if separator > separator2 then separator = separator2 end
95 | local nextPrefix = parameters:find("-", prefix+1)
96 | if nextPrefix == nil then nextPrefix = #parameters end
97 |
98 | local usePrefix = prefix < number
99 | local singleDecimal = dot < number
100 | local isDecimal = singleDecimal or ((prefix < number or prefix >= nextNumber) and nextNumber <= nextPrefix and nextNumber <= separator and not nextNumberMax)
101 | local finalNum = 0
102 | local neg = 1
103 | if usePrefix then
104 | neg = -1
105 | end
106 | if singleDecimal then
107 | finalNum = neg * tonumber("0." .. strNum)
108 | pos = number + #strNum
109 | elseif isDecimal then
110 | finalNum = neg * tonumber(strNum .. "." .. nextStrNum)
111 | pos = nextNumber + #nextStrNum
112 | else
113 | finalNum = neg * tonumber(strNum)
114 | pos = number + #strNum
115 | end
116 | parsedNumbers[#parsedNumbers + 1] = finalNum
117 | else
118 | pos = #parameters + 1
119 | end
120 | end
121 |
122 | return parsedNumbers
123 | end
124 |
125 | function tprint (tbl, indent)
126 | if not indent then indent = 0 end
127 | for k, v in pairs(tbl) do
128 | formatting = string.rep(" ", indent) .. k .. ": "
129 | if type(v) == "table" then
130 | print(formatting)
131 | tprint(v, indent+1)
132 | elseif type(v) == "boolean" then
133 | local val = ""
134 | if tprint then val = "true" else val = "false" end
135 | print(formatting.. val)
136 | else
137 | print(formatting .. v)
138 | end
139 | end
140 | end
141 |
142 | function deepcopy(orig)
143 | local orig_type = type(orig)
144 | local copy
145 | if orig_type == 'table' then
146 | copy = {}
147 | for orig_key, orig_value in next, orig, nil do
148 | copy[deepcopy(orig_key)] = deepcopy(orig_value)
149 | end
150 | setmetatable(copy, deepcopy(getmetatable(orig)))
151 | else -- number, string, boolean, etc
152 | copy = orig
153 | end
154 | return copy
155 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/ModifierHandler.lua:
--------------------------------------------------------------------------------
1 |
2 | function getModifiers(attributes) -- TODO: ADD MORE MODIFIERS
3 | if attributes == nil then
4 | return attributes
5 | end
6 | local modifiers = {}
7 | modifiers["Special"] = {}
8 | modifiers["Special"]["Display"] = true
9 |
10 | if attributes["style"] ~= nil then
11 | modifiers = dissectInkScape(modifiers, attributes["style"])
12 | else
13 | modifiers = dissectHTML(modifiers, attributes)
14 | end
15 | return modifiers
16 | end
17 |
18 | function mergeModifiers(groupModifiers, modifiers)
19 | if groupModifiers ~= nil and modifiers ~= nil then
20 | local merged = tableMerge(groupModifiers, modifiers)
21 | return merged
22 | elseif modifiers ~= nil then
23 | return modifiers
24 | elseif groupModifiers ~= nil then
25 | return groupModifiers
26 | end
27 | return {}
28 | end
29 |
30 | function newShape(groupModifiers, attributes)
31 | local modifiers = getModifiers(attributes)
32 | local shape = {}
33 | shape["modifiers"] = mergeModifiers(groupModifiers, modifiers)
34 | return shape
35 | end
36 |
37 | local colorKeywords = dofile(ColorKeywordsPath)
38 |
39 | function getCssColor(color)
40 | if color == nil or type(color) ~= "string" then
41 | return nil
42 | end
43 |
44 | color = trim(color:lower())
45 |
46 | if colorKeywords[color] ~= nil then
47 | return colorKeywords[color]
48 | elseif color:sub(1, 3) == "rgb" then
49 | return color:gsub("rgb", ""):gsub("%(", ""):gsub("%)", "")
50 | else
51 | color = color:gsub("#", "")
52 | local r = tonumber(color:sub(1, 2), 16)
53 | local g = tonumber(color:sub(3, 4), 16)
54 | local b = tonumber(color:sub(5, 6), 16)
55 |
56 | return "" .. r .. ", " .. g .. ", " .. b
57 | end
58 | if color == "none" then return "0, 0, 0, 0" end
59 | end
60 |
61 | local
62 |
63 | function cssToShapeModifier(modifiers, modifierName, modifierValue)
64 |
65 | if modifierName == nil then return end
66 | if modifierValue == nil then
67 | modifiers[modifierName] = nil
68 | end
69 |
70 | if modifierName == "display" then
71 | if modifierValue == "none" then
72 | modifiers["Special"]["Display"] = false
73 | end
74 | end
75 |
76 | -- These are modifiers with direct bindings
77 | if modifierName == "fill" then modifiers["fill color"] = getCssColor(modifierValue) end
78 | if modifierName == "stroke" then modifiers["stroke color"] = getCssColor(modifierValue) end
79 | if modifierName == "stroke-width" then modifiers["StrokeWidth"] = modifierValue:gsub("px", "") end
80 |
81 | -- These are attributes that can be done, but there is no direct modifier binding to them
82 | if modifierName == "stroke-opacity" then modifiers["Special"]["StrokeOpcaity"] = modifierValue end
83 | if modifierName == "fill-opacity" then modifiers["Special"]["FillOpcaity"] = modifierValue end
84 |
85 |
86 | -- TODO, ADD FILLMODE WHEN WE GET WINDING ;)
87 |
88 | end
89 |
90 | function dissectInkScape(modifiers, style)
91 | local styleParts = split(style, ";")
92 | for i,part in pairs(styleParts) do
93 | local stylePair = split(part, ":")
94 | local styleName = trim(stylePair[1])
95 | local styleValue = trim(stylePair[2])
96 | cssToShapeModifier(modifiers, trim(styleName), trim(styleValue))
97 |
98 | end
99 | return modifiers
100 | end
101 |
102 | function dissectHTML(modifiers, attributes)
103 | for i,j in pairs(attributes) do
104 | cssToShapeModifier(modifiers, trim(i), trim(j))
105 | end
106 | return modifiers
107 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/PathTypes/A.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | the Arc segment is one or multiple arcs
4 |
5 | parameters - a table of numbers that is the numbers trailing the segment character (e.g "M 200, 300")
6 | pen - the current pen location (table: { X= xPos, Y = yPos} )
7 | shape - the current shape
8 | relative - is this relative to the last pen location
9 |
10 | --]]
11 |
12 | return function (parameters, pen, shape, relative)
13 | for i=1, #parameters, 7 do
14 | local rx = tonumber(parameters[i])
15 | local ry = tonumber(parameters[i+1])
16 | local rotationAngle = tonumber(parameters[i+2])
17 | local arcSize = tonumber(parameters[i+3])
18 | local sweep = tonumber(parameters[i+4])
19 | sweep = 1 - sweep
20 | local x = tonumber(parameters[i+5])
21 | local y = tonumber(parameters[i+6])
22 | if relative then
23 | x = x + pen.X
24 | y = y + pen.Y
25 | end
26 |
27 | shape["path"] = shape["path"] .. " | ArcTo " .. x .. ", " .. y .. ", " .. rx .. ", " .. ry .. ", " .. rotationAngle .. ", " .. sweep .. ", " .. arcSize
28 |
29 | lastControlX = nil
30 | lastControlY = nil
31 | lastQuadraticX = nil
32 | lastQuadraticY = nil
33 | pen.X = x
34 | pen.Y = y
35 | end
36 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/PathTypes/C.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | the Curve segment is one or multiple bezier curves
4 |
5 | parameters - a table of numbers that is the numbers trailing the segment character (e.g "M 200, 300")
6 | pen - the current pen location (table: { X= xPos, Y = yPos} )
7 | shape - the current shape
8 | relative - is this relative to the last pen location
9 |
10 | --]]
11 |
12 | return function (parameters, pen, shape, relative)
13 | for i=1, #parameters, 6 do
14 | --if parameters[i] ~= nil and parameters[i+1] ~= nil and parameters[i+2] ~= nil and parameters[i+3] ~= nil and parameters[i+4] ~= nil and parameters[i+5] ~= nil then
15 | local x1 = tonumber(parameters[i])
16 | local y1 = tonumber(parameters[i+1])
17 | local x2 = tonumber(parameters[i+2])
18 | local y2 = tonumber(parameters[i+3])
19 | local x = tonumber(parameters[i+4])
20 | local y = tonumber(parameters[i+5])
21 | if relative then
22 | x1 = x1 + pen.X
23 | y1 = y1 + pen.Y
24 | x2 = x2 + pen.X
25 | y2 = y2 + pen.Y
26 | x = x + pen.X
27 | y = y + pen.Y
28 | end
29 | shape["path"] = shape["path"] .. " | CurveTo " .. x .. ", " .. y .. ", " .. x1 .. ", " .. y1 .. ", " .. x2 .. ", " .. y2
30 | if relative then
31 | x = x - pen.X
32 | y = y - pen.Y
33 | x2 = x2 - pen.X
34 | y2 = y2 - pen.Y
35 | end
36 | lastControlX = x2 + (x - x2) * 2
37 | lastControlY = y2 + (y - y2) * 2
38 | lastQuadraticX = nil
39 | lastQuadraticY = nil
40 |
41 | if relative then
42 | x = x + pen.X
43 | y = y + pen.Y
44 | lastControlX = lastControlX + pen.X
45 | lastControlY = lastControlY + pen.Y
46 | end
47 | pen.X = x
48 | pen.Y = y
49 | --else
50 | -- print("Invalid bezier curve ", parameters[i], parameters[i+1], parameters[i+2], parameters[i+3], parameters[i+4], parameters[i+5])
51 | --end
52 | end
53 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/PathTypes/H.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | the Horizontal LineTo segment is one or multiple horizontal lines
4 |
5 | parameters - a table of numbers that is the numbers trailing the segment character (e.g "M 200, 300")
6 | pen - the current pen location (table: { X= xPos, Y = yPos} )
7 | shape - the current shape
8 | relative - is this relative to the last pen location
9 |
10 | --]]
11 |
12 | return function (parameters, pen, shape, relative)
13 | for i=1, #parameters do
14 | local x = tonumber(parameters[i])
15 | if relative then
16 | x = x + pen.X
17 | end
18 | shape["path"] = shape["path"] .. " | LineTo " .. x .. ", " .. pen.Y
19 | pen.X = x
20 | lastControlX = x2
21 | lastControlY = y2
22 | lastQuadraticX = nil
23 | lastQuadraticY = nil
24 | end
25 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/PathTypes/L.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | the LineTo segment is one or multiple lines
4 |
5 | parameters - a table of numbers that is the numbers trailing the segment character (e.g "M 200, 300")
6 | pen - the current pen location (table: { X= xPos, Y = yPos} )
7 | shape - the current shape
8 | relative - is this relative to the last pen location
9 |
10 | --]]
11 |
12 | return function (parameters, pen, shape, relative)
13 | for i=1, #parameters, 2 do
14 | local x = tonumber(parameters[i])
15 | local y = tonumber(parameters[i+1])
16 | if relative then
17 | x = x + pen.X
18 | y = y + pen.Y
19 | end
20 | shape["path"] = shape["path"] .. " | LineTo " .. x .. ", " .. y
21 | pen.X = x
22 | pen.Y = y
23 | lastControlX = x2
24 | lastControlY = y2
25 | lastQuadraticX = nil
26 | lastQuadraticY = nil
27 | end
28 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/PathTypes/M.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | MoveTo segment, this indicates where the path should start and is the same as lifting the pen and moving it to a new location. (e.g starting a new Path shape)
4 |
5 | Note: additional parameters after the initial point is counted as LineTo, hence the "pathSegments:L()"
6 |
7 | parameters - a table of numbers that is the numbers trailing the segment character (e.g "M 200, 300")
8 | pen - the current pen location (table: { X= xPos, Y = yPos} )
9 | shape - the current shape
10 | relative - is this relative to the last pen location
11 |
12 | --]]
13 |
14 | return function (parameters, pen, shape, relative)
15 | local x = tonumber(parameters[1])
16 | local y = tonumber(parameters[2])
17 | if relative then
18 | x = x + pen.X
19 | y = y + pen.Y
20 | end
21 | local moveShape = nil
22 | if shape["path"] ~= nil and trim(shape["path"]) ~= "" then
23 | local newShape = {}
24 | newShape["modifiers"] = deepcopy(shape["modifiers"])
25 | newShape["shape"] = "Path Path" .. nextPath
26 | nextPath = nextPath + 1
27 | moveShape = newShape
28 | else
29 | moveShape = shape
30 | end
31 | moveShape["path"] = x .. ", " .. y
32 | pen.X = x
33 | pen.Y = y
34 | lastControlX = x2
35 | lastControlY = y2
36 | lastQuadraticX = nil
37 | lastQuadraticY = nil
38 | table.remove(parameters, 1)
39 | table.remove(parameters, 1)
40 | pathSegments.L(parameters, pen, moveShape, relative)
41 | return moveShape
42 | end
43 |
--------------------------------------------------------------------------------
/@Resources/Scripts/PathTypes/Q.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | the Quadratic Curve segment is one or multiple quadratic bezier curves
4 |
5 | parameters - a table of numbers that is the numbers trailing the segment character (e.g "M 200, 300")
6 | pen - the current pen location (table: { X= xPos, Y = yPos} )
7 | shape - the current shape
8 | relative - is this relative to the last pen location
9 |
10 | --]]
11 |
12 | return function (parameters, pen, shape, relative)
13 | for i=1, #parameters, 4 do
14 | local x1 = tonumber(parameters[i])
15 | local y1 = tonumber(parameters[i+1])
16 | local x = tonumber(parameters[i+2])
17 | local y = tonumber(parameters[i+3])
18 | if relative then
19 | x1 = x1 + pen.X
20 | y1 = y1 + pen.Y
21 | x = x + pen.X
22 | y = y + pen.Y
23 | end
24 | shape["path"] = shape["path"] .. " | CurveTo " .. x .. ", " .. y .. ", " .. x1 .. ", " .. y1
25 | if relative then
26 | x = x - pen.X
27 | y = y - pen.Y
28 | x1 = x1 - pen.X
29 | y1 = y1 - pen.Y
30 | end
31 | lastControlX = nil
32 | lastControlY = nil
33 | lastQuadraticX = x1 + (x - x1) * 2
34 | lastQuadraticY = y1 + (y - y1) * 2
35 |
36 | if relative then
37 | x = x + pen.X
38 | y = y + pen.Y
39 | lastQuadraticX = lastQuadraticX + pen.X
40 | lastQuadraticY = lastQuadraticY + pen.Y
41 | end
42 | pen.X = x
43 | pen.Y = y
44 | end
45 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/PathTypes/S.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | the Simple Curve segment is one or multiple simplified bezier curves
4 |
5 | parameters - a table of numbers that is the numbers trailing the segment character (e.g "M 200, 300")
6 | pen - the current pen location (table: { X= xPos, Y = yPos} )
7 | shape - the current shape
8 | relative - is this relative to the last pen location
9 |
10 | --]]
11 |
12 | return function (parameters, pen, shape, relative)
13 | for i=1, #parameters, 4 do
14 | local x2 = tonumber(parameters[i])
15 | local y2 = tonumber(parameters[i+1])
16 | local x = tonumber(parameters[i+2])
17 | local y = tonumber(parameters[i+3])
18 | if relative then
19 | x2 = x2 + pen.X
20 | y2 = y2 + pen.Y
21 | x = x + pen.X
22 | y = y + pen.Y
23 | end
24 |
25 | if lastControlX == nil then
26 | lastControlX = x2
27 | end
28 | if lastControlY == nil then
29 | lastControlY = y2
30 | end
31 |
32 | shape["path"] = shape["path"] .. " | CurveTo " .. x .. ", " .. y .. ", " .. lastControlX .. ", " .. lastControlY .. ", " .. x2 .. ", " .. y2
33 |
34 | if relative then
35 | x = x - pen.X
36 | y = y - pen.Y
37 | x2 = x2 - pen.X
38 | y2 = y2 - pen.Y
39 | end
40 | lastControlX = x2 + (x - x2) * 2
41 | lastControlY = y2 + (y - y2) * 2
42 | lastQuadraticX = nil
43 | lastQuadraticY = nil
44 |
45 | if relative then
46 | x = x + pen.X
47 | y = y + pen.Y
48 | lastControlX = lastControlX + pen.X
49 | lastControlY = lastControlY + pen.Y
50 | end
51 |
52 | pen.X = x
53 | pen.Y = y
54 | end
55 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/PathTypes/T.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | the Simplified Quadratic Curve segment is one or multiple simple quadratic bezier curves
4 |
5 | parameters - a table of numbers that is the numbers trailing the segment character (e.g "M 200, 300")
6 | pen - the current pen location (table: { X= xPos, Y = yPos} )
7 | shape - the current shape
8 | relative - is this relative to the last pen location
9 |
10 | --]]
11 |
12 | return function(parameters, pen, shape, relative)
13 | for i=1, #parameters, 2 do
14 | local x = tonumber(parameters[i])
15 | local y = tonumber(parameters[i+1])
16 | if relative then
17 | x = x + pen.X
18 | y = y + pen.Y
19 | end
20 |
21 | if lastQuadraticX == nil then
22 | lastQuadraticX = x2
23 | end
24 | if lastQuadraticY == nil then
25 | lastQuadraticY = y2
26 | end
27 |
28 | shape["path"] = shape["path"] .. " | CurveTo " .. x .. ", " .. y .. ", " .. lastQuadraticX .. ", " .. lastQuadraticY
29 |
30 | if relative then
31 | x = x - pen.X
32 | y = y - pen.Y
33 | end
34 | lastControlX = nil
35 | lastControlY = nil
36 | lastQuadraticX = lastQuadraticX + (x - lastQuadraticX) * 2
37 | lastQuadraticY = lastQuadraticY + (y - lastQuadraticY) * 2
38 |
39 | if relative then
40 | x = x + pen.X
41 | y = y + pen.Y
42 | lastControlX = lastControlX + pen.X
43 | lastControlY = lastControlY + pen.Y
44 | end
45 |
46 | pen.X = x
47 | pen.Y = y
48 | end
49 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/PathTypes/V.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | the Vertical LineTo segment is one or multiple vertical lines
4 |
5 | parameters - a table of numbers that is the numbers trailing the segment character (e.g "M 200, 300")
6 | pen - the current pen location (table: { X= xPos, Y = yPos} )
7 | shape - the current shape
8 | relative - is this relative to the last pen location
9 |
10 | --]]
11 |
12 | return function (parameters, pen, shape, relative)
13 | for i=1, #parameters do
14 | local y = tonumber(parameters[i])
15 | if relative then
16 | y = y + pen.Y
17 | end
18 | shape["path"] = shape["path"] .. " | LineTo " .. pen.X .. ", " .. y
19 | pen.Y = y
20 | lastControlX = x2
21 | lastControlY = y2
22 | lastQuadraticX = nil
23 | lastQuadraticY = nil
24 | end
25 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/PathTypes/Z.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | the close path segment closes the path.
4 |
5 | parameters - a table of numbers that is the numbers trailing the segment character (e.g "M 200, 300")
6 | pen - the current pen location (table: { X= xPos, Y = yPos} )
7 | shape - the current shape
8 | relative - is this relative to the last pen location
9 |
10 | --]]
11 |
12 | return function (parameters, pen, shape, relative)
13 | shape["path"] = shape["path"] .. " | ClosePath 1"
14 | lastControlX = x2
15 | lastControlY = y2
16 | lastQuadraticX = nil
17 | lastQuadraticY = nil
18 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/SvgTypes/circle.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | This converts the tag in .svg to a shape that rainmeter can use
4 |
5 | shapes - All shapes generated so far, do "shapes[#shapes + 1] = shape" to add a new shape
6 | attributes - This is the attributes for the tag (e.g , class is an attribute to the svg tag )
7 | children - All the tags inside the current tag
8 | groupModifiers - These are modifiers that is applied through inheritence by the tag
9 | value - The actual value of the tag (e.g the content inside that tags that are not other tags.)
10 |
11 | --]]
12 |
13 | return function (shapes, attributes, children, groupModifiers, value)
14 | local shape = newShape(groupModifiers, attributes)
15 | local x = attributes["cx"]
16 | local y = attributes["cy"]
17 | local r = attributes["r"]
18 | shape["shape"] = "Ellipse " .. x .. ", " .. y .. ", " .. r
19 | local class = attributes["class"]
20 | if shapeStyles[class] ~= nil then
21 | shape["modifiers"] = mergeModifiers(shape["modifiers"], shapeStyles[class])
22 | end
23 | shapes[#shapes+1] = shape
24 | return shapes
25 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/SvgTypes/defs.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | This handles the tag that can be used in the .svg format
4 | This is probably not fully implemented as i'm only sending the tag that appears here into the parser again to be handled in style.lua
5 |
6 | shapes - All shapes generated so far, do "shapes[#shapes + 1] = shape" to add a new shape
7 | attributes - This is the attributes for the tag (e.g , class is an attribute to the svg tag )
8 | children - All the tags inside the current tag
9 | groupModifiers - These are modifiers that is applied through inheritence by the tag
10 | value - The actual value of the tag (e.g the content inside that tags that are not other tags.)
11 |
12 | ]]
13 |
14 | return function (shapes, attributes, children, groupModifiers, value)
15 | --for i, j in pairs(children) do
16 | -- shapes = getShape(j, shapes, groupModifiers)
17 | --end
18 |
19 | --TODO: this
20 | return shapes
21 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/SvgTypes/g.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | This handles the tag, which styles it's children.
4 |
5 | shapes - All shapes generated so far, do "shapes[#shapes + 1] = shape" to add a new shape
6 | attributes - This is the attributes for the tag (e.g , class is an attribute to the svg tag )
7 | children - All the tags inside the current tag
8 | groupModifiers - These are modifiers that is applied through inheritence by the tag
9 | value - The actual value of the tag (e.g the content inside that tags that are not other tags.)
10 |
11 | --]]
12 |
13 | return function (shapes, attributes, children, groupModifiers, value) -- group
14 | debugPrint("group")
15 | if children ~= nil then
16 | local mods = getModifiers(attributes)
17 | groupModifiers = mergeModifiers(groupModifiers, mods)
18 | local class = attributes["class"]
19 | if shapeStyles[class] ~= nil then
20 | groupModifiers = mergeModifiers(groupModifiers, shapeStyles[class])
21 | end
22 | for i, j in pairs(children) do
23 | shapes = getShape(j, shapes, groupModifiers)
24 | end
25 | end
26 | return shapes
27 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/SvgTypes/path.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | This converts the tag in .svg to a shape that rainmeter can use
4 |
5 | Note: This is a pretty advanced tag, and i've therefore made the segments into modules inside #@#Scripts/PathTypes
6 |
7 | shapes - All shapes generated so far, do "shapes[#shapes + 1] = shape" to add a new shape
8 | attributes - This is the attributes for the tag (e.g , class is an attribute to the svg tag )
9 | children - All the tags inside the current tag
10 | groupModifiers - These are modifiers that is applied through inheritence by the tag
11 | value - The actual value of the tag (e.g the content inside that tags that are not other tags.)
12 |
13 | --]]
14 |
15 | -- Table where the functions of all the path types are stored
16 | pathSegments = {}
17 |
18 | --These are used for the C, S, Q and T segments, used to calculate the S and T control points
19 | lastControlX = nil
20 | lastControlY = nil
21 | lastQuadraticX = nil
22 | lastQuadraticY = nil
23 |
24 | local pathSegmentDir = SKIN:ReplaceVariables("#@#Scripts\\PathTypes\\")
25 |
26 | local function LoadPathSegments(files)
27 | for id, file in pairs(files) do
28 | fileName = split(file, ".")[1]
29 | pathSegments[fileName] = dofile(pathSegmentDir .. file)
30 | end
31 | end
32 |
33 | LoadFiles(pathSegmentDir, LoadPathSegments)
34 |
35 | function parsePath(input)
36 | local out = {};
37 |
38 | for instr, vals in input:gmatch("([a-df-zA-DF-Z])([^a-df-zA-DF-Z]*)") do
39 | local line = { instr };
40 | local carry = nil
41 | for v in vals:gmatch("([+-]?[%deE.]+)") do
42 | if v:match("[eE]") then
43 | carry = v
44 | else
45 | if carry then
46 | line[#line+1] = carry .. v;
47 | carry = nil
48 | else
49 | line[#line+1] = v;
50 | end
51 | end
52 |
53 | end
54 | out[#out+1] = line;
55 | end
56 | return out;
57 | end
58 |
59 |
60 | return function (shapes, attributes, children, groupModifiers, value)
61 | local shape = newShape(groupModifiers, attributes)
62 | local class = attributes["class"]
63 | if shapeStyles[class] ~= nil then
64 | shape["modifiers"] = mergeModifiers(shapeStyles[class], shape["modifiers"])
65 | end
66 | shape["shape"] = "Path Path" .. nextPath
67 | nextPath = nextPath + 1
68 | --local path = trim(attributes["d"]:gsub("%s+", " "))
69 | local pen = {X = 0, Y = 0}
70 |
71 | local combine = ""
72 | local fistCombine = true
73 | local shapeCount = 0
74 | local iterations = 0
75 |
76 | local special = shape["modifiers"]["Special"]
77 |
78 | local segments = parsePath(attributes["d"])
79 | for i=1, #segments do
80 | local parameters = segments[i]
81 | local char = parameters[1]
82 | table.remove(parameters, 1)
83 |
84 | if pathSegments[char:upper()] ~= nil then
85 | local relative = char:lower() == char
86 | local nextShape = pathSegments[char:upper()](parameters, pen, shape, relative)
87 |
88 | if nextShape ~= nil and nextShape ~= shape then
89 | if fistCombine then
90 | combine = "Combine Shape" .. (#shapes + 1)
91 | fistCombine = false
92 | else
93 | combine = combine .. " | XOR Shape" .. (#shapes + 1)
94 | shape["modifiers"] = {}
95 | shape["modifiers"]["Special"] = special
96 | end
97 | shapes[#shapes+1] = shape
98 | shape = nextShape
99 | shapeCount = shapeCount + 1
100 | end
101 | else
102 | print("Path segment by type " .. char:upper() .. " does not exist!")
103 | end
104 | iterations = iterations + 1
105 | end
106 |
107 | if shape["shape"] ~= nil and trim(shape["shape"]) ~= "" and iterations > 1 then
108 | if fistCombine then
109 | combine = "Combine Shape" .. (#shapes + 1)
110 | fistCombine = false
111 | else
112 | combine = combine .. " | XOR Shape" .. (#shapes + 1)
113 | shape["modifiers"] = {}
114 | shape["modifiers"]["Special"] = special
115 | end
116 | shapes[#shapes+1] = shape
117 | shape = nextShape
118 | shapeCount = shapeCount + 1
119 | else
120 | nextPath = nextPath - 1
121 | end
122 |
123 | if combine ~= "" and shapeCount > 1 then
124 | local combinedShape = {modifiers = {}}
125 | combinedShape["shape"] = combine
126 | combinedShape["modifiers"]["Special"] = special
127 | combinedShape["combined"] = true
128 | shapes[#shapes+1] = combinedShape
129 | end
130 |
131 | return shapes
132 | end
133 |
--------------------------------------------------------------------------------
/@Resources/Scripts/SvgTypes/polygon.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | This converts the tag in .svg to a shape that rainmeter can use
4 |
5 | shapes - All shapes generated so far, do "shapes[#shapes + 1] = shape" to add a new shape
6 | attributes - This is the attributes for the tag (e.g , class is an attribute to the svg tag )
7 | children - All the tags inside the current tag
8 | groupModifiers - These are modifiers that is applied through inheritence by the tag
9 | value - The actual value of the tag (e.g the content inside that tags that are not other tags.)
10 |
11 | --]]
12 |
13 | return function (shapes, attributes, children, groupModifiers, value)
14 |
15 | local shape = newShape(groupModifiers, attributes)
16 | local class = attributes["class"]
17 | shape["modifiers"] = mergeModifiers(shape["modifiers"], shapeStyles[class])
18 | debugPrint("polygon")
19 | local parameters = attributes["points"]
20 | parameters = trim(parameters:gsub("%s+", " "))
21 |
22 | parameters = parseSvgNumbers(parameters)
23 |
24 | local path = ""
25 | local first = true
26 | for i=1, #parameters, 2 do
27 | local x = tonumber(parameters[i])
28 | local y = tonumber(parameters[i+1])
29 | if first then
30 | path = path .. x .. ", " .. y
31 | first = false
32 | else
33 | path = path .. " | LineTo " .. x .. ", " .. y
34 | end
35 | end
36 | path = path .. " | ClosePath 1"
37 |
38 | shape["shape"] = "Path Path"..nextPath
39 | shape["path"] = path
40 | nextPath = nextPath + 1
41 |
42 | local class = attributes["class"]
43 | if shapeStyles[class] ~= nil then
44 | shape["modifiers"] = mergeModifiers(shape["modifiers"], shapeStyles[class])
45 | end
46 |
47 | shapes[#shapes+1] = shape
48 | return shapes
49 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/SvgTypes/rect.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | This converts the tag in .svg to a shape that rainmeter can use
4 |
5 | shapes - All shapes generated so far, do "shapes[#shapes + 1] = shape" to add a new shape
6 | attributes - This is the attributes for the tag (e.g , class is an attribute to the svg tag )
7 | children - All the tags inside the current tag
8 | groupModifiers - These are modifiers that is applied through inheritence by the tag
9 | value - The actual value of the tag (e.g the content inside that tags that are not other tags.)
10 |
11 | --]]
12 |
13 | return function (shapes, attributes, children, groupModifiers, value)
14 | local shape = newShape(groupModifiers, attributes)
15 | local x = attributes["x"]
16 | if x == nil then x = 0 end
17 | local y = attributes["y"]
18 | if y == nil then y = 0 end
19 | local w = attributes["width"]
20 | local h = attributes["height"]
21 | shape["shape"] = "Rectangle " .. x .. ", " .. y .. ", " .. w .. ", " .. h
22 | local class = attributes["class"]
23 | if shapeStyles[class] ~= nil then
24 | shape["modifiers"] = mergeModifiers(shape["modifiers"], shapeStyles[class])
25 | end
26 | shapes[#shapes+1] = shape
27 | return shapes
28 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/SvgTypes/style.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | handles the tag in the .svg, and saves them to the shapeStyles table to be fetched later.
4 |
5 | Note: only classes are handled for now, i assume that ids will probably appear, but i have yet to implement that
6 |
7 | shapes - All shapes generated so far, do "shapes[#shapes + 1] = shape" to add a new shape
8 | attributes - This is the attributes for the tag (e.g , class is an attribute to the svg tag )
9 | children - All the tags inside the current tag
10 | groupModifiers - These are modifiers that is applied through inheritence by the tag
11 | value - The actual value of the tag (e.g the content inside that tags that are not other tags.)
12 |
13 | --]]
14 |
15 | return function (shapes, attributes, children, groupModifiers, value)
16 | local firstSplit = split(value, "}")
17 | for i, stylePart in pairs(firstSplit) do
18 | local idContentPair = split(stylePart, "{")
19 | local ids = split(idContentPair[1], ",")
20 | for j, id in pairs(ids) do
21 | local id = trim(id):sub(2)
22 | local content = idContentPair[2]
23 | local att = {}
24 | att["style"] = content
25 | local modifiers = getModifiers(att)
26 | shapeStyles[id] = mergeModifiers(modifiers, shapeStyles[id])
27 | end
28 | end
29 | return shapes
30 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/SvgTypes/svg.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | This handles the tag, which declares that the following is a svg shape
4 |
5 | shapes - All shapes generated so far, do "shapes[#shapes + 1] = shape" to add a new shape
6 | attributes - This is the attributes for the tag (e.g , class is an attribute to the svg tag )
7 | children - All the tags inside the current tag
8 | groupModifiers - These are modifiers that is applied through inheritence by the tag
9 | value - The actual value of the tag (e.g the content inside that tags that are not other tags.)
10 |
11 | ]]
12 |
13 | return function (shapes, attributes, children, groupModifiers, value)
14 | debugPrint("svg", children, attributes)
15 | if children == nil then
16 | print(ErrorEmptySVG)
17 | return nil
18 | end
19 | if attributes == nil then
20 | print(CorruptSVG)
21 | return nil
22 | end
23 |
24 | if attributes["viewBox"] ~= nil then
25 | local view = split(attributes["viewBox"], " ")
26 | local x = view[1]
27 | local y = view[2]
28 | local width = view[3]
29 | local height = view[4]
30 | shapes["X"] = tostring(-tonumber(x))
31 | shapes["Y"] = tostring(-tonumber(y))
32 | shapes["width"] = width
33 | shapes["height"] = height
34 | end
35 |
36 | for i, j in pairs(children) do
37 | shapes = getShape(j, shapes, groupModifiers)
38 | end
39 | return shapes
40 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/XmlParser.lua:
--------------------------------------------------------------------------------
1 | -- Code from: http://lua-users.org/wiki/LuaXml
2 | -----------------------------------------------------------------------------------------
3 | -- LUA only XmlParser from Alexander Makeev
4 | -----------------------------------------------------------------------------------------
5 | -- Using this code "As Is"
6 | -- Jaya Polumuru
7 |
8 | XmlParser = {};
9 |
10 | function XmlParser:ToXmlString(value)
11 | value = string.gsub (value, "&", "&"); -- '&' -> "&"
12 | value = string.gsub (value, "<", "<"); -- '<' -> "<"
13 | value = string.gsub (value, ">", ">"); -- '>' -> ">"
14 | --value = string.gsub (value, "'", "'"); -- '\'' -> "'"
15 | value = string.gsub (value, "\"", """); -- '"' -> """
16 | -- replace non printable char -> "
"
17 | value = string.gsub(value, "([^%w%&%;%p%\t% ])",
18 | function (c)
19 | return string.format("%X;", string.byte(c))
20 | --return string.format("%02X;", string.byte(c))
21 | --return string.format("%02d;", string.byte(c))
22 | end);
23 | return value;
24 | end
25 |
26 | function XmlParser:FromXmlString(value)
27 | value = string.gsub(value, "([%x]+)%;",
28 | function(h)
29 | return string.char(tonumber(h,16))
30 | end);
31 | value = string.gsub(value, "([0-9]+)%;",
32 | function(h)
33 | return string.char(tonumber(h,10))
34 | end);
35 | value = string.gsub (value, """, "\"");
36 | value = string.gsub (value, "'", "'");
37 | value = string.gsub (value, ">", ">");
38 | value = string.gsub (value, "<", "<");
39 | value = string.gsub (value, "&", "&");
40 | return value;
41 | end
42 |
43 | function XmlParser:ParseArgs(s)
44 | local arg = {}
45 | string.gsub(s, "(%w*%-?%w+)=([\"'])(.-)%2", function (w, _, a)
46 | arg[w] = XmlParser:FromXmlString(a);
47 | end)
48 | return arg
49 | end
50 |
51 | function XmlParser:ParseXmlText(xmlText)
52 | local stack = {}
53 | local top = {Name=nil,Value=nil,Attributes={},ChildNodes={}}
54 | table.insert(stack, top)
55 | local ni,c,label,xarg, empty
56 | local i, j = 1, 1
57 | while true do
58 | ni,j,c,label,xarg, empty = string.find(xmlText, "<(%/?)([%w:]+)(.-)(%/?)>", i)
59 | if not ni then break end
60 | local text = string.sub(xmlText, i, ni-1);
61 | if not string.find(text, "^%s*$") then
62 | top.Value=(top.Value or "")..XmlParser:FromXmlString(text);
63 | end
64 | if empty == "/" then -- empty element tag
65 | -- print ("Label:" .. label) -- comment these out
66 | table.insert(top.ChildNodes, {Name=label,Value=nil,Attributes=XmlParser:ParseArgs(xarg),ChildNodes={}})
67 | elseif c == "" then -- start tag
68 | top = {Name=label, Value=nil, Attributes=XmlParser:ParseArgs(xarg), ChildNodes={}}
69 | table.insert(stack, top) -- new level
70 | -- print("openTag ="..top.Name); -- comment these out
71 | else -- end tag
72 | local toclose = table.remove(stack) -- remove top
73 | -- print("closeTag="..toclose.Name); -- comment these out
74 | top = stack[#stack]
75 | if #stack < 1 then
76 | error("XmlParser: nothing to close with "..label)
77 | end
78 | if toclose.Name ~= label then
79 | error("XmlParser: trying to close "..toclose.Name.." with "..label)
80 | end
81 | table.insert(top.ChildNodes, toclose)
82 | end
83 | i = j+1
84 | end
85 | local text = string.sub(xmlText, i);
86 | if not string.find(text, "^%s*$") then
87 | stack[#stack].Value=(stack[#stack].Value or "")..XmlParser:FromXmlString(text);
88 | end
89 | if #stack > 1 then
90 | error("XmlParser: unclosed "..stack[stack.n].Name)
91 | end
92 | return stack[1].ChildNodes[1];
93 | end
94 |
95 | function XmlParser:ParseXmlFile(xmlFileName)
96 | local hFile,err = io.open(xmlFileName,"r");
97 | if (not err) then
98 | local xmlText=hFile:read("*a"); -- read file content
99 | io.close(hFile);
100 | return XmlParser:ParseXmlText(xmlText),nil;
101 | else
102 | return nil,err;
103 | end
104 | end
105 | ------------------------------------------------------------------------------------------
106 | --example:
107 |
108 | function dump(resourceFile, _class, no_func, depth)
109 | if(not _class) then
110 | print("nil");
111 | return;
112 | end
113 |
114 | if(depth==nil) then depth=0; end
115 | local str="";
116 | for n=0,depth,1 do
117 | str=str.."\t";
118 | end
119 |
120 | resourceFile:write(str.."["..type(_class).."]\n");
121 | resourceFile:write(str.."{\n");
122 |
123 | for i,field in pairs(_class) do
124 | if(type(field)=="table") then
125 | resourceFile:write(str.."\t"..tostring(i).." =".."\n");
126 | dump(resourceFile, field, no_func, depth+1);
127 | else
128 | if(type(field)=="number") then
129 | resourceFile:write(str.."\t"..tostring(i).."="..field.."\n");
130 | elseif(type(field) == "string") then
131 | resourceFile:write(str.."\t"..tostring(i).."=".."\""..field.."\"\n");
132 | elseif(type(field) == "boolean") then
133 | resourceFile:write(str.."\t"..tostring(i).."=".."\""..tostring(field).."\"\n");
134 | else
135 | if(not no_func)then
136 | if(type(field)=="function")then
137 | resourceFile:write(str.."\t"..tostring(i).."()\n");
138 | else
139 | resourceFile:write(str.."\t"..tostring(i).."\n");
140 | end
141 | end
142 | end
143 | end
144 | end
145 | resourceFile:write(str.."}\n");
146 | end
147 |
148 | return XmlParser
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/ColorKeywords.lua:
--------------------------------------------------------------------------------
1 | local keywords = {}
2 |
3 | keywords["aliceblue"] = "240, 248, 255"
4 | keywords["antiquewhite"] = "250, 235, 215"
5 | keywords["aqua"] = "0, 255, 255"
6 | keywords["aquamarine"] = "127, 255, 212"
7 | keywords["azure"] = "240, 255, 255"
8 | keywords["beige"] = "245, 245, 220"
9 | keywords["bisque"] = "255, 228, 196"
10 | keywords["black"] = "0, 0, 0"
11 | keywords["blanchedalmond"] = "255, 235, 205"
12 | keywords["blue"] = "0, 0, 255"
13 | keywords["blueviolet"] = "138, 43, 226"
14 | keywords["brown"] = "165, 42, 42"
15 | keywords["burlywood"] = "222, 184, 135"
16 | keywords["cadetblue"] = "95, 158, 160"
17 | keywords["chartreuse"] = "127, 255, 0"
18 | keywords["chocolate"] = "210, 105, 30"
19 | keywords["coral"] = "255, 127, 80"
20 | keywords["cornflowerblue"] = "100, 149, 237"
21 | keywords["cornsilk"] = "255, 248, 220"
22 | keywords["crimson"] = "220, 20, 60"
23 | keywords["cyan"] = "0, 255, 255"
24 | keywords["darkblue"] = "0, 0, 139"
25 | keywords["darkcyan"] = "0, 139, 139"
26 | keywords["darkgoldenrod"] = "184, 134, 11"
27 | keywords["darkgray"] = "169, 169, 169"
28 | keywords["darkgreen"] = "0, 100, 0"
29 | keywords["darkgrey"] = "169, 169, 169"
30 | keywords["darkkhaki"] = "189, 183, 107"
31 | keywords["darkmagenta"] = "139, 0, 139"
32 | keywords["darkolivegreen"] = "85, 107, 47"
33 | keywords["darkorange"] = "255, 140, 0"
34 | keywords["darkorchid"] = "153, 50, 204"
35 | keywords["darkred"] = "139, 0, 0"
36 | keywords["darksalmon"] = "233, 150, 122"
37 | keywords["darkseagreen"] = "143, 188, 143"
38 | keywords["darkslateblue"] = "72, 61, 139"
39 | keywords["darkslategray"] = "47, 79, 79"
40 | keywords["darkturquoise"] = "0, 206, 209"
41 | keywords["darkviolet"] = "148, 0, 211"
42 | keywords["deeppink"] = "255, 20, 147"
43 | keywords["deepskyblue"] = "0, 191, 255"
44 | keywords["dimgray"] = "105, 105, 105"
45 | keywords["dodgerblue"] = "30, 144, 255"
46 | keywords["firebrick"] = "178, 34, 34"
47 | keywords["floralwhite"] = "255, 250, 240"
48 | keywords["forestgreen"] = "34, 139, 34"
49 | keywords["fuchsia"] = "255, 0, 255"
50 | keywords["gainsboro"] = "220, 220, 220"
51 | keywords["ghostwhite"] = "248, 248, 255"
52 | keywords["gold"] = "255, 215, 0"
53 | keywords["goldenrod"] = "218, 165, 32"
54 | keywords["gray"] = "128, 128, 128"
55 | keywords["green"] = "0, 128, 0"
56 | keywords["greenyellow"] = "173, 255, 47"
57 | keywords["honeydew"] = "240, 255, 240"
58 | keywords["hotpink"] = "255, 105, 180"
59 | keywords["indianred"] = "205, 92, 92"
60 | keywords["indigo"] = "75, 0, 130"
61 | keywords["ivory"] = "255, 255, 240"
62 | keywords["khaki"] = "240, 230, 140"
63 | keywords["lavender"] = "230, 230, 250"
64 | keywords["lavenderblush"] = "255, 240, 245"
65 | keywords["lawngreen"] = "124, 252, 0"
66 | keywords["lemonchiffon"] = "255, 250, 205"
67 | keywords["lightblue"] = "173, 216, 230"
68 | keywords["lightcoral"] = "240, 128, 128"
69 | keywords["lightcyan"] = "224, 255, 255"
70 | keywords["lightgoldenrodyellow"] = "250, 250, 210"
71 | keywords["lightgray"] = "211, 211, 211"
72 | keywords["lightgreen"] = "144, 238, 144"
73 | keywords["lightpink"] = "255, 182, 193"
74 | keywords["lightsalmon"] = "255, 160, 122"
75 | keywords["lightseagreen"] = "32, 178, 170"
76 | keywords["lightskyblue"] = "135, 206, 250"
77 | keywords["lightslategray"] = "119, 136, 153"
78 | keywords["lightsteelblue"] = "176, 196, 222"
79 | keywords["lightyellow"] = "255, 255, 224"
80 | keywords["lime"] = "0, 255, 0"
81 | keywords["limegreen"] = "50, 205, 50"
82 | keywords["linen"] = "250, 240, 230"
83 | keywords["magenta"] = "255, 0, 255"
84 | keywords["maroon"] = "128, 0, 0"
85 | keywords["mediumaquamarine"] = "102, 205, 170"
86 | keywords["mediumblue"] = "0, 0, 205"
87 | keywords["mediumorchid"] = "186, 85, 211"
88 | keywords["mediumpurple"] = "147, 112, 219"
89 | keywords["mediumseagreen"] = "60, 179, 113"
90 | keywords["mediumslateblue"] = "123, 104, 238"
91 | keywords["mediumspringgreen"] = "0, 250, 154"
92 | keywords["mediumturquoise"] = "72, 209, 204"
93 | keywords["mediumvioletred"] = "199, 21, 133"
94 | keywords["midnightblue"] = "25, 25, 112"
95 | keywords["mintcream"] = "245, 255, 250"
96 | keywords["mistyrose"] = "255, 228, 225"
97 | keywords["moccasin"] = "255, 228, 181"
98 | keywords["navajowhite"] = "255, 222, 173"
99 | keywords["navy"] = "0, 0, 128"
100 | keywords["oldlace"] = "253, 245, 230"
101 | keywords["olive"] = "128, 128, 0"
102 | keywords["olivedrab"] = "107, 142, 35"
103 | keywords["orange"] = "255, 165, 0"
104 | keywords["orangered"] = "255, 69, 0"
105 | keywords["orchid"] = "218, 112, 214"
106 | keywords["palegoldenrod"] = "238, 232, 170"
107 | keywords["palegreen"] = "152, 251, 152"
108 | keywords["paleturquoise"] = "175, 238, 238"
109 | keywords["palevioletred"] = "219, 112, 147"
110 | keywords["papayawhip"] = "255, 239, 213"
111 | keywords["peachpuff"] = "255, 218, 185"
112 | keywords["peru"] = "205, 133, 63"
113 | keywords["pink"] = "255, 192, 203"
114 | keywords["plum"] = "221, 160, 221"
115 | keywords["powderblue"] = "176, 224, 230"
116 | keywords["purple"] = "128, 0, 128"
117 | keywords["red"] = "255, 0, 0"
118 | keywords["rosybrown"] = "188, 143, 143"
119 | keywords["royalblue"] = "65, 105, 225"
120 | keywords["saddlebrown"] = "139, 69, 19"
121 | keywords["salmon"] = "250, 128, 114"
122 | keywords["sandybrown"] = "244, 164, 96"
123 | keywords["seagreen"] = "46, 139, 87"
124 | keywords["seashell"] = "255, 245, 238"
125 | keywords["sienna"] = "160, 82, 45"
126 | keywords["silver"] = "192, 192, 192"
127 | keywords["skyblue"] = "135, 206, 235"
128 | keywords["slateblue"] = "106, 90, 205"
129 | keywords["slategray"] = "112, 128, 144"
130 | keywords["slategrey"] = "112, 128, 144"
131 | keywords["snow"] = "255, 250, 250"
132 | keywords["springgreen"] = "0, 255, 127"
133 | keywords["steelblue"] = "70, 130, 180"
134 | keywords["tan"] = "210, 180, 140"
135 | keywords["teal"] = "0, 128, 128"
136 | keywords["thistle"] = "216, 191, 216"
137 | keywords["tomato"] = "255, 99, 71"
138 | keywords["turquoise"] = "64, 224, 208"
139 | keywords["violet"] = "238, 130, 238"
140 | keywords["wheat"] = "245, 222, 179"
141 | keywords["white"] = "255, 255, 255"
142 | keywords["whitesmoke"] = "245, 245, 245"
143 | keywords["yellow"] = "255, 255, 0"
144 | keywords["yellowgreen"] = "154, 205, 50"
145 |
146 | keywords["none"] = "0,0,0,0" -- Custom transparent
147 |
148 | return keywords
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/Converter.lua:
--------------------------------------------------------------------------------
1 |
2 | svgTypes = {}
3 |
4 | debugPrint = function(k) end
5 | nextPath = 2;
6 | shapeStyles = {}
7 |
8 |
9 | local ErrorEmptySVG = "Error: Parsing empty Svg file"
10 | local CorruptSVG = "Error: The svg file is corrupt"
11 | local GetModifiersError = "Error: Invalid attributes table given to get modifiers, returning nil"
12 |
13 | function shallowcopy(orig)
14 | local orig_type = type(orig)
15 | local copy
16 | if orig_type == 'table' then
17 | copy = {}
18 | for orig_key, orig_value in pairs(orig) do
19 | copy[orig_key] = orig_value
20 | end
21 | else -- number, string, boolean, etc
22 | copy = orig
23 | end
24 | return copy
25 | end
26 |
27 | function getShape(xmlTable, shapes, groupModifiers)
28 | local svgTypeName = xmlTable["Name"]
29 | local children = xmlTable["ChildNodes"]
30 | if svgTypes[svgTypeName] ~= nil then
31 | shapes = svgTypes[svgTypeName](shapes, xmlTable["Attributes"], children, deepcopy(groupModifiers), xmlTable["Value"]) -- Someone tell me why tf i need this nil here...
32 | end
33 | return shapes
34 | end
35 |
36 | --------------------------------------------------- The things above this will probably be moved to a separate file ;)
37 |
38 | function xmlToShape(svgFile)
39 |
40 | local xml = XmlParser:ParseXmlFile(svgFile)
41 | if xml["Name"] ~= "svg" then
42 | print("Invalid svg file: ", svgFile)
43 | return nil
44 | end
45 | nextPath = 1
46 | style = {}
47 | endShapes = getShape(xml, {}, {})
48 | return endShapes
49 | end
50 |
51 |
52 |
53 | function Initialize()
54 | ColorKeywordsPath = SKIN:ReplaceVariables("#@#Scripts/ColorKeywords.lua")
55 |
56 | XmlParser = dofile(SKIN:ReplaceVariables("#@#Scripts/XmlParser.lua"))
57 | dofile(SKIN:ReplaceVariables("#@#Scripts/FileLoader.lua")) -- FileLoader
58 | dofile(SKIN:ReplaceVariables("#@#Scripts/HelperFunctions.lua")) -- HelperFunctions
59 | dofile(SKIN:ReplaceVariables("#@#Scripts/ModifierHandler.lua")) -- ModifierHandler
60 |
61 | local dir = SKIN:ReplaceVariables("#@#Scripts\\SvgTypes\\")
62 |
63 | local SvgLoad = function(files)
64 | for id, file in pairs(files) do
65 | fileName = split(file, ".")[1]
66 | svgTypes[fileName] = dofile(dir .. file)
67 | end
68 | print("Svg components initialized")
69 |
70 | end
71 |
72 | LoadFiles(dir, SvgLoad)
73 | end
74 |
75 | function ConvertFile()
76 | local path = SKIN:ReplaceVariables("#CurrentTextboxFile#")
77 | local shapes = xmlToShape(path)
78 | local xOffsett = shapes["X"]
79 | local yOffsett = shapes["Y"]
80 |
81 | local paths = {}
82 |
83 | local meterOptions = ""
84 |
85 | local X = 0
86 | local Y = 0
87 |
88 | if xOffsett ~= nil then
89 | X = X + tonumber(xOffsett)
90 | end
91 |
92 | if yOffsett ~= nil then
93 | Y = Y + tonumber(yOffsett)
94 | end
95 | countshape = 0
96 | for i,shape in pairs(shapes) do
97 | if shape["shape"] == nil then
98 | --print("ERROR IN SHAPE")
99 | else
100 | if shape["modifiers"]["Special"]["Display"] then
101 | local shapeName = "[!SetOption Shape Shape"
102 | if i ~= 1 then shapeName = shapeName .. i end
103 | meterOptions = meterOptions .. shapeName .. " \"" .. shape["shape"]
104 |
105 | for modifierName, modifierValue in pairs(shape["modifiers"]) do
106 | if modifierName ~= "Special" then
107 | meterOptions = meterOptions .. " | " .. modifierName .. " " .. modifierValue
108 | end
109 | end
110 |
111 | if shape["modifiers"]["StrokeWidth"] == nil and shape["combined"] == nil then
112 | meterOptions = meterOptions .. " | StrokeWidth 0"
113 | end
114 |
115 | meterOptions = meterOptions .. "\"]"
116 |
117 | if shape["path"] ~= nil then
118 | paths[#paths+1] = shape["path"]
119 | end
120 | end
121 | countshape = countshape + 1
122 | end
123 | end
124 | countpath = 0
125 | for i, path in pairs(paths) do
126 | meterOptions = meterOptions .. "[!SetOption Shape Path" .. i .. " \"" .. path .. "\"]"
127 | countpath = countpath + 1
128 | end
129 | SKIN:Bang(meterOptions)
130 | local meterOptions = meterOptions:gsub("\n", "#CRLF#")
131 | --SKIN:Bang("[!WriteKeyValue Variables CurrentTextboxFile \"\"]")
132 | --SKIN:Bang("[!SetOption CodeStr Text \"" .. meterOptions .. "\"][!UpdateMeter *][!Redraw]")
133 | end
134 |
135 | function ClearAllShapePath()
136 | SKIN:Bang('[!SetOption Shape Shape \"\"]')
137 | for i=2,countshape do SKIN:Bang('[!SetOption Shape Shape'..i..' \"\"]') end
138 | for i=1,countpath do SKIN:Bang('[!SetOption Shape Path'..i..' \"\"]') end
139 | end
140 |
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/FileLoader.lua:
--------------------------------------------------------------------------------
1 | local FileLoadQueue = {}
2 | local IsLoading = false
3 | FileLoadFinishedCallback = {}
4 |
5 | function LoadFilesCallback()
6 | local measure = SKIN:GetMeasure("FileReader")
7 | local files = measure:GetStringValue()
8 | local allFiles = split(files, "\n")
9 |
10 | if #FileLoadQueue > 0 then
11 | local top = FileLoadQueue[1]
12 | top[2](allFiles)
13 | table.remove(FileLoadQueue, 1)
14 | end
15 |
16 | if #FileLoadQueue > 0 then
17 | local top = FileLoadQueue[1]
18 | local path = top[1]
19 | SKIN:Bang("[!SetOption FileReader StartInFolder \"".. path.. "\"][!UpdateMeasure FileReader][!CommandMeasure FileReader Run]")
20 | else
21 | IsLoading = false
22 | for _,j in pairs(FileLoadFinishedCallback) do j() end
23 | end
24 | end
25 |
26 | function LoadFiles(path, functionCallback)
27 | FileLoadQueue[#FileLoadQueue + 1] = {path, functionCallback}
28 | if not IsLoading then
29 | SKIN:Bang("[!SetOption FileReader StartInFolder \"".. path.. "\"][!UpdateMeasure FileReader][!CommandMeasure FileReader Run]")
30 | IsLoading = true
31 | end
32 | end
33 |
34 | function IsFilesLoading() return IsLoading end
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/HelperFunctions.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | Removes spaces before and after the string
4 |
5 | --]]
6 | function trim(s)
7 | if s == nil then return nil end
8 | return (s:gsub("^%s*(.-)%s*$", "%1"))
9 | end
10 |
11 | --[[
12 |
13 | Merges two tables, t2 takes priority and will overwrite values in t1
14 |
15 | --]]
16 |
17 | function tableMerge(t1, t2)
18 | for k,v in pairs(t2) do
19 | if type(v) == "table" then
20 | if type(t1[k] or false) == "table" then
21 | t1[k] = tableMerge(t1[k] or {}, t2[k] or {})
22 | else
23 | t1[k] = v
24 | end
25 | else
26 | t1[k] = v
27 | end
28 | end
29 | return t1
30 | end
31 |
32 | --[[
33 |
34 | Splits string at separator
35 |
36 | --]]
37 |
38 | function split(inputstr, sep)
39 | if sep == nil then
40 | sep = "%s"
41 | end
42 | local t={} ; i=1
43 | for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
44 | t[i] = str
45 | i = i + 1
46 | end
47 | return t
48 | end
49 |
50 |
51 | --[[
52 |
53 | No regex, so manual number crunching.
54 |
55 | Takes a string and parses it into a table of numbers
56 | Warning, svg numbers can be very compressed and are therefore quite difficult to parse manually.
57 | e.g "4.2,3.1-2.3-.3,2-3.2" = {4.2, 3.1, -2.3, -0.3, 2, -3.2}
58 |
59 | --]]
60 |
61 | function parseSvgNumbers(parameters)
62 | local parsedNumbers = {}
63 | local pos = 0
64 | while pos <= #parameters do
65 | local prefix = parameters:find("-", pos)
66 | local nextNumberMax = false
67 | if prefix == nil then prefix = #parameters end
68 |
69 | local dot = parameters:find("%.", pos)
70 | if dot == nil then dot = #parameters end
71 |
72 | local number = parameters:find("[%d]+", pos)
73 | if number == nil then number = #parameters end
74 | local strNum = parameters:match("[%d]+", pos)
75 | if strNum ~= nil then
76 | local nextNumber = parameters:find("[%d]+", number + #strNum)
77 | if nextNumber == nil then nextNumber = #parameters nextNumberMax = true end
78 | local nextStrNum = parameters:match("[%d]+", number + #strNum)
79 |
80 | local separator = parameters:find("%s", pos)
81 | if separator == nil then separator = #parameters end
82 | if separator < number then
83 | separator = number + 1
84 | separator = parameters:find("%s", separator)
85 | if separator == nil then separator = #parameters end
86 | end
87 | local separator2 = parameters:find("%,", pos)
88 | if separator2 == nil then separator2 = #parameters end
89 | if separator2 < number then
90 | separator2 = number + 1
91 | separator2 = parameters:find("%,", separator2)
92 | if separator2 == nil then separator2 = #parameters end
93 | end
94 | if separator > separator2 then separator = separator2 end
95 | local nextPrefix = parameters:find("-", prefix+1)
96 | if nextPrefix == nil then nextPrefix = #parameters end
97 |
98 | local usePrefix = prefix < number
99 | local singleDecimal = dot < number
100 | local isDecimal = singleDecimal or ((prefix < number or prefix >= nextNumber) and nextNumber <= nextPrefix and nextNumber <= separator and not nextNumberMax)
101 | local finalNum = 0
102 | local neg = 1
103 | if usePrefix then
104 | neg = -1
105 | end
106 | if singleDecimal then
107 | finalNum = neg * tonumber("0." .. strNum)
108 | pos = number + #strNum
109 | elseif isDecimal then
110 | finalNum = neg * tonumber(strNum .. "." .. nextStrNum)
111 | pos = nextNumber + #nextStrNum
112 | else
113 | finalNum = neg * tonumber(strNum)
114 | pos = number + #strNum
115 | end
116 | parsedNumbers[#parsedNumbers + 1] = finalNum
117 | else
118 | pos = #parameters + 1
119 | end
120 | end
121 |
122 | return parsedNumbers
123 | end
124 |
125 | function tprint (tbl, indent)
126 | if not indent then indent = 0 end
127 | for k, v in pairs(tbl) do
128 | formatting = string.rep(" ", indent) .. k .. ": "
129 | if type(v) == "table" then
130 | print(formatting)
131 | tprint(v, indent+1)
132 | elseif type(v) == "boolean" then
133 | local val = ""
134 | if tprint then val = "true" else val = "false" end
135 | print(formatting.. val)
136 | else
137 | print(formatting .. v)
138 | end
139 | end
140 | end
141 |
142 | function deepcopy(orig)
143 | local orig_type = type(orig)
144 | local copy
145 | if orig_type == 'table' then
146 | copy = {}
147 | for orig_key, orig_value in next, orig, nil do
148 | copy[deepcopy(orig_key)] = deepcopy(orig_value)
149 | end
150 | setmetatable(copy, deepcopy(getmetatable(orig)))
151 | else -- number, string, boolean, etc
152 | copy = orig
153 | end
154 | return copy
155 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/ModifierHandler.lua:
--------------------------------------------------------------------------------
1 |
2 | function getModifiers(attributes) -- TODO: ADD MORE MODIFIERS
3 | if attributes == nil then
4 | return attributes
5 | end
6 | local modifiers = {}
7 | modifiers["Special"] = {}
8 | modifiers["Special"]["Display"] = true
9 |
10 | if attributes["style"] ~= nil then
11 | modifiers = dissectInkScape(modifiers, attributes["style"])
12 | else
13 | modifiers = dissectHTML(modifiers, attributes)
14 | end
15 | return modifiers
16 | end
17 |
18 | function mergeModifiers(groupModifiers, modifiers)
19 | if groupModifiers ~= nil and modifiers ~= nil then
20 | local merged = tableMerge(groupModifiers, modifiers)
21 | return merged
22 | elseif modifiers ~= nil then
23 | return modifiers
24 | elseif groupModifiers ~= nil then
25 | return groupModifiers
26 | end
27 | return {}
28 | end
29 |
30 | function newShape(groupModifiers, attributes)
31 | local modifiers = getModifiers(attributes)
32 | local shape = {}
33 | shape["modifiers"] = mergeModifiers(groupModifiers, modifiers)
34 | return shape
35 | end
36 |
37 | local colorKeywords = dofile(ColorKeywordsPath)
38 |
39 | function getCssColor(color)
40 | if color == nil or type(color) ~= "string" then
41 | return nil
42 | end
43 |
44 | color = trim(color:lower())
45 |
46 | if colorKeywords[color] ~= nil then
47 | return colorKeywords[color]
48 | elseif color:sub(1, 3) == "rgb" then
49 | return color:gsub("rgb", ""):gsub("%(", ""):gsub("%)", "")
50 | else
51 | color = color:gsub("#", "")
52 | local r = tonumber(color:sub(1, 2), 16)
53 | local g = tonumber(color:sub(3, 4), 16)
54 | local b = tonumber(color:sub(5, 6), 16)
55 |
56 | return "" .. r .. ", " .. g .. ", " .. b
57 | end
58 | if color == "none" then return "0, 0, 0, 0" end
59 | end
60 |
61 | local
62 |
63 | function cssToShapeModifier(modifiers, modifierName, modifierValue)
64 |
65 | if modifierName == nil then return end
66 | if modifierValue == nil then
67 | modifiers[modifierName] = nil
68 | end
69 |
70 | if modifierName == "display" then
71 | if modifierValue == "none" then
72 | modifiers["Special"]["Display"] = false
73 | end
74 | end
75 |
76 | -- These are modifiers with direct bindings
77 | if modifierName == "fill" then modifiers["fill color"] = getCssColor(modifierValue) end
78 | if modifierName == "stroke" then modifiers["stroke color"] = getCssColor(modifierValue) end
79 | if modifierName == "stroke-width" then modifiers["StrokeWidth"] = modifierValue:gsub("px", "") end
80 |
81 | -- These are attributes that can be done, but there is no direct modifier binding to them
82 | if modifierName == "stroke-opacity" then modifiers["Special"]["StrokeOpcaity"] = modifierValue end
83 | if modifierName == "fill-opacity" then modifiers["Special"]["FillOpcaity"] = modifierValue end
84 |
85 |
86 | -- TODO, ADD FILLMODE WHEN WE GET WINDING ;)
87 |
88 | end
89 |
90 | function dissectInkScape(modifiers, style)
91 | local styleParts = split(style, ";")
92 | for i,part in pairs(styleParts) do
93 | local stylePair = split(part, ":")
94 | local styleName = trim(stylePair[1])
95 | local styleValue = trim(stylePair[2])
96 | cssToShapeModifier(modifiers, trim(styleName), trim(styleValue))
97 |
98 | end
99 | return modifiers
100 | end
101 |
102 | function dissectHTML(modifiers, attributes)
103 | for i,j in pairs(attributes) do
104 | cssToShapeModifier(modifiers, trim(i), trim(j))
105 | end
106 | return modifiers
107 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/MouseHandler.lua:
--------------------------------------------------------------------------------
1 | local Events = {
2 | MouseMove = {},
3 | LeftMouseDown = {},
4 | LeftMouseUp = {},
5 | }
6 |
7 | function SubscribeMouseEvent(callbackFunc, measureName, eventType)
8 | if Events[eventType] == nil then
9 | print("Mouse event type:", eventType, "does not exist")
10 | return
11 | end
12 |
13 | if measureName == nil or callbackFunc == nil then
14 | print("Could not subscribe to event. MeasureName or Callbackfunction was nil")
15 | return
16 | end
17 | Events[eventType][measureName] = callbackFunc
18 | end
19 |
20 | function UnsubscribeMouseEvent(measureName, eventType)
21 | if Events[eventType] == nil then
22 | print("Mouse event type:", eventType, "does not exist")
23 | return
24 | end
25 |
26 | if measureName == nil then
27 | print("Could not unsubscribe from event. MeasureName was nil")
28 | return
29 | end
30 |
31 | if Events[eventType][measureName] == nil then
32 | print("No callback subscribed to event ", eventType, " for measure ", measureName)
33 | return
34 | end
35 | Events[eventType][measureName] = nil
36 | end
37 |
38 | function MouseMove(mouseX, mouseY)
39 | for measure, callback in pairs(Events["MouseMove"]) do
40 | bang = "[!CommandMeasure ".. measure .." " .. callback .."(" .. mouseX .. "," .. mouseY .. ")]"
41 | SKIN:Bang(bang)
42 | end
43 | end
44 |
45 | function LeftMouseReleased(mouseX, mouseY)
46 | for measure, callback in pairs(Events["LeftMouseUp"]) do
47 | bang = "[!CommandMeasure ".. measure .." " .. callback .."(" .. mouseX .. "," .. mouseY .. ")]"
48 | SKIN:Bang(bang)
49 | end
50 | end
51 |
52 | function Initialize()
53 |
54 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/PathTypes/A.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | the Arc segment is one or multiple arcs
4 |
5 | parameters - a table of numbers that is the numbers trailing the segment character (e.g "M 200, 300")
6 | pen - the current pen location (table: { X= xPos, Y = yPos} )
7 | shape - the current shape
8 | relative - is this relative to the last pen location
9 |
10 | --]]
11 |
12 | return function (parameters, pen, shape, relative)
13 | for i=1, #parameters, 7 do
14 | local rx = tonumber(parameters[i])
15 | local ry = tonumber(parameters[i+1])
16 | local rotationAngle = tonumber(parameters[i+2])
17 | local arcSize = tonumber(parameters[i+3])
18 | local sweep = tonumber(parameters[i+4])
19 | sweep = 1 - sweep
20 | local x = tonumber(parameters[i+5])
21 | local y = tonumber(parameters[i+6])
22 | if relative then
23 | x = x + pen.X
24 | y = y + pen.Y
25 | end
26 |
27 | shape["path"] = shape["path"] .. " | ArcTo " .. x .. ", " .. y .. ", " .. rx .. ", " .. ry .. ", " .. rotationAngle .. ", " .. sweep .. ", " .. arcSize
28 |
29 | lastControlX = nil
30 | lastControlY = nil
31 | lastQuadraticX = nil
32 | lastQuadraticY = nil
33 | pen.X = x
34 | pen.Y = y
35 | end
36 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/PathTypes/C.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | the Curve segment is one or multiple bezier curves
4 |
5 | parameters - a table of numbers that is the numbers trailing the segment character (e.g "M 200, 300")
6 | pen - the current pen location (table: { X= xPos, Y = yPos} )
7 | shape - the current shape
8 | relative - is this relative to the last pen location
9 |
10 | --]]
11 |
12 | return function (parameters, pen, shape, relative)
13 | for i=1, #parameters, 6 do
14 | --if parameters[i] ~= nil and parameters[i+1] ~= nil and parameters[i+2] ~= nil and parameters[i+3] ~= nil and parameters[i+4] ~= nil and parameters[i+5] ~= nil then
15 | local x1 = tonumber(parameters[i])
16 | local y1 = tonumber(parameters[i+1])
17 | local x2 = tonumber(parameters[i+2])
18 | local y2 = tonumber(parameters[i+3])
19 | local x = tonumber(parameters[i+4])
20 | local y = tonumber(parameters[i+5])
21 | if relative then
22 | x1 = x1 + pen.X
23 | y1 = y1 + pen.Y
24 | x2 = x2 + pen.X
25 | y2 = y2 + pen.Y
26 | x = x + pen.X
27 | y = y + pen.Y
28 | end
29 | shape["path"] = shape["path"] .. " | CurveTo " .. x .. ", " .. y .. ", " .. x1 .. ", " .. y1 .. ", " .. x2 .. ", " .. y2
30 | if relative then
31 | x = x - pen.X
32 | y = y - pen.Y
33 | x2 = x2 - pen.X
34 | y2 = y2 - pen.Y
35 | end
36 | lastControlX = x2 + (x - x2) * 2
37 | lastControlY = y2 + (y - y2) * 2
38 | lastQuadraticX = nil
39 | lastQuadraticY = nil
40 |
41 | if relative then
42 | x = x + pen.X
43 | y = y + pen.Y
44 | lastControlX = lastControlX + pen.X
45 | lastControlY = lastControlY + pen.Y
46 | end
47 | pen.X = x
48 | pen.Y = y
49 | --else
50 | -- print("Invalid bezier curve ", parameters[i], parameters[i+1], parameters[i+2], parameters[i+3], parameters[i+4], parameters[i+5])
51 | --end
52 | end
53 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/PathTypes/H.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | the Horizontal LineTo segment is one or multiple horizontal lines
4 |
5 | parameters - a table of numbers that is the numbers trailing the segment character (e.g "M 200, 300")
6 | pen - the current pen location (table: { X= xPos, Y = yPos} )
7 | shape - the current shape
8 | relative - is this relative to the last pen location
9 |
10 | --]]
11 |
12 | return function (parameters, pen, shape, relative)
13 | for i=1, #parameters do
14 | local x = tonumber(parameters[i])
15 | if relative then
16 | x = x + pen.X
17 | end
18 | shape["path"] = shape["path"] .. " | LineTo " .. x .. ", " .. pen.Y
19 | pen.X = x
20 | lastControlX = x2
21 | lastControlY = y2
22 | lastQuadraticX = nil
23 | lastQuadraticY = nil
24 | end
25 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/PathTypes/L.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | the LineTo segment is one or multiple lines
4 |
5 | parameters - a table of numbers that is the numbers trailing the segment character (e.g "M 200, 300")
6 | pen - the current pen location (table: { X= xPos, Y = yPos} )
7 | shape - the current shape
8 | relative - is this relative to the last pen location
9 |
10 | --]]
11 |
12 | return function (parameters, pen, shape, relative)
13 | for i=1, #parameters, 2 do
14 | local x = tonumber(parameters[i])
15 | local y = tonumber(parameters[i+1])
16 | if relative then
17 | x = x + pen.X
18 | y = y + pen.Y
19 | end
20 | shape["path"] = shape["path"] .. " | LineTo " .. x .. ", " .. y
21 | pen.X = x
22 | pen.Y = y
23 | lastControlX = x2
24 | lastControlY = y2
25 | lastQuadraticX = nil
26 | lastQuadraticY = nil
27 | end
28 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/PathTypes/M.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | MoveTo segment, this indicates where the path should start and is the same as lifting the pen and moving it to a new location. (e.g starting a new Path shape)
4 |
5 | Note: additional parameters after the initial point is counted as LineTo, hence the "pathSegments:L()"
6 |
7 | parameters - a table of numbers that is the numbers trailing the segment character (e.g "M 200, 300")
8 | pen - the current pen location (table: { X= xPos, Y = yPos} )
9 | shape - the current shape
10 | relative - is this relative to the last pen location
11 |
12 | --]]
13 |
14 | return function (parameters, pen, shape, relative)
15 | local x = tonumber(parameters[1])
16 | local y = tonumber(parameters[2])
17 | if relative then
18 | x = x + pen.X
19 | y = y + pen.Y
20 | end
21 | local moveShape = nil
22 | if shape["path"] ~= nil and trim(shape["path"]) ~= "" then
23 | local newShape = {}
24 | newShape["modifiers"] = deepcopy(shape["modifiers"])
25 | newShape["shape"] = "Path Path" .. nextPath
26 | nextPath = nextPath + 1
27 | moveShape = newShape
28 | else
29 | moveShape = shape
30 | end
31 | moveShape["path"] = x .. ", " .. y
32 | pen.X = x
33 | pen.Y = y
34 | lastControlX = x2
35 | lastControlY = y2
36 | lastQuadraticX = nil
37 | lastQuadraticY = nil
38 | table.remove(parameters, 1)
39 | table.remove(parameters, 1)
40 | pathSegments.L(parameters, pen, moveShape, relative)
41 | return moveShape
42 | end
43 |
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/PathTypes/Q.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | the Quadratic Curve segment is one or multiple quadratic bezier curves
4 |
5 | parameters - a table of numbers that is the numbers trailing the segment character (e.g "M 200, 300")
6 | pen - the current pen location (table: { X= xPos, Y = yPos} )
7 | shape - the current shape
8 | relative - is this relative to the last pen location
9 |
10 | --]]
11 |
12 | return function (parameters, pen, shape, relative)
13 | for i=1, #parameters, 4 do
14 | local x1 = tonumber(parameters[i])
15 | local y1 = tonumber(parameters[i+1])
16 | local x = tonumber(parameters[i+2])
17 | local y = tonumber(parameters[i+3])
18 | if relative then
19 | x1 = x1 + pen.X
20 | y1 = y1 + pen.Y
21 | x = x + pen.X
22 | y = y + pen.Y
23 | end
24 | shape["path"] = shape["path"] .. " | CurveTo " .. x .. ", " .. y .. ", " .. x1 .. ", " .. y1
25 | if relative then
26 | x = x - pen.X
27 | y = y - pen.Y
28 | x1 = x1 - pen.X
29 | y1 = y1 - pen.Y
30 | end
31 | lastControlX = nil
32 | lastControlY = nil
33 | lastQuadraticX = x1 + (x - x1) * 2
34 | lastQuadraticY = y1 + (y - y1) * 2
35 |
36 | if relative then
37 | x = x + pen.X
38 | y = y + pen.Y
39 | lastQuadraticX = lastQuadraticX + pen.X
40 | lastQuadraticY = lastQuadraticY + pen.Y
41 | end
42 | pen.X = x
43 | pen.Y = y
44 | end
45 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/PathTypes/S.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | the Simple Curve segment is one or multiple simplified bezier curves
4 |
5 | parameters - a table of numbers that is the numbers trailing the segment character (e.g "M 200, 300")
6 | pen - the current pen location (table: { X= xPos, Y = yPos} )
7 | shape - the current shape
8 | relative - is this relative to the last pen location
9 |
10 | --]]
11 |
12 | return function (parameters, pen, shape, relative)
13 | for i=1, #parameters, 4 do
14 | local x2 = tonumber(parameters[i])
15 | local y2 = tonumber(parameters[i+1])
16 | local x = tonumber(parameters[i+2])
17 | local y = tonumber(parameters[i+3])
18 | if relative then
19 | x2 = x2 + pen.X
20 | y2 = y2 + pen.Y
21 | x = x + pen.X
22 | y = y + pen.Y
23 | end
24 |
25 | if lastControlX == nil then
26 | lastControlX = x2
27 | end
28 | if lastControlY == nil then
29 | lastControlY = y2
30 | end
31 |
32 | shape["path"] = shape["path"] .. " | CurveTo " .. x .. ", " .. y .. ", " .. lastControlX .. ", " .. lastControlY .. ", " .. x2 .. ", " .. y2
33 |
34 | if relative then
35 | x = x - pen.X
36 | y = y - pen.Y
37 | x2 = x2 - pen.X
38 | y2 = y2 - pen.Y
39 | end
40 | lastControlX = x2 + (x - x2) * 2
41 | lastControlY = y2 + (y - y2) * 2
42 | lastQuadraticX = nil
43 | lastQuadraticY = nil
44 |
45 | if relative then
46 | x = x + pen.X
47 | y = y + pen.Y
48 | lastControlX = lastControlX + pen.X
49 | lastControlY = lastControlY + pen.Y
50 | end
51 |
52 | pen.X = x
53 | pen.Y = y
54 | end
55 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/PathTypes/T.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | the Simplified Quadratic Curve segment is one or multiple simple quadratic bezier curves
4 |
5 | parameters - a table of numbers that is the numbers trailing the segment character (e.g "M 200, 300")
6 | pen - the current pen location (table: { X= xPos, Y = yPos} )
7 | shape - the current shape
8 | relative - is this relative to the last pen location
9 |
10 | --]]
11 |
12 | return function(parameters, pen, shape, relative)
13 | for i=1, #parameters, 2 do
14 | local x = tonumber(parameters[i])
15 | local y = tonumber(parameters[i+1])
16 | if relative then
17 | x = x + pen.X
18 | y = y + pen.Y
19 | end
20 |
21 | if lastQuadraticX == nil then
22 | lastQuadraticX = x2
23 | end
24 | if lastQuadraticY == nil then
25 | lastQuadraticY = y2
26 | end
27 |
28 | shape["path"] = shape["path"] .. " | CurveTo " .. x .. ", " .. y .. ", " .. lastQuadraticX .. ", " .. lastQuadraticY
29 |
30 | if relative then
31 | x = x - pen.X
32 | y = y - pen.Y
33 | end
34 | lastControlX = nil
35 | lastControlY = nil
36 | lastQuadraticX = lastQuadraticX + (x - lastQuadraticX) * 2
37 | lastQuadraticY = lastQuadraticY + (y - lastQuadraticY) * 2
38 |
39 | if relative then
40 | x = x + pen.X
41 | y = y + pen.Y
42 | lastControlX = lastControlX + pen.X
43 | lastControlY = lastControlY + pen.Y
44 | end
45 |
46 | pen.X = x
47 | pen.Y = y
48 | end
49 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/PathTypes/V.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | the Vertical LineTo segment is one or multiple vertical lines
4 |
5 | parameters - a table of numbers that is the numbers trailing the segment character (e.g "M 200, 300")
6 | pen - the current pen location (table: { X= xPos, Y = yPos} )
7 | shape - the current shape
8 | relative - is this relative to the last pen location
9 |
10 | --]]
11 |
12 | return function (parameters, pen, shape, relative)
13 | for i=1, #parameters do
14 | local y = tonumber(parameters[i])
15 | if relative then
16 | y = y + pen.Y
17 | end
18 | shape["path"] = shape["path"] .. " | LineTo " .. pen.X .. ", " .. y
19 | pen.Y = y
20 | lastControlX = x2
21 | lastControlY = y2
22 | lastQuadraticX = nil
23 | lastQuadraticY = nil
24 | end
25 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/PathTypes/Z.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | the close path segment closes the path.
4 |
5 | parameters - a table of numbers that is the numbers trailing the segment character (e.g "M 200, 300")
6 | pen - the current pen location (table: { X= xPos, Y = yPos} )
7 | shape - the current shape
8 | relative - is this relative to the last pen location
9 |
10 | --]]
11 |
12 | return function (parameters, pen, shape, relative)
13 | shape["path"] = shape["path"] .. " | ClosePath 1"
14 | lastControlX = x2
15 | lastControlY = y2
16 | lastQuadraticX = nil
17 | lastQuadraticY = nil
18 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/ReplaceText.lua:
--------------------------------------------------------------------------------
1 | function replacetext()
2 | text = SKIN:GetMeasure('MeasureHour'):GetStringValue()
3 | font = SELF:GetOption('Font')
4 | size = SELF:GetOption('Size')
5 | file = io.open(SKIN:MakePathAbsolute(SELF:GetOption("SVGfile")), "w")
6 | template={"",""}
7 | file:write(table.concat(template, "\n"))
8 | file:close()
9 |
10 | SKIN:Bang('[!Commandmeasure ScriptVectorConverter "ClearAllShapePath()"][!CommandMeasure Inkscape "Run"]')
11 |
12 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/SvgTypes/circle.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | This converts the tag in .svg to a shape that rainmeter can use
4 |
5 | shapes - All shapes generated so far, do "shapes[#shapes + 1] = shape" to add a new shape
6 | attributes - This is the attributes for the tag (e.g , class is an attribute to the svg tag )
7 | children - All the tags inside the current tag
8 | groupModifiers - These are modifiers that is applied through inheritence by the tag
9 | value - The actual value of the tag (e.g the content inside that tags that are not other tags.)
10 |
11 | --]]
12 |
13 | return function (shapes, attributes, children, groupModifiers, value)
14 | local shape = newShape(groupModifiers, attributes)
15 | local x = attributes["cx"]
16 | local y = attributes["cy"]
17 | local r = attributes["r"]
18 | shape["shape"] = "Ellipse " .. x .. ", " .. y .. ", " .. r
19 | local class = attributes["class"]
20 | if shapeStyles[class] ~= nil then
21 | shape["modifiers"] = mergeModifiers(shape["modifiers"], shapeStyles[class])
22 | end
23 | shapes[#shapes+1] = shape
24 | return shapes
25 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/SvgTypes/defs.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | This handles the tag that can be used in the .svg format
4 | This is probably not fully implemented as i'm only sending the tag that appears here into the parser again to be handled in style.lua
5 |
6 | shapes - All shapes generated so far, do "shapes[#shapes + 1] = shape" to add a new shape
7 | attributes - This is the attributes for the tag (e.g , class is an attribute to the svg tag )
8 | children - All the tags inside the current tag
9 | groupModifiers - These are modifiers that is applied through inheritence by the tag
10 | value - The actual value of the tag (e.g the content inside that tags that are not other tags.)
11 |
12 | ]]
13 |
14 | return function (shapes, attributes, children, groupModifiers, value)
15 | --for i, j in pairs(children) do
16 | -- shapes = getShape(j, shapes, groupModifiers)
17 | --end
18 |
19 | --TODO: this
20 | return shapes
21 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/SvgTypes/g.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | This handles the tag, which styles it's children.
4 |
5 | shapes - All shapes generated so far, do "shapes[#shapes + 1] = shape" to add a new shape
6 | attributes - This is the attributes for the tag (e.g , class is an attribute to the svg tag )
7 | children - All the tags inside the current tag
8 | groupModifiers - These are modifiers that is applied through inheritence by the tag
9 | value - The actual value of the tag (e.g the content inside that tags that are not other tags.)
10 |
11 | --]]
12 |
13 | return function (shapes, attributes, children, groupModifiers, value) -- group
14 | debugPrint("group")
15 | if children ~= nil then
16 | local mods = getModifiers(attributes)
17 | groupModifiers = mergeModifiers(groupModifiers, mods)
18 | local class = attributes["class"]
19 | if shapeStyles[class] ~= nil then
20 | groupModifiers = mergeModifiers(groupModifiers, shapeStyles[class])
21 | end
22 | for i, j in pairs(children) do
23 | shapes = getShape(j, shapes, groupModifiers)
24 | end
25 | end
26 | return shapes
27 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/SvgTypes/path.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | This converts the tag in .svg to a shape that rainmeter can use
4 |
5 | Note: This is a pretty advanced tag, and i've therefore made the segments into modules inside #@#Scripts/PathTypes
6 |
7 | shapes - All shapes generated so far, do "shapes[#shapes + 1] = shape" to add a new shape
8 | attributes - This is the attributes for the tag (e.g , class is an attribute to the svg tag )
9 | children - All the tags inside the current tag
10 | groupModifiers - These are modifiers that is applied through inheritence by the tag
11 | value - The actual value of the tag (e.g the content inside that tags that are not other tags.)
12 |
13 | --]]
14 |
15 | -- Table where the functions of all the path types are stored
16 | pathSegments = {}
17 |
18 | --These are used for the C, S, Q and T segments, used to calculate the S and T control points
19 | lastControlX = nil
20 | lastControlY = nil
21 | lastQuadraticX = nil
22 | lastQuadraticY = nil
23 |
24 | local pathSegmentDir = SKIN:ReplaceVariables("#@#Scripts\\PathTypes\\")
25 |
26 | local function LoadPathSegments(files)
27 | for id, file in pairs(files) do
28 | fileName = split(file, ".")[1]
29 | pathSegments[fileName] = dofile(pathSegmentDir .. file)
30 | end
31 | print("Path segments loaded")
32 | end
33 |
34 | LoadFiles(pathSegmentDir, LoadPathSegments)
35 |
36 | function parsePath(input)
37 | local out = {};
38 |
39 | for instr, vals in input:gmatch("([a-df-zA-DF-Z])([^a-df-zA-DF-Z]*)") do
40 | local line = { instr };
41 | local carry = nil
42 | for v in vals:gmatch("([+-]?[%deE.]+)") do
43 | if v:match("[eE]") then
44 | carry = v
45 | else
46 | if carry then
47 | line[#line+1] = carry .. v;
48 | carry = nil
49 | else
50 | line[#line+1] = v;
51 | end
52 | end
53 |
54 | end
55 | out[#out+1] = line;
56 | end
57 | return out;
58 | end
59 |
60 |
61 | return function (shapes, attributes, children, groupModifiers, value)
62 | local shape = newShape(groupModifiers, attributes)
63 | local class = attributes["class"]
64 | if shapeStyles[class] ~= nil then
65 | shape["modifiers"] = mergeModifiers(shapeStyles[class], shape["modifiers"])
66 | end
67 | shape["shape"] = "Path Path" .. nextPath
68 | nextPath = nextPath + 1
69 | --local path = trim(attributes["d"]:gsub("%s+", " "))
70 | local pen = {X = 0, Y = 0}
71 |
72 | local combine = ""
73 | local fistCombine = true
74 | local shapeCount = 0
75 | local iterations = 0
76 |
77 | local special = shape["modifiers"]["Special"]
78 |
79 | local segments = parsePath(attributes["d"])
80 | for i=1, #segments do
81 | local parameters = segments[i]
82 | local char = parameters[1]
83 | table.remove(parameters, 1)
84 |
85 | if pathSegments[char:upper()] ~= nil then
86 | local relative = char:lower() == char
87 | local nextShape = pathSegments[char:upper()](parameters, pen, shape, relative)
88 |
89 | if nextShape ~= nil and nextShape ~= shape then
90 | if fistCombine then
91 | combine = "Combine Shape" .. (#shapes + 1)
92 | fistCombine = false
93 | else
94 | combine = combine .. " | XOR Shape" .. (#shapes + 1)
95 | shape["modifiers"] = {}
96 | shape["modifiers"]["Special"] = special
97 | end
98 | shapes[#shapes+1] = shape
99 | shape = nextShape
100 | shapeCount = shapeCount + 1
101 | end
102 | else
103 | print("Path segment by type " .. char:upper() .. " does not exist!")
104 | end
105 | iterations = iterations + 1
106 | end
107 |
108 | if shape["shape"] ~= nil and trim(shape["shape"]) ~= "" and iterations > 1 then
109 | if fistCombine then
110 | combine = "Combine Shape" .. (#shapes + 1)
111 | fistCombine = false
112 | else
113 | combine = combine .. " | XOR Shape" .. (#shapes + 1)
114 | shape["modifiers"] = {}
115 | shape["modifiers"]["Special"] = special
116 | end
117 | shapes[#shapes+1] = shape
118 | shape = nextShape
119 | shapeCount = shapeCount + 1
120 | else
121 | nextPath = nextPath - 1
122 | end
123 |
124 | if combine ~= "" and shapeCount > 1 then
125 | local combinedShape = {modifiers = {}}
126 | combinedShape["shape"] = combine
127 | combinedShape["modifiers"]["Special"] = special
128 | combinedShape["combined"] = true
129 | shapes[#shapes+1] = combinedShape
130 | end
131 |
132 | return shapes
133 | end
134 |
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/SvgTypes/polygon.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | This converts the tag in .svg to a shape that rainmeter can use
4 |
5 | shapes - All shapes generated so far, do "shapes[#shapes + 1] = shape" to add a new shape
6 | attributes - This is the attributes for the tag (e.g , class is an attribute to the svg tag )
7 | children - All the tags inside the current tag
8 | groupModifiers - These are modifiers that is applied through inheritence by the tag
9 | value - The actual value of the tag (e.g the content inside that tags that are not other tags.)
10 |
11 | --]]
12 |
13 | return function (shapes, attributes, children, groupModifiers, value)
14 |
15 | local shape = newShape(groupModifiers, attributes)
16 | local class = attributes["class"]
17 | shape["modifiers"] = mergeModifiers(shape["modifiers"], shapeStyles[class])
18 | debugPrint("polygon")
19 | local parameters = attributes["points"]
20 | parameters = trim(parameters:gsub("%s+", " "))
21 |
22 | parameters = parseSvgNumbers(parameters)
23 |
24 | local path = ""
25 | local first = true
26 | for i=1, #parameters, 2 do
27 | local x = tonumber(parameters[i])
28 | local y = tonumber(parameters[i+1])
29 | if first then
30 | path = path .. x .. ", " .. y
31 | first = false
32 | else
33 | path = path .. " | LineTo " .. x .. ", " .. y
34 | end
35 | end
36 | path = path .. " | ClosePath 1"
37 |
38 | shape["shape"] = "Path Path"..nextPath
39 | shape["path"] = path
40 | nextPath = nextPath + 1
41 |
42 | local class = attributes["class"]
43 | if shapeStyles[class] ~= nil then
44 | shape["modifiers"] = mergeModifiers(shape["modifiers"], shapeStyles[class])
45 | end
46 |
47 | shapes[#shapes+1] = shape
48 | return shapes
49 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/SvgTypes/rect.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | This converts the tag in .svg to a shape that rainmeter can use
4 |
5 | shapes - All shapes generated so far, do "shapes[#shapes + 1] = shape" to add a new shape
6 | attributes - This is the attributes for the tag (e.g , class is an attribute to the svg tag )
7 | children - All the tags inside the current tag
8 | groupModifiers - These are modifiers that is applied through inheritence by the tag
9 | value - The actual value of the tag (e.g the content inside that tags that are not other tags.)
10 |
11 | --]]
12 |
13 | return function (shapes, attributes, children, groupModifiers, value)
14 | local shape = newShape(groupModifiers, attributes)
15 | local x = attributes["x"]
16 | if x == nil then x = 0 end
17 | local y = attributes["y"]
18 | if y == nil then y = 0 end
19 | local w = attributes["width"]
20 | local h = attributes["height"]
21 | shape["shape"] = "Rectangle " .. x .. ", " .. y .. ", " .. w .. ", " .. h
22 | local class = attributes["class"]
23 | if shapeStyles[class] ~= nil then
24 | shape["modifiers"] = mergeModifiers(shape["modifiers"], shapeStyles[class])
25 | end
26 | shapes[#shapes+1] = shape
27 | return shapes
28 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/SvgTypes/style.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | handles the tag in the .svg, and saves them to the shapeStyles table to be fetched later.
4 |
5 | Note: only classes are handled for now, i assume that ids will probably appear, but i have yet to implement that
6 |
7 | shapes - All shapes generated so far, do "shapes[#shapes + 1] = shape" to add a new shape
8 | attributes - This is the attributes for the tag (e.g , class is an attribute to the svg tag )
9 | children - All the tags inside the current tag
10 | groupModifiers - These are modifiers that is applied through inheritence by the tag
11 | value - The actual value of the tag (e.g the content inside that tags that are not other tags.)
12 |
13 | --]]
14 |
15 | return function (shapes, attributes, children, groupModifiers, value)
16 | local firstSplit = split(value, "}")
17 | for i, stylePart in pairs(firstSplit) do
18 | local idContentPair = split(stylePart, "{")
19 | local ids = split(idContentPair[1], ",")
20 | for j, id in pairs(ids) do
21 | local id = trim(id):sub(2)
22 | local content = idContentPair[2]
23 | local att = {}
24 | att["style"] = content
25 | local modifiers = getModifiers(att)
26 | shapeStyles[id] = mergeModifiers(modifiers, shapeStyles[id])
27 | end
28 | end
29 | return shapes
30 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/SvgTypes/svg.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | This handles the tag, which declares that the following is a svg shape
4 |
5 | shapes - All shapes generated so far, do "shapes[#shapes + 1] = shape" to add a new shape
6 | attributes - This is the attributes for the tag (e.g , class is an attribute to the svg tag )
7 | children - All the tags inside the current tag
8 | groupModifiers - These are modifiers that is applied through inheritence by the tag
9 | value - The actual value of the tag (e.g the content inside that tags that are not other tags.)
10 |
11 | ]]
12 |
13 | return function (shapes, attributes, children, groupModifiers, value)
14 | debugPrint("svg", children, attributes)
15 | if children == nil then
16 | print(ErrorEmptySVG)
17 | return nil
18 | end
19 | if attributes == nil then
20 | print(CorruptSVG)
21 | return nil
22 | end
23 |
24 | if attributes["viewBox"] ~= nil then
25 | local view = split(attributes["viewBox"], " ")
26 | local x = view[1]
27 | local y = view[2]
28 | local width = view[3]
29 | local height = view[4]
30 | shapes["X"] = tostring(-tonumber(x))
31 | shapes["Y"] = tostring(-tonumber(y))
32 | shapes["width"] = width
33 | shapes["height"] = height
34 | end
35 |
36 | for i, j in pairs(children) do
37 | shapes = getShape(j, shapes, groupModifiers)
38 | end
39 | return shapes
40 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/WindowHandler.lua:
--------------------------------------------------------------------------------
1 | local savedW = 0
2 | local savedH = 0
3 | local savedX = 0
4 | local savedY = 0
5 |
6 | function ToggleMaximize()
7 | SKIN:Bang("[!AutoSelectScreen 1]")
8 | local isMaximized = tonumber(SKIN:GetVariable("WindowMaximized"))
9 | local WindowPosX = tonumber(SKIN:GetVariable("CURRENTCONFIGX"))
10 | local WindowPosY = tonumber(SKIN:GetVariable("CURRENTCONFIGY"))
11 | local windowWidth = tonumber(SKIN:GetVariable("WindowW"))
12 | local windowHeight = tonumber(SKIN:GetVariable("WindowH"))
13 |
14 | local workAreaX = tonumber(SKIN:GetVariable("WORKAREAX"))
15 | local workAreaY = tonumber(SKIN:GetVariable("WORKAREAY"))
16 | local dragMargin = tonumber(SKIN:GetVariable("WindowDragMarginSize"))
17 |
18 | isMaximized = math.abs(-isMaximized + 1) -- switch maximized
19 |
20 |
21 | local bang = ""
22 | bang = bang .. "[!SetVariable WindowMaximized " .. isMaximized .. "]"
23 | bang = bang .. "[!WriteKeyValue Variables WindowMaximized " .. isMaximized .. "]"
24 | if isMaximized == 1 then
25 | bang = bang .. "[!SetVariable WindowPosX (#WORKAREAX# - #WindowDragMarginSize#)][!SetVariable WindowPosY (#WORKAREAY# - #WindowDragMarginSize#)]"
26 | bang = bang .. "[!SetVariable WindowW (#WORKAREAWIDTH#)][!SetVariable WindowH (#WORKAREAHEIGHT#)]"
27 | bang = bang .. "[!WriteKeyValue Variables WindowPosX " .. WindowPosX .. "]"
28 | bang = bang .. "[!WriteKeyValue Variables WindowPosY " .. WindowPosY .. "]"
29 | bang = bang .. "[!WriteKeyValue Variables WindowW " .. windowWidth .. "]"
30 | bang = bang .. "[!WriteKeyValue Variables WindowH " .. windowHeight .. "]"
31 | bang = bang .. "[!HideMeterGroup WindowDragMargin][!UpdateMeter *][!Redraw]"
32 | bang = bang .. "[!Move ".. (workAreaX - dragMargin) .." ".. (workAreaY - dragMargin).."]"
33 | bang = bang .. "[!Draggable 0]"
34 |
35 | -- Store positions for future use
36 | savedX = WindowPosX
37 | savedY = WindowPosY
38 | savedW = windowWidth
39 | savedH = windowHeight
40 | else
41 | bang = bang .. "[!SetVariable WindowPosX " .. savedX .. "][!SetVariable WindowPosY " .. savedY .. "]"
42 | bang = bang .. "[!SetVariable WindowW " .. savedW .. "][!SetVariable WindowH " .. savedH .. "]"
43 | bang = bang .. "[!ShowMeterGroup WindowDragMargin][!UpdateMeter *][!Redraw]"
44 | bang = bang .. "[!Move " .. (savedX) .. " " .. (savedY) .. "]"
45 | bang = bang .. "[!Draggable 1]"
46 | end
47 |
48 | SKIN:Bang(bang)
49 | print(bang)
50 | end
51 |
52 | --[[
53 |
54 | Called when the skin refreshes to set the maximize and size variables
55 |
56 | ]]
57 | local function RefreshMaximize()
58 | local isMaximized = tonumber(SKIN:GetVariable("WindowMaximized"))
59 | local WindowPosX = tonumber(SKIN:GetVariable("WindowPosX"))
60 | local WindowPosY = tonumber(SKIN:GetVariable("WindowPosY"))
61 | local windowWidth = tonumber(SKIN:GetVariable("WindowW"))
62 | local windowHeight = tonumber(SKIN:GetVariable("WindowH"))
63 |
64 | local workAreaX = tonumber(SKIN:GetVariable("WORKAREAX"))
65 | local workAreaY = tonumber(SKIN:GetVariable("WORKAREAY"))
66 | local dragMargin = tonumber(SKIN:GetVariable("WindowDragMarginSize"))
67 |
68 | savedX = WindowPosX
69 | savedY = WindowPosY
70 | savedW = windowWidth
71 | savedH = windowHeight
72 |
73 | if isMaximized == 1 then
74 |
75 | local bang = ""
76 | bang = bang .. "[!SetVariable WindowPosX #WORKAREAX#][!SetVariable WindowPosY #WORKAREAY#]" -- Set position variables
77 | bang = bang .. "[!SetVariable WindowW #WORKAREAWIDTH#][!SetVariable WindowH #WORKAREAHEIGHT#]" -- Set size variables
78 | bang = bang .. "[!UpdateMeter *][!Redraw]" -- Update and Redraw meters
79 | bang = bang .. "[!Move ".. (workAreaX - dragMargin) .." " .. (workAreaY - dragMargin) .."]" -- Move Window
80 | bang = bang .. "[!Draggable 0]"
81 | SKIN:Bang(bang)
82 | print(bang) -- Execute
83 |
84 | else
85 | local WindowPosX = tonumber(SKIN:GetVariable("CURRENTCONFIGX"))
86 | local WindowPosY = tonumber(SKIN:GetVariable("CURRENTCONFIGY"))
87 | savedX = WindowPosX
88 | savedY = WindowPosY
89 | SKIN:Bang("[!Move " .. WindowPosX .. " " .. WindowPosY .. "][!SetVariable WindowPosX " .. WindowPosX .. "][!SetVariable WindowPosY " .. WindowPosY .. "][!Draggable 1]")
90 | end
91 | end
92 |
93 | local Resizing = false
94 | local ResizeBorder = nil
95 | local offsetX = 0
96 | local offsetY = 0
97 |
98 | function MouseMovedCallback(mouseX, mouseY)
99 | if not Resizing then
100 | print("Error, MouseMovedCallback called when not resizing")
101 | return
102 | end
103 |
104 | local skinPosX = tonumber(SKIN:GetVariable("CURRENTCONFIGX"))
105 | local skinPosY = tonumber(SKIN:GetVariable("CURRENTCONFIGY"))
106 | local windowWidth = tonumber(SKIN:GetVariable("WindowW"))
107 | local windowHeight = tonumber(SKIN:GetVariable("WindowH"))
108 | local minWindowWidth = tonumber(SKIN:GetVariable("MinWindowW"))
109 | local minWindowHeight = tonumber(SKIN:GetVariable("MinWindowH"))
110 | local maxWindowWidth = tonumber(SKIN:GetVariable("MaxWindowW"))
111 | local maxWindowHeight = tonumber(SKIN:GetVariable("MaxWindowH"))
112 | local dragMargin = tonumber(SKIN:GetVariable("WindowDragMarginSize"))
113 |
114 | local newWindowX = nil
115 | local newWindowY = nil
116 | local newWindowWidth = nil
117 | local newWindowHeight = nil
118 |
119 | if ResizeBorder == "DragMarginRight" or ResizeBorder == "DragMarginTopRight" or ResizeBorder == "DragMarginBottomRight" then
120 | newWindowWidth = (mouseX - skinPosX - dragMargin - offsetX)
121 | end
122 |
123 | if ResizeBorder == "DragMarginBottom" or ResizeBorder == "DragMarginBottomRight" or ResizeBorder == "DragMarginBottomLeft" then
124 | newWindowHeight = (mouseY - skinPosY - dragMargin - offsetY)
125 | end
126 |
127 | if ResizeBorder == "DragMarginLeft" or ResizeBorder == "DragMarginBottomLeft" or ResizeBorder == "DragMarginTopLeft" then
128 | newWindowX = mouseX - offsetX
129 | newWindowWidth = windowWidth + skinPosX - newWindowX
130 | end
131 |
132 | if ResizeBorder == "DragMarginTop" or ResizeBorder == "DragMarginTopLeft" or ResizeBorder == "DragMarginTopRight" then
133 | newWindowY = mouseY - offsetY
134 | newWindowHeight = windowHeight + skinPosY - newWindowY
135 | end
136 |
137 | local bang = ""
138 |
139 | if newWindowWidth ~= nil then
140 | if newWindowX ~= nil then
141 | if newWindowWidth < minWindowWidth then
142 | newWindowX = newWindowX - minWindowWidth + newWindowWidth
143 | end
144 | if newWindowWidth > maxWindowWidth then
145 | newWindowX = newWindowX - maxWindowWidth + newWindowWidth
146 | end
147 | end
148 | if newWindowWidth < minWindowWidth then newWindowWidth = minWindowWidth end
149 | if newWindowWidth > maxWindowWidth then newWindowWidth = maxWindowWidth end
150 | bang = bang .. "[!SetVariable WindowW " .. newWindowWidth .. "]"
151 | end
152 |
153 | if newWindowHeight ~= nil then
154 | if newWindowY ~= nil then
155 | if newWindowHeight < minWindowHeight then
156 | newWindowY = newWindowY - minWindowHeight + newWindowHeight
157 | end
158 | if newWindowHeight > maxWindowHeight then
159 | newWindowY = newWindowY - maxWindowHeight + newWindowHeight
160 | end
161 | end
162 | if newWindowHeight < minWindowHeight then newWindowHeight = minWindowHeight end
163 | if newWindowHeight > maxWindowHeight then newWindowHeight = maxWindowHeight end
164 |
165 | bang = bang .. "[!SetVariable WindowH " .. newWindowHeight .. "]"
166 | end
167 |
168 | if bang ~= "" then
169 | --bang = bang .. "[!UpdateMeterGroup Window][!Redraw]" TODO When clip is implemented?
170 | bang = bang .. "[!UpdateMeter *][!Redraw]"
171 |
172 | end
173 |
174 | if newWindowX ~= nil and newWindowY ~= nil then
175 | bang = bang .. "[!Move " .. newWindowX .. " " .. newWindowY .. "]"
176 | elseif newWindowX ~= nil then
177 | bang = bang .. "[!Move " .. newWindowX .. " " .. skinPosY .. "]"
178 | elseif newWindowY ~= nil then
179 | bang = bang .. "[!Move " .. skinPosX .. " " .. newWindowY .. "]"
180 | end
181 | SKIN:Bang(bang)
182 | end
183 |
184 | function LeftMouseUpCallback(mouseX, mouseY)
185 | bang = "[!CommandMeasure ScriptMouseHandler UnsubscribeMouseEvent('WindowHandler','MouseMove')]"
186 | bang = bang .. "[!CommandMeasure ScriptMouseHandler UnsubscribeMouseEvent('WindowHandler','LeftMouseUp')]"
187 | local skinPosX = tonumber(SKIN:GetVariable("CURRENTCONFIGX"))
188 | local skinPosY = tonumber(SKIN:GetVariable("CURRENTCONFIGY"))
189 | local windowWidth = tonumber(SKIN:GetVariable("WindowW"))
190 | local windowHeight = tonumber(SKIN:GetVariable("WindowH"))
191 | bang = bang .. "[!WriteKeyValue Variables WindowPosX " .. skinPosX .. "]" -- Write X pos in case of refresh
192 | bang = bang .. "[!WriteKeyValue Variables WindowPosY " .. skinPosY .. "]" -- Write Y pos in case of refresh
193 | bang = bang .. "[!WriteKeyValue Variables WindowW " .. windowWidth .. "]" -- Write Width in case of refresh
194 | bang = bang .. "[!WriteKeyValue Variables WindowH " .. windowHeight .. "]" -- Write Height in case of refresh
195 | bang = bang .. "[!UpdateMeter *][!Redraw]"
196 |
197 | SKIN:Bang(bang)
198 | ResizeBorder = nil
199 | Resizing = false
200 | end
201 |
202 | function ResizeWindow(border, mouseX, mouseY)
203 | local mouseHandler = SKIN:GetMeasure("ScriptMouseHandler")
204 | if mouseHandler == nil then
205 | print("Mouse handler not found, include module ScriptMouseHandler")
206 | return
207 | end
208 | ResizeBorder = border
209 | Resizing = true
210 | bang = "[!CommandMeasure ScriptMouseHandler SubscribeMouseEvent('MouseMovedCallback','WindowHandler','MouseMove')]"
211 | bang = bang .. "[!CommandMeasure ScriptMouseHandler SubscribeMouseEvent('LeftMouseUpCallback','WindowHandler','LeftMouseUp')]"
212 | SKIN:Bang(bang)
213 | offsetX = mouseX
214 | offsetY = mouseY
215 | end
216 |
217 | function Initialize()
218 | RefreshMaximize()
219 | end
--------------------------------------------------------------------------------
/@Resources/Scripts/lol/XmlParser.lua:
--------------------------------------------------------------------------------
1 | -- Code from: http://lua-users.org/wiki/LuaXml
2 | -----------------------------------------------------------------------------------------
3 | -- LUA only XmlParser from Alexander Makeev
4 | -----------------------------------------------------------------------------------------
5 | -- Using this code "As Is"
6 | -- Jaya Polumuru
7 |
8 | XmlParser = {};
9 |
10 | function XmlParser:ToXmlString(value)
11 | value = string.gsub (value, "&", "&"); -- '&' -> "&"
12 | value = string.gsub (value, "<", "<"); -- '<' -> "<"
13 | value = string.gsub (value, ">", ">"); -- '>' -> ">"
14 | --value = string.gsub (value, "'", "'"); -- '\'' -> "'"
15 | value = string.gsub (value, "\"", """); -- '"' -> """
16 | -- replace non printable char -> "
"
17 | value = string.gsub(value, "([^%w%&%;%p%\t% ])",
18 | function (c)
19 | return string.format("%X;", string.byte(c))
20 | --return string.format("%02X;", string.byte(c))
21 | --return string.format("%02d;", string.byte(c))
22 | end);
23 | return value;
24 | end
25 |
26 | function XmlParser:FromXmlString(value)
27 | value = string.gsub(value, "([%x]+)%;",
28 | function(h)
29 | return string.char(tonumber(h,16))
30 | end);
31 | value = string.gsub(value, "([0-9]+)%;",
32 | function(h)
33 | return string.char(tonumber(h,10))
34 | end);
35 | value = string.gsub (value, """, "\"");
36 | value = string.gsub (value, "'", "'");
37 | value = string.gsub (value, ">", ">");
38 | value = string.gsub (value, "<", "<");
39 | value = string.gsub (value, "&", "&");
40 | return value;
41 | end
42 |
43 | function XmlParser:ParseArgs(s)
44 | local arg = {}
45 | string.gsub(s, "(%w*%-?%w+)=([\"'])(.-)%2", function (w, _, a)
46 | arg[w] = XmlParser:FromXmlString(a);
47 | end)
48 | return arg
49 | end
50 |
51 | function XmlParser:ParseXmlText(xmlText)
52 | local stack = {}
53 | local top = {Name=nil,Value=nil,Attributes={},ChildNodes={}}
54 | table.insert(stack, top)
55 | local ni,c,label,xarg, empty
56 | local i, j = 1, 1
57 | while true do
58 | ni,j,c,label,xarg, empty = string.find(xmlText, "<(%/?)([%w:]+)(.-)(%/?)>", i)
59 | if not ni then break end
60 | local text = string.sub(xmlText, i, ni-1);
61 | if not string.find(text, "^%s*$") then
62 | top.Value=(top.Value or "")..XmlParser:FromXmlString(text);
63 | end
64 | if empty == "/" then -- empty element tag
65 | -- print ("Label:" .. label) -- comment these out
66 | table.insert(top.ChildNodes, {Name=label,Value=nil,Attributes=XmlParser:ParseArgs(xarg),ChildNodes={}})
67 | elseif c == "" then -- start tag
68 | top = {Name=label, Value=nil, Attributes=XmlParser:ParseArgs(xarg), ChildNodes={}}
69 | table.insert(stack, top) -- new level
70 | -- print("openTag ="..top.Name); -- comment these out
71 | else -- end tag
72 | local toclose = table.remove(stack) -- remove top
73 | -- print("closeTag="..toclose.Name); -- comment these out
74 | top = stack[#stack]
75 | if #stack < 1 then
76 | error("XmlParser: nothing to close with "..label)
77 | end
78 | if toclose.Name ~= label then
79 | error("XmlParser: trying to close "..toclose.Name.." with "..label)
80 | end
81 | table.insert(top.ChildNodes, toclose)
82 | end
83 | i = j+1
84 | end
85 | local text = string.sub(xmlText, i);
86 | if not string.find(text, "^%s*$") then
87 | stack[#stack].Value=(stack[#stack].Value or "")..XmlParser:FromXmlString(text);
88 | end
89 | if #stack > 1 then
90 | error("XmlParser: unclosed "..stack[stack.n].Name)
91 | end
92 | return stack[1].ChildNodes[1];
93 | end
94 |
95 | function XmlParser:ParseXmlFile(xmlFileName)
96 | local hFile,err = io.open(xmlFileName,"r");
97 | if (not err) then
98 | local xmlText=hFile:read("*a"); -- read file content
99 | io.close(hFile);
100 | return XmlParser:ParseXmlText(xmlText),nil;
101 | else
102 | return nil,err;
103 | end
104 | end
105 | ------------------------------------------------------------------------------------------
106 | --example:
107 |
108 | function dump(resourceFile, _class, no_func, depth)
109 | if(not _class) then
110 | print("nil");
111 | return;
112 | end
113 |
114 | if(depth==nil) then depth=0; end
115 | local str="";
116 | for n=0,depth,1 do
117 | str=str.."\t";
118 | end
119 |
120 | resourceFile:write(str.."["..type(_class).."]\n");
121 | resourceFile:write(str.."{\n");
122 |
123 | for i,field in pairs(_class) do
124 | if(type(field)=="table") then
125 | resourceFile:write(str.."\t"..tostring(i).." =".."\n");
126 | dump(resourceFile, field, no_func, depth+1);
127 | else
128 | if(type(field)=="number") then
129 | resourceFile:write(str.."\t"..tostring(i).."="..field.."\n");
130 | elseif(type(field) == "string") then
131 | resourceFile:write(str.."\t"..tostring(i).."=".."\""..field.."\"\n");
132 | elseif(type(field) == "boolean") then
133 | resourceFile:write(str.."\t"..tostring(i).."=".."\""..tostring(field).."\"\n");
134 | else
135 | if(not no_func)then
136 | if(type(field)=="function")then
137 | resourceFile:write(str.."\t"..tostring(i).."()\n");
138 | else
139 | resourceFile:write(str.."\t"..tostring(i).."\n");
140 | end
141 | end
142 | end
143 | end
144 | end
145 | resourceFile:write(str.."}\n");
146 | end
147 |
148 | return XmlParser
--------------------------------------------------------------------------------
/Bit/Bit.ini:
--------------------------------------------------------------------------------
1 | [Rainmeter]
2 | Update=3000
3 | AccurateText=1
4 | DynamicWindowSize=1
5 | OnRefreshAction=[!Commandmeasure ReplaceTextScript "replacetext()"]
6 |
7 | ;PLEASE INSTALL A-15-BIT.ttf IN @RESOURSE/FONTS FOLDER.
8 |
9 | [Variables]
10 | Color=255,255,255
11 | Scale=1
12 |
13 | ;Shape Converter-----------------------------------
14 | [MeasureTime]
15 | Measure=Time
16 | Format=%I:%M
17 | ;%R for 24-h format
18 | OnChangeAction=[!Commandmeasure ReplaceTextScript "replacetext()"]
19 |
20 | [ReplaceTextScript]
21 | Measure=Script
22 | ScriptFile=#CURRENTPATH#ReplaceText.lua
23 | FontSize = (25*#Scale#)
24 | FontFace = A-15-BIT
25 | ;Use font that installed on your computer
26 | SVGfile=#CURRENTPATH#svg.svg
27 |
28 | [Inkscape]
29 | Measure=Plugin
30 | Plugin=RunCommand
31 | Program=""#@#Inkscape\inkscape.exe""
32 | Parameter=""#CURRENTPATH#svg.svg" --export-text-to-path --export-plain-svg="#CURRENTPATH#svgdone.svg""
33 | FinishAction=[!CommandMeasure ScriptVectorConverter "ConvertFile()"]
34 |
35 | [ScriptVectorConverter]
36 | Measure=Script
37 | ScriptFile=#CURRENTPATH#Converter.lua
38 | SVGfile=#CURRENTPATH#svgdone.svg
39 |
40 | [FileReader]
41 | Measure=Plugin
42 | Plugin=RunCommand
43 | Parameter=dir /B
44 | FinishAction=[!UpdateMeasure FileReader][!UpdateMeasure ScriptVectorConverter][!CommandMeasure ScriptVectorConverter "LoadFilesCallback()"]
45 | DynamicVariables=1
46 | ;--------------------------------------------------
47 |
48 | [Shape]
49 | Meter=Shape
50 | ;Shift the block where you want with these X,Y
51 | X=0
52 | Y=0
53 |
54 | [MeasureHour]
55 | Measure=Time
56 | Format=%I
57 | IfCondition=#CURRENTSECTION# >= 6
58 | IfTrueAction =[!SetVariable Sweep1 1]
59 | IfFalseAction=[!SetVariable Sweep1 0]
60 |
61 | [MeasureMinute]
62 | Measure=Time
63 | Format=%M
64 | IfCondition=#CURRENTSECTION# >= 30
65 | IfTrueAction =[!SetVariable Sweep2 1]
66 | IfFalseAction=[!SetVariable Sweep2 0]
67 |
68 | [Shape2]
69 | Meter=Shape
70 | X=(200*#Scale#)
71 | Y=(200*#Scale#)
72 | Shape = Ellipse 0,0,(180*#Scale#) | StrokeWidth (5*#Scale#) | StrokeColor #Color#,100 | Fill Color 0,0,0,0
73 | Shape2 = Arc (180*#Scale#*cos(PI/2-([MeasureHour]*60+[MeasureMinute])/720*2*PI)),((-180*#Scale#)*sin(PI/2-([MeasureHour]*60+[MeasureMinute])/720*2*PI)),0,(-180*#Scale#),(180*#Scale#),(180*#Scale#),0,1,#Sweep1#,0 | StrokeWidth (5*#Scale#) | Stroke Color #color#
74 | ;If you want Hour arc not relative with minute amount, use Shape2 below instead of above
75 | ;Shape2= Arc (180*#Scale#*cos(PI/2-[MeasureHour]/12*2*PI)),((-180*#Scale#)*sin(PI/2-[MeasureHour]/12*2*PI)),0,(-180*#Scale#),(180*#Scale#),(180*#Scale#),0,1,#Sweep1#,0 | StrokeWidth (5*#Scale#) | Stroke Color #color#
76 | Shape3= Arc (190*#Scale#*cos(PI/2-[MeasureMinute]/60*2*PI)),((-190*#Scale#)*sin(PI/2-[MeasureMinute]/60*2*PI)),0,(-190*#Scale#),(190*#Scale#),(190*#Scale#),0,1,#Sweep2#,0 | StrokeWidth (5*#Scale#) | Stroke Color #color#
77 | DynamicVariables=1
--------------------------------------------------------------------------------
/Bit/Converter.lua:
--------------------------------------------------------------------------------
1 |
2 | svgTypes = {}
3 |
4 | debugPrint = function(k) end
5 | nextPath = 2;
6 | shapeStyles = {}
7 |
8 |
9 | local ErrorEmptySVG = "Error: Parsing empty Svg file"
10 | local CorruptSVG = "Error: The svg file is corrupt"
11 | local GetModifiersError = "Error: Invalid attributes table given to get modifiers, returning nil"
12 |
13 | function shallowcopy(orig)
14 | local orig_type = type(orig)
15 | local copy
16 | if orig_type == 'table' then
17 | copy = {}
18 | for orig_key, orig_value in pairs(orig) do
19 | copy[orig_key] = orig_value
20 | end
21 | else
22 | copy = orig
23 | end
24 | return copy
25 | end
26 |
27 | function getShape(xmlTable, shapes, groupModifiers)
28 | local svgTypeName = xmlTable["Name"]
29 | local children = xmlTable["ChildNodes"]
30 | if svgTypes[svgTypeName] ~= nil then
31 | shapes = svgTypes[svgTypeName](shapes, xmlTable["Attributes"], children, deepcopy(groupModifiers), xmlTable["Value"])
32 | end
33 | return shapes
34 | end
35 |
36 | function xmlToShape(svgFile)
37 |
38 | local xml = XmlParser:ParseXmlFile(svgFile)
39 | if xml["Name"] ~= "svg" then
40 | print("Invalid svg file: ", svgFile)
41 | return nil
42 | end
43 | nextPath = 1
44 | style = {}
45 | endShapes = getShape(xml, {}, {})
46 | return endShapes
47 | end
48 |
49 |
50 | function Initialize()
51 | ColorKeywordsPath = SKIN:ReplaceVariables("#@#Scripts/ColorKeywords.lua")
52 |
53 | XmlParser = dofile(SKIN:ReplaceVariables("#@#Scripts/XmlParser.lua"))
54 | dofile(SKIN:ReplaceVariables("#@#Scripts/FileLoader.lua")) -- FileLoader
55 | dofile(SKIN:ReplaceVariables("#@#Scripts/HelperFunctions.lua")) -- HelperFunctions
56 | dofile(SKIN:ReplaceVariables("#@#Scripts/ModifierHandler.lua")) -- ModifierHandler
57 |
58 | local dir = SKIN:ReplaceVariables("#@#Scripts\\SvgTypes\\")
59 |
60 | local SvgLoad = function(files)
61 | for id, file in pairs(files) do
62 | fileName = split(file, ".")[1]
63 | svgTypes[fileName] = dofile(dir .. file)
64 | end
65 | end
66 |
67 | LoadFiles(dir, SvgLoad)
68 | countshape = 0
69 | countpath = 0
70 | end
71 |
72 | function ConvertFile()
73 | local path = SKIN:MakePathAbsolute(SELF:GetOption("SVGfile"))
74 | local shapes = xmlToShape(path)
75 |
76 | local paths = {}
77 |
78 | local meterOptions = ""
79 |
80 | ClearAllShapePath()
81 | countshape = 0
82 | local union = {}
83 |
84 | for i,shape in pairs(shapes) do
85 | if shape["shape"] ~= nil then
86 | if shape["modifiers"]["Special"]["Display"] then
87 | local shapeName = "Shape"
88 |
89 | if i ~= 1 then shapeName = shapeName .. i end
90 | table.insert(union,'|Union '..shapeName)
91 | meterOptions = meterOptions .. "[!SetOption Shape " .. shapeName .. " \"" .. shape["shape"]
92 |
93 | local sepNum = 1
94 |
95 | for separator in string.gmatch(shape["shape"],"|") do sepNum = sepNum+1 end
96 |
97 | if sepNum ~= 1 then
98 | for j=(i-1),(i-sepNum),-1 do
99 | union[j] = ""
100 | end
101 | end
102 |
103 | for modifierName, modifierValue in pairs(shape["modifiers"]) do
104 | if modifierName ~= "Special" then
105 | meterOptions = meterOptions .. " | " .. modifierName .. " " .. modifierValue
106 | end
107 | end
108 |
109 | if shape["modifiers"]["StrokeWidth"] == nil and shape["combined"] == nil then
110 | meterOptions = meterOptions .. " | StrokeWidth 0"
111 | end
112 |
113 | meterOptions = meterOptions .. "\"]"
114 |
115 | if shape["path"] ~= nil then
116 | paths[#paths+1] = shape["path"]
117 | end
118 | end
119 | countshape = countshape + 1
120 |
121 | end
122 | end
123 |
124 | countpath = 0
125 | for i, path in pairs(paths) do
126 | meterOptions = meterOptions .. "[!SetOption Shape Path" .. i .. " \"" .. path .. "\"]"
127 | countpath = countpath + 1
128 | end
129 | meterOptions = meterOptions .. "[!SetOption Shape Shape"..(countshape+1).." \"Rectangle 0,0,0,0|StrokeWidth 0\"]"
130 | meterOptions = meterOptions .. "[!SetOption Shape Shape"..(countshape+2).." \"Combine Shape"..(countshape+1)..table.concat(union).."\"]"
131 | meterOptions = meterOptions .. "[!SetOption Shape Shape"..(countshape+3).." \"Ellipse (200*#Scale#),(200*#Scale#),(110*#Scale#)|StrokeWidth 0 |Fill Color #color#\"]"
132 | meterOptions = meterOptions .. "[!SetOption Shape Shape"..(countshape+4).." \"Combine Shape"..(countshape+3).."|XOR Shape"..(countshape+2).."\"]"
133 |
134 | SKIN:Bang(meterOptions..'[!UpdateMeter Shape]')
135 | end
136 |
137 | function ClearAllShapePath()
138 | SKIN:Bang('[!SetOption Shape Shape \"\"]')
139 | for i=2,(countshape+4) do SKIN:Bang('[!SetOption Shape Shape'..i..' \"\"]') end
140 | for i=1,countpath do SKIN:Bang('[!SetOption Shape Path'..i..' \"\"]') end
141 | end
--------------------------------------------------------------------------------
/Bit/ReplaceText.lua:
--------------------------------------------------------------------------------
1 | function replacetext()
2 | scale = tonumber(SKIN:GetVariable('Scale'))
3 | text= SKIN:GetMeasure('MeasureTime'):GetStringValue()
4 | font = SELF:GetOption('FontFace')
5 | fontsize = SKIN:ParseFormula('('..SELF:GetOption('FontSize')..')')
6 | realFontSize = math.ceil(fontsize*100/70)
7 | X = 200*scale
8 | Y = 200*scale+fontsize/2
9 | file = io.open(SKIN:MakePathAbsolute(SELF:GetOption("SVGfile")), "w")
10 | template={
11 | "",
12 | "