Skip to content

Commit

Permalink
Should corrects errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MathNuba authored and OlivierLemoine committed Feb 26, 2024
1 parent 5818a9a commit ad818c9
Show file tree
Hide file tree
Showing 26 changed files with 47 additions and 58 deletions.
1 change: 1 addition & 0 deletions examples/432technologies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use dessin::{
use dessin_image::ToImage;
use dessin_pdf::ToPDF;
use dessin_svg::SVG;
use project_root::get_project_root;
use std::{
f32::consts::{FRAC_PI_4, FRAC_PI_8, PI},
fs,
Expand Down
4 changes: 2 additions & 2 deletions examples/any_triangle_with_macro.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::fs;

use dessin::{nalgebra::Rotation2, prelude::*};
use dessin_svg::ToSVG;
use dessin_svg::SVG;
use project_root::get_project_root;

fn main() {
Expand Down Expand Up @@ -36,7 +36,7 @@ fn main() {
get_project_root()
.unwrap()
.join("examples/out/any_triangle.svg"),
triangle.to_svg().unwrap(),
SVG::from(triangle).to_string().unwrap(),
)
.unwrap();
}
4 changes: 2 additions & 2 deletions examples/any_triangle_without_macro.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::fs;

use dessin::{nalgebra::Rotation2, prelude::*};
use dessin_svg::ToSVG;
use dessin_svg::SVG;
use project_root::get_project_root;

fn main() {
Expand Down Expand Up @@ -38,7 +38,7 @@ fn main() {
get_project_root()
.unwrap()
.join("examples/out/any_triangle.svg"),
Shape::from(triangle).to_svg().unwrap(),
SVG::from(triangle).to_string().unwrap(),
)
.unwrap();
}
4 changes: 2 additions & 2 deletions examples/arc_with_macro.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{f32::consts::PI, fs};

use dessin::{nalgebra::Rotation2, prelude::*};
use dessin_svg::ToSVG;
use dessin_svg::SVG;
use project_root::get_project_root;

fn main() {
Expand All @@ -23,7 +23,7 @@ fn main() {
// prints in svg version
fs::write(
get_project_root().unwrap().join("examples/out/arc.svg"),
arc.to_svg().unwrap(),
SVG::from(arc).to_string().unwrap(),
)
.unwrap();
}
4 changes: 2 additions & 2 deletions examples/arc_without_macro.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{f32::consts::PI, fs};

use dessin::{nalgebra::Rotation2, prelude::*};
use dessin_svg::ToSVG;
use dessin_svg::SVG;
use project_root::get_project_root;

fn main() {
Expand All @@ -26,7 +26,7 @@ fn main() {
// prints in svg version
fs::write(
get_project_root().unwrap().join("examples/out/arc.svg"),
Shape::from(arc).to_svg().unwrap(),
SVG::from(arc).to_string().unwrap(),
)
.unwrap();
}
4 changes: 2 additions & 2 deletions examples/blue_triangle_with_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use dessin::{
nalgebra::{Rotation2, Scale2},
prelude::{polygons::Triangle, *},
};
use dessin_svg::ToSVG;
use dessin_svg::SVG;
use project_root::get_project_root;

fn main() {
Expand All @@ -31,7 +31,7 @@ fn main() {
get_project_root()
.unwrap()
.join("examples/out/blue_triangle.svg"),
triangle.to_svg().unwrap(),
SVG::from(triangle).to_string().unwrap(),
)
.unwrap();
}
4 changes: 2 additions & 2 deletions examples/blue_triangle_without_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use dessin::{
nalgebra::{Rotation2, Scale2},
prelude::{polygons::Triangle, *},
};
use dessin_svg::ToSVG;
use dessin_svg::SVG;
use project_root::get_project_root;

fn main() {
Expand Down Expand Up @@ -32,7 +32,7 @@ fn main() {
get_project_root()
.unwrap()
.join("examples/out/blue_triangle.svg"),
Shape::from(triangle).to_svg().unwrap(),
SVG::from(triangle).to_string().unwrap(),
)
.unwrap();
}
4 changes: 2 additions & 2 deletions examples/diamond_with_macro.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::fs;

use dessin::{nalgebra::Rotation2, prelude::*};
use dessin_svg::ToSVG;
use dessin_svg::SVG;
use project_root::get_project_root;

fn main() {
Expand Down Expand Up @@ -41,7 +41,7 @@ fn main() {
// prints in svg version
fs::write(
get_project_root().unwrap().join("examples/out/diamond.svg"),
diamond.to_svg().unwrap(),
SVG::from(diamond).to_string().unwrap(),
)
.unwrap();
}
5 changes: 3 additions & 2 deletions examples/diamond_without_macro.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use std::fs;

use dessin::{prelude::*, shapes};
use dessin::prelude::*;
use dessin_svg::SVG;

use dessin::nalgebra::Rotation2;
use project_root::get_project_root;

fn main() {
// here we use the circle as a point to have a reference to use when moving the diamond
Expand Down Expand Up @@ -49,7 +50,7 @@ fn main() {

// prints in svg version with Shape::from(...) -> Shape::Group(group) because of the group
fs::write(
"./out/diamond.svg",
get_project_root().unwrap().join("examples/out/diamond.svg"),
SVG::from(Shape::Group(group)).to_string().unwrap(),
)
.unwrap();
Expand Down
4 changes: 2 additions & 2 deletions examples/green_rectangle_with_macro.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{f32::consts::PI, fs};

use dessin::{nalgebra::Rotation2, prelude::*};
use dessin_svg::ToSVG;
use dessin_svg::SVG;
use project_root::get_project_root;

fn main() {
Expand Down Expand Up @@ -31,7 +31,7 @@ fn main() {
get_project_root()
.unwrap()
.join("examples/out/green_rectangle.svg"),
rectangle.to_svg().unwrap(),
SVG::from(rectangle).to_string().unwrap(),
)
.unwrap();
}
4 changes: 2 additions & 2 deletions examples/green_rectangle_without_macro.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::fs;

use dessin::{nalgebra::Rotation2, prelude::*};
use dessin_svg::ToSVG;
use dessin_svg::SVG;
use project_root::get_project_root;

fn main() {
Expand All @@ -27,7 +27,7 @@ fn main() {
get_project_root()
.unwrap()
.join("examples/out/green_rectangle.svg"),
Shape::from(rectangle).to_svg().unwrap(),
SVG::from(rectangle).to_string().unwrap(),
)
.unwrap();
}
16 changes: 2 additions & 14 deletions examples/optical_effect_with_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use dessin_svg::{SVGOptions, SVG};
fn main() {
let optical_effect: Shape = dessin2!([
for n in 0..11 {
dessin2!([ThickArc!(
dessin2!([ThickArc!(
outer_radius = 10.,
inner_radius = 0.,
Expand All @@ -18,14 +17,11 @@ fn main() {
// chooses a rotation of (n*PI)/5 radians in the trigonometric direction
rotate = Rotation2::new(PI * (n as f32) / 5_f32)
)])
rotate = Rotation2::new(PI * (n as f32) / 5_f32)
)])
},
Circle!(
// chooses a radius of 10
radius = 1.,
fill = rgb(255, 255, 255)
fill = rgb(255, 255, 255)
fill = rgb(255, 255, 255),
),
Rectangle!(
width = 15.,
Expand All @@ -34,12 +30,6 @@ fn main() {
color: rgb(0, 0, 0),
width: 1.
}
width = 15.,
height = 15.,
stroke = Stroke::Full {
color: rgb(0, 0, 0),
width: 1.
}
),
]);

Expand All @@ -52,12 +42,10 @@ fn main() {
Rectangle!(
width = fond.width(),
height = fond.height(),
fill = rgb(150, 150, 150)
fill = rgb(150, 150, 150)
fill = rgb(150, 150, 150),
),
// Add optical_effect before the new Rectangle
{ optical_effect }
{ optical_effect }
]);

// prints in svg version
Expand Down
4 changes: 0 additions & 4 deletions examples/optical_effect_without_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ fn main() {

// add rectangle1 in the group at first to let it be the font
group.shapes.push(Shape::from(rectangle1));
group.shapes.push(Shape::from(rectangle1));

// creates the optical effect
let optical_effect = ThickArc::default();
Expand All @@ -51,7 +50,6 @@ fn main() {

// add the nth optical effect in the group
group.shapes.push(Shape::from(optical_effect));
group.shapes.push(Shape::from(optical_effect));
}

let rectangle2 = Rectangle::default();
Expand Down Expand Up @@ -86,8 +84,6 @@ fn main() {
let rectangle2 = Shape::from(rectangle2);
let circle = Shape::from(circle);

group.shapes.push(Shape::from(rectangle2));
group.shapes.push(Shape::from(circle));
group.shapes.push(Shape::from(rectangle2));
group.shapes.push(Shape::from(circle));

Expand Down
4 changes: 2 additions & 2 deletions examples/orange_octogon_with_macro.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//Attention ! It is the same way to make all polygons, you just have to replace : "Octogon" by "Polygon< the number of side you want >"

use dessin::{contrib::polygons::Octogon, nalgebra::Rotation2, prelude::*};
use dessin_svg::ToSVG;
use dessin_svg::SVG;
use project_root::get_project_root;
use std::fs;

Expand All @@ -27,7 +27,7 @@ fn main() {
get_project_root()
.unwrap()
.join("examples/out/orange_octogon.svg"),
octogon.to_svg().unwrap(),
SVG::from(octogon).to_string().unwrap(),
)
.unwrap();
}
4 changes: 2 additions & 2 deletions examples/orange_octogon_without_macro.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//Attention ! It is the same way to make all polygons, you just have to replace : "Octogon" by "Polygon< the number of side you want >"

use dessin::{contrib::polygons::Octogon, nalgebra::Rotation2, prelude::*};
use dessin_svg::ToSVG;
use dessin_svg::SVG;
use project_root::get_project_root;
use std::fs;

Expand Down Expand Up @@ -30,7 +30,7 @@ fn main() {
get_project_root()
.unwrap()
.join("examples/out/orange_octogon.svg"),
Shape::from(octogon).to_svg().unwrap(),
SVG::from(octogon).to_string().unwrap(),
)
.unwrap();
}
1 change: 1 addition & 0 deletions examples/out/basque_cross.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/out/line.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/out/optical_effect.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/red_circle_with_macro.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::fs;

use dessin::{nalgebra::Rotation2, prelude::*};
use dessin_svg::ToSVG;
use dessin_svg::SVG;
use project_root::get_project_root;

fn main() {
Expand All @@ -27,7 +27,7 @@ fn main() {
get_project_root()
.unwrap()
.join("examples/out/red_circle.svg"),
circle.to_svg().unwrap(),
SVG::from(circle).to_string().unwrap(),
)
.unwrap();
}
4 changes: 2 additions & 2 deletions examples/red_circle_without_macro.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::fs;

use dessin::prelude::*;
use dessin_svg::ToSVG;
use dessin_svg::SVG;
use project_root::get_project_root;

fn main() {
Expand Down Expand Up @@ -31,7 +31,7 @@ fn main() {
get_project_root()
.unwrap()
.join("examples/out/red_circle.svg"),
Shape::from(circle).to_svg().unwrap(),
SVG::from(circle).to_string().unwrap(),
)
.unwrap();
}
4 changes: 2 additions & 2 deletions examples/right_angle_triangle_with_macro.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{f32::consts::PI, fs};

use dessin::{nalgebra::Rotation2, prelude::*};
use dessin_svg::ToSVG;
use dessin_svg::SVG;
use project_root::get_project_root;

fn main() {
Expand Down Expand Up @@ -36,7 +36,7 @@ fn main() {
get_project_root()
.unwrap()
.join("examples/out/right_angle_triangle.svg"),
triangle.to_svg().unwrap(),
SVG::from(triangle).to_string().unwrap(),
)
.unwrap();
}
4 changes: 2 additions & 2 deletions examples/right_angle_triangle_without_macro.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{f32::consts::PI, fs};

use dessin::{nalgebra::Rotation2, prelude::*};
use dessin_svg::ToSVG;
use dessin_svg::SVG;
use project_root::get_project_root;

fn main() {
Expand Down Expand Up @@ -37,7 +37,7 @@ fn main() {
get_project_root()
.unwrap()
.join("examples/out/right_angle_triangle.svg"),
Shape::from(triangle).to_svg().unwrap(),
SVG::from(triangle).to_string().unwrap(),
)
.unwrap();
}
4 changes: 2 additions & 2 deletions examples/textbox_with_macro.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::fs;

use dessin::{nalgebra::Rotation2, prelude::*};
use dessin_svg::ToSVG;
use dessin_svg::SVG;
use project_root::get_project_root;

fn main() {
Expand Down Expand Up @@ -42,7 +42,7 @@ fn main() {
// prints in svg version
fs::write(
get_project_root().unwrap().join("examples/out/text.svg"),
text.to_svg().unwrap(),
SVG::from(text).to_string().unwrap(),
)
.unwrap();
}
Loading

0 comments on commit ad818c9

Please sign in to comment.