From c06f827f3e9085cb57ac6fdeb81a4800a3c61ca5 Mon Sep 17 00:00:00 2001 From: baseplate-admin <61817579+baseplate-admin@users.noreply.github.com> Date: Wed, 10 Apr 2024 14:54:31 +0600 Subject: [PATCH] add --- Cargo.lock | 7 + Cargo.toml | 1 + FUCK.svg | 340 ---------------------------------- output.png | Bin 2109 -> 0 bytes src/python/test.py | 346 +---------------------------------- src/rust/lib.rs | 5 - tests/test_complex_camera.py | 50 ++++- 7 files changed, 59 insertions(+), 690 deletions(-) delete mode 100644 FUCK.svg delete mode 100644 output.png diff --git a/Cargo.lock b/Cargo.lock index e36f7cd..4474e09 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -388,6 +388,7 @@ dependencies = [ "pyo3", "resvg", "tiny-skia", + "unescape", "usvg", ] @@ -547,6 +548,12 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4" +[[package]] +name = "unescape" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccb97dac3243214f8d8507998906ca3e2e0b900bf9bf4870477f125b82e68f6e" + [[package]] name = "unicode-bidi" version = "0.3.15" diff --git a/Cargo.toml b/Cargo.toml index 85c60cd..9d132a1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,4 +14,5 @@ base64 = "0.22.0" pyo3 = "0.19.0" resvg = { version = "0.40.0", features = ["raster-images","text"] } tiny-skia = "0.11.4" +unescape = "0.1.0" usvg = "0.40.0" diff --git a/FUCK.svg b/FUCK.svg deleted file mode 100644 index e20a964..0000000 --- a/FUCK.svg +++ /dev/null @@ -1,340 +0,0 @@ - - - - - - - - digital-camera - - - - digital - - 11 - hardware - photo - digicam - computer - camera - - - - - AJ Ashton - - - - - AJ Ashton - - - - - AJ Ashton - - - - image/svg+xml - - - en - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/output.png b/output.png deleted file mode 100644 index 7e2edbb87c152b7e2f8b446e87845875a8c13624..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2109 zcmeHJUrZZy9KY+aqpLedm;{9lT0=6knXniEosNR*#v0~o#BvX#91o^UnPQ!!4NmUL zi0R~ksWA&K24Y-D+N^z;35?S9Fr70B>7wZfCajkd7i_Xz8`97m*ZcYX(d}uAFN;s^ z_i(xI_r8BV-|yY$`@QpTooHhWRR)3}80#_1+XO+r2=~K!8m{W@97hoP604>49S?a= zA}`cgzpAsAkNU^MZ5E5u>Fl(_apSYG@L!xyaA=mrS)9(JM=c}aOXG(4aVP5@aJy}B zobvehGiiSys3b{O!p=H!Q7Q%EY??2PfjE#rPy4XwM|;Y!Xh*LZu^7@B707r`W+T@tT|9A&1IzMwK;$WHvUlWsP6`lNY?foi68X67uj)(Ou_ zvbDe7^oDeIE@4b^*gHnv`#6D0eCWVXpA;5WvBRFQxG4;M8_>cg?QlLUY}^Grvhv}r z&5siN-dJ>Wj7n~sYk+F_q>YlPKmYPW8GI#rCUYD6*P5BZ>YySE`KEO@DPxFey!+0Wf=Xy4&#t?qzeN`mjzSK}H0c2CFlgPBd;>S_&?G=W`+R(b z`B~3F+^0f~ZuXmiw%@4P)r8oFd%Gg{wbU-!QAHWrH*_%5gWI^dVi?r31-51G7xj0M z!)Ax3FOr1@w$OVRbjxCIQ8z|@_CWWCc(SOQAR`ZStk`~L%Qs3#b`*V2=DL*>x zs~m?K9XZ{xuG|EZeg5h-c!Ax-`G9uS)ctNF#`~1fmEap=qYKc=;2>ESRN|j|zFdYj z*z1Lu9W9sDzXY#jHofh_Oxj$XI^x9nB1HL5fczrf@h;wa@5%pM`nX3u%2Fa=j+)8xr(>8LKn zEhd?{N=)V@p&5o_z^En8?w+Z5)5mYgfRGN+oaH^vd)dz@kLuUSWfV*$j(<*Yi!8Zagv_MS${1e&^~m zeZ6`scha@p(|^l$Cc!tw_!nwRuUC2Mp%^|IBAcs!{LPMb8MTi5yx2zdGq1z8QIf0A zi8hL3@C4o4s!px9Qz2%qG1DVmhFybR)##au{0Gu>D-Ywe!-NOjzwV>QUTBXS0O{*~ W(9V6`S>uP_0>XOageCY!&+tE$8G9}O diff --git a/src/python/test.py b/src/python/test.py index 99622ad..73b9e9c 100644 --- a/src/python/test.py +++ b/src/python/test.py @@ -1,345 +1,5 @@ from resvg_py import svg_to_base64 -svg = """ - - - - - - - - digital-camera - - - - digital - - 11 - hardware - photo - digicam - computer - camera - - - - - AJ Ashton - - - - - AJ Ashton - - - - - AJ Ashton - - - - image/svg+xml - - - en - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -""" -lt = svg_to_base64(svg) +svg = +lt = svg_to_base64(svg_string=svg) +print(lt) diff --git a/src/rust/lib.rs b/src/rust/lib.rs index d763062..df67d7b 100644 --- a/src/rust/lib.rs +++ b/src/rust/lib.rs @@ -83,11 +83,6 @@ fn resvg_magic(svg_string: String) -> Result, String> { #[pyfunction] fn svg_to_base64(svg_string: String) -> PyResult { //let string = svg_string; - let string = std::str::from_utf8(&std::fs::read("FUCK.svg").unwrap()) - .unwrap() - .to_string(); - - println!("{}", string); let pixmap = resvg_magic(String::from(svg_string)).unwrap(); Ok(general_purpose::STANDARD.encode(&pixmap)) diff --git a/tests/test_complex_camera.py b/tests/test_complex_camera.py index e666c63..3c69612 100644 --- a/tests/test_complex_camera.py +++ b/tests/test_complex_camera.py @@ -2,9 +2,55 @@ def test_complex_camera(): - svg_string = """ - + svg_string = r""" + + + + + + digital-camera + + + + digital + + 11 + hardware + photo + digicam + computer + camera + + + + + AJ Ashton + + + + + AJ Ashton + + + + + AJ Ashton + + + + image/svg+xml + + + en + + + + + + + +