Add a glow effect to the cyberpunk-splash line drawing #48

Merged
savanni merged 2 commits from neon-glow into main 2023-07-26 13:59:22 +00:00
1 changed files with 69 additions and 61 deletions
Showing only changes of commit f419fb06ee - Show all commits

View File

@ -161,6 +161,43 @@ impl SplashPrivate {
let _ = context.paint();
context.select_font_face("Alegreya Sans SC", FontSlant::Normal, FontWeight::Bold);
{
context.set_source_rgb(0.7, 0., 1.);
let hashtag = "#CodingTogether";
context.set_font_size(64.);
let extents = context.text_extents(hashtag).unwrap();
context.move_to(20., extents.height() + 40.);
let _ = context.show_text(hashtag);
AsymLine {
orientation: gtk::Orientation::Horizontal,
start_x: 10.,
start_y: extents.height() + 10.,
start_length: 0.,
height: extents.height() / 2.,
total_length: extents.width() + extents.height() / 2.,
invert: false,
}
.draw(&pen);
pen.stroke();
AsymLine {
orientation: gtk::Orientation::Horizontal,
start_x: 20.,
start_y: extents.height() + 60.,
start_length: extents.width(),
height: extents.height() / 2.,
total_length: extents.width() + extents.height() / 2.,
invert: false,
}
.draw(&pen);
pen.stroke();
}
{
context.set_font_size(128.);
let center_x = *self.width.borrow() as f64 / 2.;
@ -204,6 +241,7 @@ impl SplashPrivate {
let _ = context.set_source(gradient);
let _ = context.show_text(&self.text.borrow());
}
}
{
AsymLine {
@ -490,36 +528,6 @@ impl AsymLine {
}
}
struct RoundedRectangle {
x: f64,
y: f64,
width: f64,
height: f64,
}
impl RoundedRectangle {
fn draw(&self, context: &Context) {
context.arc(
self.x,
self.y - self.height / 2.,
self.height / 2.,
0.5 * std::f64::consts::PI,
1.5 * std::f64::consts::PI,
);
let _ = context.fill();
context.arc(
self.x + self.width,
self.y - self.height / 2.,
self.height / 2.,
1.5 * std::f64::consts::PI,
0.5 * std::f64::consts::PI,
);
let _ = context.fill();
context.rectangle(self.x, self.y, self.width, -self.height);
let _ = context.fill();
}
}
struct SlashMeter {
orientation: gtk::Orientation,
start_x: f64,