Skip to content

Commit d59b1b9

Browse files
Elliott Clarke38
authored andcommitted
Add angle transform
1 parent 6bd3004 commit d59b1b9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

plotters-backend/src/text.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ pub enum FontTransform {
135135
Rotate180,
136136
/// Rotating the text 270 degree clockwise
137137
Rotate270,
138+
/// Rotating the text to an arbitrary degree clockwise
139+
RotateAngle(f32),
138140
}
139141

140142
impl FontTransform {
@@ -149,6 +151,10 @@ impl FontTransform {
149151
FontTransform::Rotate90 => (-y, x),
150152
FontTransform::Rotate180 => (-x, -y),
151153
FontTransform::Rotate270 => (y, -x),
154+
FontTransform::RotateAngle(angle) => (
155+
((x as f32) * angle.cos()).round() as i32,
156+
((y as f32) * angle.sin()).round() as i32,
157+
),
152158
}
153159
}
154160
}

0 commit comments

Comments
 (0)