Skip to content

Commit

Permalink
Merge branch 'v0.8-pre' into Use-palette-for-colors
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierLemoine committed Feb 18, 2025
2 parents 6aa29f3 + b627902 commit ee275ce
Show file tree
Hide file tree
Showing 21 changed files with 361 additions and 374 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ members = [
]

[workspace.package]
version = "0.8.20-pre"
version = "0.8.21-pre"
license = "MIT"
edition = "2021"
repository = "https://github.com/432-Technologies/dessin"
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# [dessin](https://docs.rs/dessin/)

**dessin is library aimed at building complex drawings, combine them, move them and export them as PDF or SVG.**
**Try out the new [API](https://github.com/432-Technologies/dessin/tree/v0.8-pre)**

Generate complex drawing for PDF, SVG, and many more to come !

## Getting started

Expand Down
8 changes: 4 additions & 4 deletions dessin-image/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ edition = "2021"
license = "MIT"
name = "dessin-image"
repository = "https://github.com/432-technologies/dessin"
version = "0.8.20-pre"
version = "0.8.21-pre"

[dependencies]
data-encoding = "^2.3.3"
dessin = { version = "0.8.20-pre", path = "../dessin" }
dessin = { version = "0.8.21-pre", path = "../dessin" }
font-kit = "0.11.0"
image = "^0.24.6"
image = "0.24"
imageproc = "^0.23.0"
nalgebra = "^0.32.2"
nalgebra = "^0.33"
rand = "^0.8.5"
raqote = "0.8.2"
35 changes: 33 additions & 2 deletions dessin-image/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ impl Exporter for ImageExporter {
Ok(())
}

fn export_curve(&mut self, curve: CurvePosition) -> Result<(), Self::Error> {
fn export_curve(
&mut self,
curve: CurvePosition,
StylePosition { stroke, fill }: StylePosition,
) -> Result<(), Self::Error> {
let mut path = PathBuilder::new();

for (idx, k) in curve.keypoints.iter().enumerate() {
Expand Down Expand Up @@ -300,7 +304,34 @@ impl ToImage for Shape {
let height = bb.height().ceil() as u32;
let mut exporter = ImageExporter::new(width, height);

self.write_into_exporter(&mut exporter, &transform)?;
// self.write_into_exporter(
// &mut exporter,
// &transform,
// StylePosition {
// stroke: None,
// fill: None,
// },
// )?;

if let Shape::Style { fill, stroke, .. } = self {
self.write_into_exporter(
&mut exporter,
&transform,
StylePosition {
fill: *fill,
stroke: *stroke,
},
)? //Needed to be complete
} else {
self.write_into_exporter(
&mut exporter,
&transform,
StylePosition {
fill: None,
stroke: None,
},
)?
}

let raw: Vec<u32> = exporter.finalize().into_vec();
let raw: Vec<u8> = unsafe {
Expand Down
2 changes: 1 addition & 1 deletion dessin-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ edition = "2021"
license = "MIT"
name = "dessin-macros"
repository = "https://github.com/432-technologies/dessin"
version = "0.8.20-pre"
version = "0.8.21-pre"

[lib]
proc-macro = true
Expand Down
10 changes: 8 additions & 2 deletions dessin-macros/src/dessin_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use syn::{
parse::{Parse, ParseStream},
punctuated::Punctuated,
token::{Brace, Bracket, Comma, Paren},
Expr, ExprAssign, ExprForLoop, ExprLet, Path, Result, Token,
Expr, ExprAssign, ExprForLoop, ExprLet, Pat, Path, Result, Token,
};

enum Action {
Expand Down Expand Up @@ -195,7 +195,13 @@ enum DessinIfElseArg {
impl Parse for DessinIfElseArg {
fn parse(input: ParseStream) -> Result<Self> {
if input.peek(Token![let]) {
let let_exp: ExprLet = input.parse()?;
let let_exp = ExprLet {
attrs: vec![],
let_token: input.parse().unwrap(),
pat: Box::new(Pat::parse_single(&input).unwrap()),
eq_token: input.parse().unwrap(),
expr: Box::new(Expr::parse_without_eager_brace(&input).unwrap()),
};
return Ok(DessinIfElseArg::Let(let_exp));
}

Expand Down
18 changes: 9 additions & 9 deletions dessin-macros/src/dessin_macro_old.rs
Original file line number Diff line number Diff line change
Expand Up @@ -642,15 +642,15 @@ fn simple_if() {
)
.unwrap();
}
#[test]
fn if_let() {
syn::parse_str::<Dessin>(
"if let Some(x) = my_condition {
Circle: ()
}",
)
.unwrap();
}
// #[test]
// fn if_let() {
// syn::parse_str::<Dessin>(
// "if let Some(x) = my_condition {
// Circle: ()
// }",
// )
// .unwrap();
// }
#[test]
fn combined_if() {
syn::parse_str::<Dessin>(
Expand Down
12 changes: 6 additions & 6 deletions dessin-pdf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ edition = "2021"
license = "MIT"
name = "dessin-pdf"
repository = "https://github.com/432-technologies/dessin"
version = "0.8.20-pre"
version = "0.8.21-pre"

[dependencies]
dessin = { version = "0.8.20-pre", path = "../dessin" }
fontdue = "^0.8.0"
image = "^0.24.8"
nalgebra = "^0.32.3"
printpdf = { version = "^0.6", features = ["webp", "svg"] }
dessin = { version = "0.8.21-pre", path = "../dessin" }
fontdue = "^0.9"
image = "0.24"
nalgebra = "^0.33"
printpdf = { version = "^0.7", features = ["webp", "svg"] }
Loading

0 comments on commit ee275ce

Please sign in to comment.