Closed bitbangr closed 3 years ago
Pt
is a tuple with a single element, the f64
value. You can access this value as .0
, so for example this should work:
let pdf_point_pt_x = pdf_point_mm.x.0;
let pdf_point_pt_y = pdf_point_mm.y.0;
Doh! Thank you for this answer.
Hi:
My question concerns https://github.com/fschutt/printpdf/blob/master/src/scale.rs
Is there some way to retrieve printpdf::scale::Point::Pt x and y entries as float f64 values?
I am using the servo/Euclid Point2D<f64,f64> Struct to process images before construction of an output PDF doc using printpdf. https://github.com/servo/euclid/blob/master/src/point.rs
I would like to be able to use the printpdf::scale::Point::Pt in the euclid::Point2D Struct to do Euclid translations/mappings etc.
A (non-compiling) example of what I am trying to do.
let pdf_point_mm = printpdf::Point::new(Mm(10.0), Mm(10.0));
let pdf_point_pt_x :f64 = pdf_point_mm.x;
let pdf_point_pt_y :f64 = pdf_point_mm.y;
let img_point :euclid::Point2D <f64,f64> = euclid::Point2D::new(pdf_point_pt_x,pdf_point_pt_y);
I am fairly new to rust and also creating new issues on GitHub so please forgive me if my question is obvious or this is the wrong place to ask this question.
Thank you for your consideration