Create a slideshow application in my cyberpunk style #252
|
@ -2,6 +2,7 @@ use cairo::{
|
||||||
Context, FontSlant, FontWeight, Format, ImageSurface, LineCap, LinearGradient, Pattern,
|
Context, FontSlant, FontWeight, Format, ImageSurface, LineCap, LinearGradient, Pattern,
|
||||||
TextExtents,
|
TextExtents,
|
||||||
};
|
};
|
||||||
|
use cyberpunk::{AsymLine, AsymLineCutout, GlowPen, Pen, SlashMeter};
|
||||||
use glib::Object;
|
use glib::Object;
|
||||||
use gtk::{prelude::*, subclass::prelude::*, EventControllerKey};
|
use gtk::{prelude::*, subclass::prelude::*, EventControllerKey};
|
||||||
use std::{
|
use std::{
|
||||||
|
@ -171,7 +172,7 @@ impl SplashPrivate {
|
||||||
start_y: extents.height() + 10.,
|
start_y: extents.height() + 10.,
|
||||||
start_length: 0.,
|
start_length: 0.,
|
||||||
height: extents.height() / 2.,
|
height: extents.height() / 2.,
|
||||||
total_length: extents.width() + extents.height() / 2.,
|
end_length: 0.,
|
||||||
invert: false,
|
invert: false,
|
||||||
}
|
}
|
||||||
.draw(&pen);
|
.draw(&pen);
|
||||||
|
@ -183,7 +184,7 @@ impl SplashPrivate {
|
||||||
start_y: extents.height() + 60.,
|
start_y: extents.height() + 60.,
|
||||||
start_length: extents.width(),
|
start_length: extents.width(),
|
||||||
height: extents.height() / 2.,
|
height: extents.height() / 2.,
|
||||||
total_length: extents.width() + extents.height() / 2.,
|
end_length: 0.,
|
||||||
invert: false,
|
invert: false,
|
||||||
}
|
}
|
||||||
.draw(&pen);
|
.draw(&pen);
|
||||||
|
@ -208,7 +209,7 @@ impl SplashPrivate {
|
||||||
start_x: 20.,
|
start_x: 20.,
|
||||||
start_y: center_y - 20. - title_height / 2.,
|
start_y: center_y - 20. - title_height / 2.,
|
||||||
start_length,
|
start_length,
|
||||||
total_length: *self.width.borrow() as f64 - 120.,
|
end_length: *self.width.borrow() as f64 - 120. - start_length,
|
||||||
cutout_length: title_width,
|
cutout_length: title_width,
|
||||||
height: title_height,
|
height: title_height,
|
||||||
invert: false,
|
invert: false,
|
||||||
|
@ -243,7 +244,7 @@ impl SplashPrivate {
|
||||||
start_y: *self.height.borrow() as f64 / 2. + 100.,
|
start_y: *self.height.borrow() as f64 / 2. + 100.,
|
||||||
start_length: 400.,
|
start_length: 400.,
|
||||||
height: 50.,
|
height: 50.,
|
||||||
total_length: 650.,
|
end_length: 0.,
|
||||||
invert: true,
|
invert: true,
|
||||||
}
|
}
|
||||||
.draw(&pen);
|
.draw(&pen);
|
||||||
|
@ -258,7 +259,7 @@ impl SplashPrivate {
|
||||||
start_y: *self.height.borrow() as f64 / 2. + 200.,
|
start_y: *self.height.borrow() as f64 / 2. + 200.,
|
||||||
start_length: 600.,
|
start_length: 600.,
|
||||||
height: 50.,
|
height: 50.,
|
||||||
total_length: 650.,
|
end_length: 0.,
|
||||||
invert: false,
|
invert: false,
|
||||||
}
|
}
|
||||||
.draw(&pen);
|
.draw(&pen);
|
||||||
|
|
|
@ -134,18 +134,18 @@ impl AsymLine {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SlashMeter {
|
pub struct SlashMeter {
|
||||||
orientation: gtk::Orientation,
|
pub orientation: gtk::Orientation,
|
||||||
start_x: f64,
|
pub start_x: f64,
|
||||||
start_y: f64,
|
pub start_y: f64,
|
||||||
count: u8,
|
pub count: u8,
|
||||||
fill_count: u8,
|
pub fill_count: u8,
|
||||||
height: f64,
|
pub height: f64,
|
||||||
length: f64,
|
pub length: f64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SlashMeter {
|
impl SlashMeter {
|
||||||
fn draw(&self, context: &Context) {
|
pub fn draw(&self, context: &Context) {
|
||||||
match self.orientation {
|
match self.orientation {
|
||||||
gtk::Orientation::Horizontal => {
|
gtk::Orientation::Horizontal => {
|
||||||
let angle: f64 = 0.8;
|
let angle: f64 = 0.8;
|
||||||
|
|
Loading…
Reference in New Issue