Fix: favicon
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Dorian Zedler 2023-03-15 12:34:57 +01:00
parent 9377daef9c
commit 5ca0021533
Signed by: dozedler
GPG key ID: 989DE36109AFA354
2 changed files with 1 additions and 37 deletions

View file

@ -44,29 +44,6 @@ fn generate_colors(rng: &mut ThreadRng) -> (Color, Color) {
(Color::from_hex(c1), Color::from_hex(c2))
}
pub fn draw_polygon(
center: (f64, f64),
side_length: f64,
num_sides: i32,
context: &Context,
) -> Result<(), cairo::Error> {
let mut rng = rand::thread_rng();
let (c1, _) = generate_colors(&mut rng);
set_color(c1, context);
context.new_path();
let corners = calculate_polygon_corners(center, num_sides, side_length, 30.0);
for (x, y) in corners {
context.line_to(x, y);
}
context.close_path();
context.fill()?;
Ok(())
}
pub fn draw_segmented_polygon(
center: (f64, f64),
side_length: f64,
@ -121,16 +98,3 @@ pub fn draw_polygon_of_segmented_polygons(
}
Ok(())
}
pub fn draw_polygon_of_polygons(
center: (f64, f64),
radius: f64,
num_sides: i32,
context: &Context,
) -> Result<(), cairo::Error> {
let corners = calculate_polygon_corners(center, num_sides, radius, 0.0);
for corner in corners {
draw_polygon(corner, radius * 0.4, num_sides, &context)?;
}
Ok(())
}

View file

@ -10,7 +10,7 @@ async fn handler() -> impl axum::response::IntoResponse {
context.set_source_rgba(0.0, 0.0, 0.0, 0.0);
context.fill().unwrap();
polygon::draw_polygon_of_polygons((50.0, 50.0), 65.0, 6, &context).unwrap();
polygon::draw_polygon_of_segmented_polygons((50.0, 50.0), 37.0, 16.75, 6, &context).unwrap();
let mut data: Vec<u8> = Vec::new();
surface.write_to_png(&mut data).unwrap();