Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
baseplate-admin committed Apr 10, 2024
1 parent caba34b commit c06f827
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 690 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
340 changes: 0 additions & 340 deletions FUCK.svg

This file was deleted.

Binary file removed output.png
Binary file not shown.
346 changes: 3 additions & 343 deletions src/python/test.py

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions src/rust/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,6 @@ fn resvg_magic(svg_string: String) -> Result<Vec<u8>, String> {
#[pyfunction]
fn svg_to_base64(svg_string: String) -> PyResult<String> {
//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))
Expand Down
50 changes: 48 additions & 2 deletions tests/test_complex_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,55 @@


def test_complex_camera():
svg_string = """
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" height="206.25000" id="svg2" version="1.0" width="406.25000" x="0.00000000" y="0.00000000" sodipodi:version="0.32" inkscape:version="0.46" sodipodi:docname="AJ_Digital_Camera_ok.svg" inkscape:output_extension="org.inkscape.output.svg.inkscape" inkscape:export-xdpi="55.827694" inkscape:export-ydpi="55.827694">
svg_string = r"""<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" height="206.25000" id="svg2" version="1.0" width="406.25000" x="0.00000000" y="0.00000000" sodipodi:version="0.32" inkscape:version="0.46" sodipodi:docname="AJ_Digital_Camera_ok.svg" inkscape:output_extension="org.inkscape.output.svg.inkscape" inkscape:export-filename="C:\joanna\Gfx\drawings_vector\admin\thumbs\AJ_Digital_Camera_ok.png" inkscape:export-xdpi="55.827694" inkscape:export-ydpi="55.827694">
<sodipodi:namedview inkscape:window-height="744" inkscape:window-width="1280" inkscape:pageshadow="2" inkscape:pageopacity="0.0" guidetolerance="10.0" gridtolerance="10.0" objecttolerance="10.0" borderopacity="1.0" bordercolor="#666666" pagecolor="#ffffff" id="base" showgrid="false" inkscape:zoom="2.3261538" inkscape:cx="69.088376" inkscape:cy="137.51653" inkscape:window-x="-4" inkscape:window-y="-4" inkscape:current-layer="svg2"/>
<metadata id="metadata3">
<rdf:RDF>
<cc:Work rdf:about="">
<dc:title>digital-camera</dc:title>
<dc:description/>
<dc:subject>
<rdf:Bag>
<rdf:li>digital</rdf:li>
<rdf:li/>
<rdf:li>11</rdf:li>
<rdf:li>hardware</rdf:li>
<rdf:li>photo</rdf:li>
<rdf:li>digicam</rdf:li>
<rdf:li>computer</rdf:li>
<rdf:li>camera</rdf:li>
</rdf:Bag>
</dc:subject>
<dc:publisher>
<cc:Agent rdf:about="http://www.openclipart.org">
<dc:title>AJ Ashton</dc:title>
</cc:Agent>
</dc:publisher>
<dc:creator>
<cc:Agent>
<dc:title>AJ Ashton</dc:title>
</cc:Agent>
</dc:creator>
<dc:rights>
<cc:Agent>
<dc:title>AJ Ashton</dc:title>
</cc:Agent>
</dc:rights>
<dc:date/>
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<cc:license rdf:resource="http://web.resource.org/cc/PublicDomain"/>
<dc:language>en</dc:language>
</cc:Work>
<cc:License rdf:about="http://web.resource.org/cc/PublicDomain">
<cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
<cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/>
<cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/>
</cc:License>
</rdf:RDF>
</metadata>
<defs id="defs3">
<inkscape:perspective sodipodi:type="inkscape:persp3d" inkscape:vp_x="0 : 103.125 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_z="406.25 : 103.125 : 1" inkscape:persp3d-origin="203.125 : 68.75 : 1" id="perspective222"/>
<linearGradient id="linearGradient2303">
Expand Down

0 comments on commit c06f827

Please sign in to comment.