feat: Initial XML support
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/.idea/
|
||||
/target
|
7
.pre-commit-config.yaml
Normal file
7
.pre-commit-config.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
repos:
|
||||
- repo: https://github.com/doublify/pre-commit-rust
|
||||
rev: master
|
||||
hooks:
|
||||
- id: fmt
|
||||
- id: cargo-check
|
||||
- id: clippy
|
132
Cargo.lock
generated
Normal file
132
Cargo.lock
generated
Normal file
@ -0,0 +1,132 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "flare-xml"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde-xml-rs",
|
||||
"thiserror 2.0.8",
|
||||
"xml-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.216"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde-xml-rs"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb3aa78ecda1ebc9ec9847d5d3aba7d618823446a049ba2491940506da6e2782"
|
||||
dependencies = [
|
||||
"log",
|
||||
"serde",
|
||||
"thiserror 1.0.69",
|
||||
"xml-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.216"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.90"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
|
||||
dependencies = [
|
||||
"thiserror-impl 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "2.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08f5383f3e0071702bf93ab5ee99b52d26936be9dedd9413067cbdcddcb6141a"
|
||||
dependencies = [
|
||||
"thiserror-impl 2.0.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "2.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2f357fcec90b3caef6623a099691be676d033b40a058ac95d2a6ade6fa0c943"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"
|
||||
|
||||
[[package]]
|
||||
name = "xml-rs"
|
||||
version = "0.8.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea8b391c9a790b496184c29f7f93b9ed5b16abb306c05415b68bcc16e4d06432"
|
11
Cargo.toml
Normal file
11
Cargo.toml
Normal file
@ -0,0 +1,11 @@
|
||||
[workspace]
|
||||
members = [
|
||||
"crates/flare-xml"
|
||||
]
|
||||
resolver = "2"
|
||||
|
||||
[workspace.dependencies]
|
||||
serde = { version = "1.0.216", features = ["derive"] }
|
||||
serde-xml-rs = "0.6.0"
|
||||
thiserror = "2.0.8"
|
||||
xml-rs = "0.8.24"
|
10
crates/flare-xml/Cargo.toml
Normal file
10
crates/flare-xml/Cargo.toml
Normal file
@ -0,0 +1,10 @@
|
||||
[package]
|
||||
name = "flare-xml"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
serde.workspace = true
|
||||
serde-xml-rs.workspace = true
|
||||
thiserror.workspace = true
|
||||
xml-rs.workspace = true
|
268
crates/flare-xml/resources/test/247.54484.flame
Normal file
268
crates/flare-xml/resources/test/247.54484.flame
Normal file
@ -0,0 +1,268 @@
|
||||
<flame name="electricsheep.247.54484" version="FLAM3-LNX-v3.1.1" time="0" size="800 592" center="-0.470838 -0.1267" scale="145.771" rotate="70.19" supersample="4" filter="1" filter_shape="gaussian" temporal_filter_type="box" temporal_filter_width="1.2" quality="2000" passes="1" temporal_samples="1000" background="0 0 0" brightness="57.7696" gamma="4.44" highlight_power="1" vibrancy="0.87" estimator_radius="11" estimator_minimum="0" estimator_curve="0.6" gamma_threshold="0.01" palette_mode="linear" interpolation_type="log" palette_interpolation="hsv" url="" nick="sparky">
|
||||
<xform weight="0.2972" color="0" color_speed="0.5" animate="1" linear="0.7832" polar="0.0968" power="0.12" coefs="0.444444 0.094459 0.150992 -0.304154 -1.52659 -0.230965" opacity="1"/>
|
||||
<xform weight="0.2972" color="0.31748" color_speed="0.5" animate="0" linear="0.7832" polar="0.0968" power="0.12" coefs="0.098168 -0.228752 0.17497 0.130983 -0.0440335 0.870511" opacity="1"/>
|
||||
<xform weight="0.2972" color="0.63496" color_speed="0.5" animate="1" linear="0.4522" polar="0.0968" power="0.12" coefs="-0.244873 0.0220186 -0.280768 0.565131 -1.38859 0.080555" opacity="1"/>
|
||||
<xform weight="1.4084" color="0.36504" color_speed="0.3042" animate="0" linear="0.5512" polar="1.5628" power="0.513" coefs="0.34826 -0.02271 0.563421 0.136566 -0.508506 0.745382" opacity="1"/>
|
||||
<xform weight="10.4874" color="0.67" color_speed="0.42" animate="1" linear="0.3982" polar="0.6188" power="0.238" coefs="-0.543251 -0.245818 0.0793081 -0.351139 0.197048 0.299675" opacity="0.69"/>
|
||||
<xform weight="9.4984" color="0.93" color_speed="0.93" animate="1" linear="0.7832" polar="0.0968" disc="1.985" power="0.12" coefs="0.336582 0.168996 0.525146 0.46288 0.171774 0.257938" opacity="0.94"/>
|
||||
<finalxform color="0.01" color_speed="0.01" ex="1" coefs="1 0 0 1 0.123168 -0.356308" opacity="0.49"/>
|
||||
<color index="0" rgb="122 138 52"/>
|
||||
<color index="1" rgb="120 135 52"/>
|
||||
<color index="2" rgb="119 131 52"/>
|
||||
<color index="3" rgb="117 128 53"/>
|
||||
<color index="4" rgb="116 124 53"/>
|
||||
<color index="5" rgb="114 121 53"/>
|
||||
<color index="6" rgb="113 118 53"/>
|
||||
<color index="7" rgb="111 114 53"/>
|
||||
<color index="8" rgb="110 111 53"/>
|
||||
<color index="9" rgb="108 107 54"/>
|
||||
<color index="10" rgb="107 104 54"/>
|
||||
<color index="11" rgb="105 101 54"/>
|
||||
<color index="12" rgb="104 97 54"/>
|
||||
<color index="13" rgb="102 94 54"/>
|
||||
<color index="14" rgb="100 91 55"/>
|
||||
<color index="15" rgb="99 87 55"/>
|
||||
<color index="16" rgb="97 84 55"/>
|
||||
<color index="17" rgb="96 80 55"/>
|
||||
<color index="18" rgb="94 77 55"/>
|
||||
<color index="19" rgb="93 74 55"/>
|
||||
<color index="20" rgb="91 70 56"/>
|
||||
<color index="21" rgb="90 67 56"/>
|
||||
<color index="22" rgb="88 63 56"/>
|
||||
<color index="23" rgb="87 60 56"/>
|
||||
<color index="24" rgb="85 57 56"/>
|
||||
<color index="25" rgb="84 53 56"/>
|
||||
<color index="26" rgb="82 50 57"/>
|
||||
<color index="27" rgb="81 46 57"/>
|
||||
<color index="28" rgb="79 43 57"/>
|
||||
<color index="29" rgb="78 43 57"/>
|
||||
<color index="30" rgb="77 43 57"/>
|
||||
<color index="31" rgb="76 43 56"/>
|
||||
<color index="32" rgb="75 42 56"/>
|
||||
<color index="33" rgb="74 42 56"/>
|
||||
<color index="34" rgb="73 42 56"/>
|
||||
<color index="35" rgb="72 42 55"/>
|
||||
<color index="36" rgb="71 42 55"/>
|
||||
<color index="37" rgb="70 42 55"/>
|
||||
<color index="38" rgb="69 42 55"/>
|
||||
<color index="39" rgb="68 41 55"/>
|
||||
<color index="40" rgb="67 41 54"/>
|
||||
<color index="41" rgb="66 41 54"/>
|
||||
<color index="42" rgb="65 41 54"/>
|
||||
<color index="43" rgb="64 41 54"/>
|
||||
<color index="44" rgb="63 41 54"/>
|
||||
<color index="45" rgb="62 41 53"/>
|
||||
<color index="46" rgb="61 40 53"/>
|
||||
<color index="47" rgb="60 40 53"/>
|
||||
<color index="48" rgb="59 40 53"/>
|
||||
<color index="49" rgb="58 40 52"/>
|
||||
<color index="50" rgb="57 40 52"/>
|
||||
<color index="51" rgb="56 40 52"/>
|
||||
<color index="52" rgb="55 40 52"/>
|
||||
<color index="53" rgb="54 39 52"/>
|
||||
<color index="54" rgb="53 39 51"/>
|
||||
<color index="55" rgb="52 39 51"/>
|
||||
<color index="56" rgb="51 39 51"/>
|
||||
<color index="57" rgb="52 41 49"/>
|
||||
<color index="58" rgb="53 42 47"/>
|
||||
<color index="59" rgb="53 44 46"/>
|
||||
<color index="60" rgb="54 46 44"/>
|
||||
<color index="61" rgb="55 48 42"/>
|
||||
<color index="62" rgb="56 49 40"/>
|
||||
<color index="63" rgb="57 51 38"/>
|
||||
<color index="64" rgb="58 53 36"/>
|
||||
<color index="65" rgb="58 54 35"/>
|
||||
<color index="66" rgb="59 56 33"/>
|
||||
<color index="67" rgb="60 58 31"/>
|
||||
<color index="68" rgb="61 60 29"/>
|
||||
<color index="69" rgb="62 61 27"/>
|
||||
<color index="70" rgb="62 63 26"/>
|
||||
<color index="71" rgb="63 65 24"/>
|
||||
<color index="72" rgb="64 66 22"/>
|
||||
<color index="73" rgb="65 68 20"/>
|
||||
<color index="74" rgb="66 70 18"/>
|
||||
<color index="75" rgb="67 72 16"/>
|
||||
<color index="76" rgb="67 73 15"/>
|
||||
<color index="77" rgb="68 75 13"/>
|
||||
<color index="78" rgb="69 77 11"/>
|
||||
<color index="79" rgb="70 78 9"/>
|
||||
<color index="80" rgb="71 80 7"/>
|
||||
<color index="81" rgb="72 82 5"/>
|
||||
<color index="82" rgb="72 84 4"/>
|
||||
<color index="83" rgb="73 85 2"/>
|
||||
<color index="84" rgb="74 87 0"/>
|
||||
<color index="85" rgb="75 88 4"/>
|
||||
<color index="86" rgb="75 90 7"/>
|
||||
<color index="87" rgb="76 91 10"/>
|
||||
<color index="88" rgb="76 92 14"/>
|
||||
<color index="89" rgb="77 94 18"/>
|
||||
<color index="90" rgb="77 95 21"/>
|
||||
<color index="91" rgb="78 97 24"/>
|
||||
<color index="92" rgb="78 98 28"/>
|
||||
<color index="93" rgb="79 99 32"/>
|
||||
<color index="94" rgb="79 101 35"/>
|
||||
<color index="95" rgb="80 102 38"/>
|
||||
<color index="96" rgb="80 103 42"/>
|
||||
<color index="97" rgb="81 105 46"/>
|
||||
<color index="98" rgb="82 106 49"/>
|
||||
<color index="99" rgb="82 107 52"/>
|
||||
<color index="100" rgb="83 109 56"/>
|
||||
<color index="101" rgb="83 110 60"/>
|
||||
<color index="102" rgb="84 111 63"/>
|
||||
<color index="103" rgb="84 113 66"/>
|
||||
<color index="104" rgb="85 114 70"/>
|
||||
<color index="105" rgb="85 116 74"/>
|
||||
<color index="106" rgb="86 117 77"/>
|
||||
<color index="107" rgb="86 118 80"/>
|
||||
<color index="108" rgb="87 120 84"/>
|
||||
<color index="109" rgb="87 121 88"/>
|
||||
<color index="110" rgb="88 122 91"/>
|
||||
<color index="111" rgb="88 124 94"/>
|
||||
<color index="112" rgb="89 125 98"/>
|
||||
<color index="113" rgb="91 125 101"/>
|
||||
<color index="114" rgb="94 126 105"/>
|
||||
<color index="115" rgb="96 126 108"/>
|
||||
<color index="116" rgb="99 126 112"/>
|
||||
<color index="117" rgb="101 126 115"/>
|
||||
<color index="118" rgb="104 126 119"/>
|
||||
<color index="119" rgb="106 127 122"/>
|
||||
<color index="120" rgb="108 127 125"/>
|
||||
<color index="121" rgb="111 127 129"/>
|
||||
<color index="122" rgb="113 128 132"/>
|
||||
<color index="123" rgb="116 128 136"/>
|
||||
<color index="124" rgb="118 128 139"/>
|
||||
<color index="125" rgb="121 128 143"/>
|
||||
<color index="126" rgb="123 128 146"/>
|
||||
<color index="127" rgb="125 129 149"/>
|
||||
<color index="128" rgb="128 129 153"/>
|
||||
<color index="129" rgb="130 129 156"/>
|
||||
<color index="130" rgb="133 130 160"/>
|
||||
<color index="131" rgb="135 130 163"/>
|
||||
<color index="132" rgb="138 130 167"/>
|
||||
<color index="133" rgb="140 130 170"/>
|
||||
<color index="134" rgb="142 130 173"/>
|
||||
<color index="135" rgb="145 131 177"/>
|
||||
<color index="136" rgb="147 131 180"/>
|
||||
<color index="137" rgb="150 131 184"/>
|
||||
<color index="138" rgb="152 132 187"/>
|
||||
<color index="139" rgb="155 132 191"/>
|
||||
<color index="140" rgb="157 132 194"/>
|
||||
<color index="141" rgb="156 132 191"/>
|
||||
<color index="142" rgb="155 132 189"/>
|
||||
<color index="143" rgb="154 132 186"/>
|
||||
<color index="144" rgb="153 132 183"/>
|
||||
<color index="145" rgb="152 132 181"/>
|
||||
<color index="146" rgb="151 132 178"/>
|
||||
<color index="147" rgb="150 132 175"/>
|
||||
<color index="148" rgb="149 132 173"/>
|
||||
<color index="149" rgb="148 132 170"/>
|
||||
<color index="150" rgb="147 132 167"/>
|
||||
<color index="151" rgb="146 132 165"/>
|
||||
<color index="152" rgb="145 132 162"/>
|
||||
<color index="153" rgb="144 132 159"/>
|
||||
<color index="154" rgb="143 132 157"/>
|
||||
<color index="155" rgb="142 133 154"/>
|
||||
<color index="156" rgb="141 133 151"/>
|
||||
<color index="157" rgb="140 133 148"/>
|
||||
<color index="158" rgb="139 133 146"/>
|
||||
<color index="159" rgb="138 133 143"/>
|
||||
<color index="160" rgb="137 133 140"/>
|
||||
<color index="161" rgb="136 133 138"/>
|
||||
<color index="162" rgb="135 133 135"/>
|
||||
<color index="163" rgb="134 133 132"/>
|
||||
<color index="164" rgb="133 133 130"/>
|
||||
<color index="165" rgb="132 133 127"/>
|
||||
<color index="166" rgb="131 133 124"/>
|
||||
<color index="167" rgb="130 133 122"/>
|
||||
<color index="168" rgb="129 133 119"/>
|
||||
<color index="169" rgb="127 130 117"/>
|
||||
<color index="170" rgb="124 127 114"/>
|
||||
<color index="171" rgb="122 124 112"/>
|
||||
<color index="172" rgb="120 121 109"/>
|
||||
<color index="173" rgb="118 119 107"/>
|
||||
<color index="174" rgb="116 116 104"/>
|
||||
<color index="175" rgb="113 113 102"/>
|
||||
<color index="176" rgb="111 110 100"/>
|
||||
<color index="177" rgb="109 107 97"/>
|
||||
<color index="178" rgb="106 104 95"/>
|
||||
<color index="179" rgb="104 101 92"/>
|
||||
<color index="180" rgb="102 98 90"/>
|
||||
<color index="181" rgb="100 95 87"/>
|
||||
<color index="182" rgb="98 93 85"/>
|
||||
<color index="183" rgb="95 90 83"/>
|
||||
<color index="184" rgb="93 87 80"/>
|
||||
<color index="185" rgb="91 84 78"/>
|
||||
<color index="186" rgb="88 81 75"/>
|
||||
<color index="187" rgb="86 78 73"/>
|
||||
<color index="188" rgb="84 75 70"/>
|
||||
<color index="189" rgb="82 72 68"/>
|
||||
<color index="190" rgb="80 69 66"/>
|
||||
<color index="191" rgb="77 66 63"/>
|
||||
<color index="192" rgb="75 64 61"/>
|
||||
<color index="193" rgb="73 61 58"/>
|
||||
<color index="194" rgb="70 58 56"/>
|
||||
<color index="195" rgb="68 55 53"/>
|
||||
<color index="196" rgb="66 52 51"/>
|
||||
<color index="197" rgb="70 55 56"/>
|
||||
<color index="198" rgb="74 58 61"/>
|
||||
<color index="199" rgb="78 61 66"/>
|
||||
<color index="200" rgb="82 64 71"/>
|
||||
<color index="201" rgb="86 67 77"/>
|
||||
<color index="202" rgb="90 70 82"/>
|
||||
<color index="203" rgb="94 73 87"/>
|
||||
<color index="204" rgb="98 76 92"/>
|
||||
<color index="205" rgb="102 79 97"/>
|
||||
<color index="206" rgb="106 82 102"/>
|
||||
<color index="207" rgb="110 85 107"/>
|
||||
<color index="208" rgb="114 88 112"/>
|
||||
<color index="209" rgb="118 91 117"/>
|
||||
<color index="210" rgb="123 94 123"/>
|
||||
<color index="211" rgb="127 97 128"/>
|
||||
<color index="212" rgb="131 100 133"/>
|
||||
<color index="213" rgb="135 103 138"/>
|
||||
<color index="214" rgb="139 106 143"/>
|
||||
<color index="215" rgb="143 109 148"/>
|
||||
<color index="216" rgb="147 112 153"/>
|
||||
<color index="217" rgb="151 115 158"/>
|
||||
<color index="218" rgb="155 118 163"/>
|
||||
<color index="219" rgb="159 121 168"/>
|
||||
<color index="220" rgb="163 124 174"/>
|
||||
<color index="221" rgb="167 127 179"/>
|
||||
<color index="222" rgb="171 130 184"/>
|
||||
<color index="223" rgb="175 133 189"/>
|
||||
<color index="224" rgb="179 136 194"/>
|
||||
<color index="225" rgb="173 133 196"/>
|
||||
<color index="226" rgb="167 129 198"/>
|
||||
<color index="227" rgb="162 126 200"/>
|
||||
<color index="228" rgb="156 122 202"/>
|
||||
<color index="229" rgb="150 119 204"/>
|
||||
<color index="230" rgb="144 116 206"/>
|
||||
<color index="231" rgb="139 112 208"/>
|
||||
<color index="232" rgb="133 109 210"/>
|
||||
<color index="233" rgb="127 105 212"/>
|
||||
<color index="234" rgb="121 102 214"/>
|
||||
<color index="235" rgb="115 99 216"/>
|
||||
<color index="236" rgb="110 95 218"/>
|
||||
<color index="237" rgb="104 92 220"/>
|
||||
<color index="238" rgb="98 89 222"/>
|
||||
<color index="239" rgb="92 85 224"/>
|
||||
<color index="240" rgb="86 82 226"/>
|
||||
<color index="241" rgb="81 78 228"/>
|
||||
<color index="242" rgb="75 75 230"/>
|
||||
<color index="243" rgb="69 72 232"/>
|
||||
<color index="244" rgb="63 68 234"/>
|
||||
<color index="245" rgb="58 65 236"/>
|
||||
<color index="246" rgb="52 61 238"/>
|
||||
<color index="247" rgb="46 58 240"/>
|
||||
<color index="248" rgb="40 55 242"/>
|
||||
<color index="249" rgb="34 51 244"/>
|
||||
<color index="250" rgb="29 48 246"/>
|
||||
<color index="251" rgb="23 44 248"/>
|
||||
<color index="252" rgb="17 41 250"/>
|
||||
<color index="253" rgb="59 77 222"/>
|
||||
<color index="254" rgb="101 113 194"/>
|
||||
<color index="255" rgb="143 149 166"/>
|
||||
<edit date="Wed Feb 17 10:39:54 -0500 2021" nick="sparky" url="" id="54484" gen="247" action="clone upload">
|
||||
<edit filename="upload" index="0"/>
|
||||
</edit>
|
||||
</flame>
|
120
crates/flare-xml/resources/test/apophysis.flame
Normal file
120
crates/flare-xml/resources/test/apophysis.flame
Normal file
@ -0,0 +1,120 @@
|
||||
<Flames name="params">
|
||||
<flame name="post xform" version="Apophysis 2.08 beta" size="600 600" center="0 0" scale="150" oversample="1" filter="0.2" quality="1" background="0 0 0" brightness="4" gamma="4" >
|
||||
<xform weight="0.422330042096567" color="0" pdj="1" coefs="1.51523 0.740356 -3.048677 -1.455964 0.724135 -0.362059" pdj_a="1.09358" pdj_b="2.13048" pdj_c="2.54127" pdj_d="2.37267" />
|
||||
<xform weight="0.564534951145298" color="0" julia="1" coefs="-1.381068 1.381068 -1.381068 -1.381068 0 0" />
|
||||
<xform weight="0.0131350067581356" color="0" linear="1" popcorn="1" coefs="0.031393 -0.031367 0.031367 0.031393 0 0" post="1 0 0 1 0.24 0.27" />
|
||||
<palette count="256" format="RGB">
|
||||
3130323635383B3A3D403F424644484B494D504E52565358
|
||||
5B585D605D626562686B676D706C737571787B767D807B83
|
||||
8580888A858D908A93958F989A949DA099A3A59EA8AAA3AD
|
||||
AFA8B3B5ADB8BAB2BEBFB7C3C5BCC8CAC1CECFC6D3D4CBD8
|
||||
DAD0DEDFD5E3DFD2E0DFCEDDE0CBDAE0C8D7E0C4D3E0C1D0
|
||||
E1BECDE1BBCAE1B7C7E1B4C4E1B1C1E2ADBEE2AABAE2A7B7
|
||||
E2A3B4E2A0B1E39DAEE399ABE396A8E393A5E490A1E48C9E
|
||||
E4899BE48698E48295E57F92E57C8FE5788CE57589E57285
|
||||
E66E82E66B7FE6687CE66479E76176E75E73E75B70E7576C
|
||||
E75469E85166E84D63E84A60E4495EE0485CDC475BD84659
|
||||
D44557D04455CB4353C74252C34150BF404EBB3F4CB73E4B
|
||||
B33D49AF3C47AB3B45A73A43A339429F38409B373E97363C
|
||||
92353A8E34398A33378632358231337E30327A2F30762E2E
|
||||
722D2C6E2C2A6A2B29662A276229255E2823592721552620
|
||||
51251E4D241C49231A4522194121173D20153C1F153A1F14
|
||||
391E14381E14361D14351C13341C13321B13311B132F1A12
|
||||
2E19122D19122B18122A1811291711271611261611251510
|
||||
23151022141021140F1F130F1E120F1C120F1B110E1A110E
|
||||
18100E170F0E160F0D140E0D130E0D120D0D100C0C0F0C0C
|
||||
0E0B0C0C0B0C0B0A0B09090B08090B07080B05080A04070A
|
||||
0606090804090A03088C46728A457087446D85436B824369
|
||||
8042667D41647B4061793F5F763E5D743D5A713D586F3C56
|
||||
6C3B536A3A5168394F65384C63374A6037485E36455B3543
|
||||
59344057333E54323C5231394F31374D30354A2F32482E30
|
||||
462D2E432C2B412B293E2B273C2A2439292237281F35271D
|
||||
32261B3025182D25162B241428231126220F25210F24210E
|
||||
23200E221F0E221E0D211E0D201D0D1F1C0D1E1B0C1D1B0C
|
||||
1C1A0C1B190B1B180B1A180B19170A18160A17150A161509
|
||||
1514091413091413081312081211081110081010070F0F07
|
||||
0E0E070D0D060C0D060C0C060B0B050A0A05090A05080904
|
||||
070804060704050704050603040503030403020402010302
|
||||
0608070C0D0D1112121617171B1C1D2121222626272B2B2D
|
||||
</palette>
|
||||
</flame>
|
||||
<flame name="baseline" version="Apophysis 2.08 beta" size="600 600" center="0 0" scale="150" oversample="1" filter="0.2" quality="1" background="0 0 0" brightness="4" gamma="4" >
|
||||
<xform weight="0.422330042096567" color="0" pdj="1" coefs="1.51523 0.740356 -3.048677 -1.455964 0.724135 -0.362059" pdj_a="1.09358" pdj_b="2.13048" pdj_c="2.54127" pdj_d="2.37267" />
|
||||
<xform weight="0.564534951145298" color="0.13" julia="1" coefs="-1.381068 1.381068 -1.381068 -1.381068 0 0" />
|
||||
<xform weight="0.0131350067581356" color="0.844" linear="1" popcorn="1" coefs="0.031393 -0.031367 0.031367 0.031393 0 0" />
|
||||
<palette count="256" format="RGB">
|
||||
3130323635383B3A3D403F424644484B494D504E52565358
|
||||
5B585D605D626562686B676D706C737571787B767D807B83
|
||||
8580888A858D908A93958F989A949DA099A3A59EA8AAA3AD
|
||||
AFA8B3B5ADB8BAB2BEBFB7C3C5BCC8CAC1CECFC6D3D4CBD8
|
||||
DAD0DEDFD5E3DFD2E0DFCEDDE0CBDAE0C8D7E0C4D3E0C1D0
|
||||
E1BECDE1BBCAE1B7C7E1B4C4E1B1C1E2ADBEE2AABAE2A7B7
|
||||
E2A3B4E2A0B1E39DAEE399ABE396A8E393A5E490A1E48C9E
|
||||
E4899BE48698E48295E57F92E57C8FE5788CE57589E57285
|
||||
E66E82E66B7FE6687CE66479E76176E75E73E75B70E7576C
|
||||
E75469E85166E84D63E84A60E4495EE0485CDC475BD84659
|
||||
D44557D04455CB4353C74252C34150BF404EBB3F4CB73E4B
|
||||
B33D49AF3C47AB3B45A73A43A339429F38409B373E97363C
|
||||
92353A8E34398A33378632358231337E30327A2F30762E2E
|
||||
722D2C6E2C2A6A2B29662A276229255E2823592721552620
|
||||
51251E4D241C49231A4522194121173D20153C1F153A1F14
|
||||
391E14381E14361D14351C13341C13321B13311B132F1A12
|
||||
2E19122D19122B18122A1811291711271611261611251510
|
||||
23151022141021140F1F130F1E120F1C120F1B110E1A110E
|
||||
18100E170F0E160F0D140E0D130E0D120D0D100C0C0F0C0C
|
||||
0E0B0C0C0B0C0B0A0B09090B08090B07080B05080A04070A
|
||||
0606090804090A03088C46728A457087446D85436B824369
|
||||
8042667D41647B4061793F5F763E5D743D5A713D586F3C56
|
||||
6C3B536A3A5168394F65384C63374A6037485E36455B3543
|
||||
59344057333E54323C5231394F31374D30354A2F32482E30
|
||||
462D2E432C2B412B293E2B273C2A2439292237281F35271D
|
||||
32261B3025182D25162B241428231126220F25210F24210E
|
||||
23200E221F0E221E0D211E0D201D0D1F1C0D1E1B0C1D1B0C
|
||||
1C1A0C1B190B1B180B1A180B19170A18160A17150A161509
|
||||
1514091413091413081312081211081110081010070F0F07
|
||||
0E0E070D0D060C0D060C0C060B0B050A0A05090A05080904
|
||||
070804060704050704050603040503030403020402010302
|
||||
0608070C0D0D1112121617171B1C1D2121222626272B2B2D
|
||||
</palette>
|
||||
</flame>
|
||||
<flame name="final xform" version="Apophysis 2.08 beta" size="600 600" center="0 0" scale="150" oversample="1" filter="0.2" quality="1" background="1 1 1" brightness="4" gamma="4" >
|
||||
<xform weight="0.422330042096567" color="0.349" pdj="1" coefs="1.51523 0.740356 -3.048677 -1.455964 0.724135 -0.362059" pdj_a="1.09358" pdj_b="2.13048" pdj_c="2.54127" pdj_d="2.37267" />
|
||||
<xform weight="0.564534951145298" color="0" julia="1" coefs="-1.381068 1.381068 -1.381068 -1.381068 0 0" />
|
||||
<xform weight="0.0131350067581356" color="0.766" linear="1" popcorn="1" coefs="0.031393 -0.031367 0.031367 0.031393 0 0" post="1 0 0 1 0.24 0.27" />
|
||||
<finalxform color="0" symmetry="1" julia="1" coefs="2 0 0 2 0 0" />
|
||||
<palette count="256" format="RGB">
|
||||
3130323635383B3A3D403F424644484B494D504E52565358
|
||||
5B585D605D626562686B676D706C737571787B767D807B83
|
||||
8580888A858D908A93958F989A949DA099A3A59EA8AAA3AD
|
||||
AFA8B3B5ADB8BAB2BEBFB7C3C5BCC8CAC1CECFC6D3D4CBD8
|
||||
DAD0DEDFD5E3DFD2E0DFCEDDE0CBDAE0C8D7E0C4D3E0C1D0
|
||||
E1BECDE1BBCAE1B7C7E1B4C4E1B1C1E2ADBEE2AABAE2A7B7
|
||||
E2A3B4E2A0B1E39DAEE399ABE396A8E393A5E490A1E48C9E
|
||||
E4899BE48698E48295E57F92E57C8FE5788CE57589E57285
|
||||
E66E82E66B7FE6687CE66479E76176E75E73E75B70E7576C
|
||||
E75469E85166E84D63E84A60E4495EE0485CDC475BD84659
|
||||
D44557D04455CB4353C74252C34150BF404EBB3F4CB73E4B
|
||||
B33D49AF3C47AB3B45A73A43A339429F38409B373E97363C
|
||||
92353A8E34398A33378632358231337E30327A2F30762E2E
|
||||
722D2C6E2C2A6A2B29662A276229255E2823592721552620
|
||||
51251E4D241C49231A4522194121173D20153C1F153A1F14
|
||||
391E14381E14361D14351C13341C13321B13311B132F1A12
|
||||
2E19122D19122B18122A1811291711271611261611251510
|
||||
23151022141021140F1F130F1E120F1C120F1B110E1A110E
|
||||
18100E170F0E160F0D140E0D130E0D120D0D100C0C0F0C0C
|
||||
0E0B0C0C0B0C0B0A0B09090B08090B07080B05080A04070A
|
||||
0606090804090A03088C46728A457087446D85436B824369
|
||||
8042667D41647B4061793F5F763E5D743D5A713D586F3C56
|
||||
6C3B536A3A5168394F65384C63374A6037485E36455B3543
|
||||
59344057333E54323C5231394F31374D30354A2F32482E30
|
||||
462D2E432C2B412B293E2B273C2A2439292237281F35271D
|
||||
32261B3025182D25162B241428231126220F25210F24210E
|
||||
23200E221F0E221E0D211E0D201D0D1F1C0D1E1B0C1D1B0C
|
||||
1C1A0C1B190B1B180B1A180B19170A18160A17150A161509
|
||||
1514091413091413081312081211081110081010070F0F07
|
||||
0E0E070D0D060C0D060C0C060B0B050A0A05090A05080904
|
||||
070804060704050704050603040503030403020402010302
|
||||
0608070C0D0D1112121617171B1C1D2121222626272B2B2D
|
||||
</palette>
|
||||
</flame>
|
||||
</Flames>
|
162
crates/flare-xml/src/lib.rs
Normal file
162
crates/flare-xml/src/lib.rs
Normal file
@ -0,0 +1,162 @@
|
||||
use serde::Deserialize;
|
||||
use serde_xml_rs::from_reader;
|
||||
use std::fs::File;
|
||||
use std::io::BufReader;
|
||||
use std::path::Path;
|
||||
use thiserror::Error;
|
||||
use xml::reader::XmlEvent;
|
||||
|
||||
#[derive(Debug, Default, Deserialize, Clone, PartialEq)]
|
||||
pub struct Flames {
|
||||
pub name: String,
|
||||
#[serde(rename = "$value")]
|
||||
pub flames: Vec<Flame>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Deserialize, Clone, PartialEq)]
|
||||
pub struct Flame {
|
||||
pub name: String,
|
||||
pub version: String,
|
||||
pub palette: Option<u64>,
|
||||
#[serde(rename = "$value")]
|
||||
pub elements: Vec<FlameElement>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Clone, PartialEq)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum FlameElement {
|
||||
Xform(Xform),
|
||||
FinalXform(Xform),
|
||||
Color(Color),
|
||||
Palette(Palette),
|
||||
Edit(Edit),
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Deserialize, Clone, PartialEq)]
|
||||
pub struct Xform {
|
||||
// Weight is optional for final xform
|
||||
pub weight: Option<f64>,
|
||||
pub color: f64,
|
||||
pub coefs: String,
|
||||
|
||||
pub linear: Option<f64>,
|
||||
pub julia: Option<f64>,
|
||||
pub popcorn: Option<f64>,
|
||||
pub pdj: Option<f64>,
|
||||
pub pdj_a: Option<f64>,
|
||||
pub pdj_b: Option<f64>,
|
||||
pub pdj_c: Option<f64>,
|
||||
pub pdj_d: Option<f64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Deserialize, Clone, PartialEq)]
|
||||
pub struct Color {
|
||||
pub index: u64,
|
||||
pub rgb: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Deserialize, Clone, PartialEq)]
|
||||
pub struct Palette {
|
||||
pub count: usize,
|
||||
pub format: String,
|
||||
#[serde(rename = "$value")]
|
||||
pub value: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Default, Clone, PartialEq)]
|
||||
pub struct Edit {}
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum ParseError {
|
||||
#[error("unable to read file; {0}")]
|
||||
IoError(#[from] std::io::Error),
|
||||
#[error("unable to parse file; {0}")]
|
||||
DeserializeError(#[from] serde_xml_rs::Error),
|
||||
#[error("unable to parse file")]
|
||||
ParseError,
|
||||
#[error("unable to parse xml; {0}")]
|
||||
XmlError(#[from] xml::reader::Error),
|
||||
}
|
||||
|
||||
pub fn parse(p: impl AsRef<Path>) -> Result<Flames, ParseError> {
|
||||
let file = File::open(&p)?;
|
||||
let reader = BufReader::new(file);
|
||||
let mut xml_reader = xml::EventReader::new(reader);
|
||||
|
||||
match xml_reader.next()? {
|
||||
XmlEvent::StartDocument { .. } => {}
|
||||
_ => return Err(ParseError::ParseError),
|
||||
}
|
||||
|
||||
match xml_reader.next()? {
|
||||
XmlEvent::StartElement { name, .. } => {
|
||||
let file = File::open(&p)?;
|
||||
let reader = BufReader::new(file);
|
||||
match name.local_name.as_str() {
|
||||
"Flames" => from_reader(reader).map_err(|e| e.into()),
|
||||
"flame" => from_reader(reader)
|
||||
.map(|f| Flames {
|
||||
flames: vec![f],
|
||||
..Default::default()
|
||||
})
|
||||
.map_err(|e| e.into()),
|
||||
_ => Err(ParseError::ParseError),
|
||||
}
|
||||
}
|
||||
_ => Err(ParseError::ParseError),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn resource_file(p: impl AsRef<Path>) -> PathBuf {
|
||||
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
||||
.join("resources/test")
|
||||
.join(p)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn param_247_54484() {
|
||||
let path = resource_file("247.54484.flame");
|
||||
let flames_result = parse(&path);
|
||||
|
||||
assert!(
|
||||
matches!(flames_result, Ok(_)),
|
||||
"path = {} error = {}",
|
||||
path.as_path().display(),
|
||||
flames_result.unwrap_err()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn param_apophysis() {
|
||||
let path = resource_file("apophysis.flame");
|
||||
let flames_result = parse(&path);
|
||||
|
||||
assert!(
|
||||
matches!(flames_result, Ok(_)),
|
||||
"path = {} error = {}",
|
||||
path.as_path().display(),
|
||||
flames_result.unwrap_err()
|
||||
);
|
||||
|
||||
let flame = &flames_result.unwrap().flames[0];
|
||||
assert_eq!(flame.name, "post xform");
|
||||
|
||||
let flame_element = &flame.elements[0];
|
||||
match flame_element {
|
||||
FlameElement::Xform(xform) => {
|
||||
assert_eq!(xform.weight, Some(0.422330042096567));
|
||||
assert_eq!(xform.pdj, Some(1.));
|
||||
assert_eq!(xform.pdj_a, Some(1.09358));
|
||||
assert_eq!(xform.pdj_b, Some(2.13048));
|
||||
assert_eq!(xform.pdj_c, Some(2.54127));
|
||||
assert_eq!(xform.pdj_d, Some(2.37267));
|
||||
}
|
||||
_ => assert!(false, "unexpected element"),
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user