From b21261727c8ae0573647a69a09f3b06e120d62d4 Mon Sep 17 00:00:00 2001 From: MoAlyousef Date: Thu, 7 Oct 2021 03:08:03 +0300 Subject: [PATCH] update fltk --- Cargo.toml | 4 ++-- src/lib.rs | 10 +--------- src/widget_schemes/aqua.rs | 14 +++++++------- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 776297c..47733f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fltk-theme" -version = "0.3.0" +version = "0.3.1" authors = ["MoAlyousef "] edition = "2018" description = "A theming crate for fltk-rs" @@ -13,7 +13,7 @@ license = "MIT" exclude = ["/screenshots", "./examples"] [dependencies] -fltk = "1.2" +fltk = "1.2.7" lazy_static = "1.4" [target.'cfg(target_os = "macos")'.dependencies] diff --git a/src/lib.rs b/src/lib.rs index 1409b2e..00fb15e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -225,14 +225,6 @@ pub trait FromColor { impl FromColor for Color { fn from_rgba(tup: (u8, u8, u8, u8)) -> Color { - let bg_col = Color::BackGround.to_rgb(); - let alpha = tup.3 as f32 / 255.0; - let r = alpha * tup.0 as f32 + (1.0 - alpha) * bg_col.0 as f32; - let r = r as u8; - let g = alpha * tup.1 as f32 + (1.0 - alpha) * bg_col.1 as f32; - let g = g as u8; - let b = alpha * tup.2 as f32 + (1.0 - alpha) * bg_col.2 as f32; - let b = b as u8; - Color::from_rgb(r, g, b) + Color::from_rgba_tuple(tup) } } diff --git a/src/widget_schemes/aqua.rs b/src/widget_schemes/aqua.rs index 728a51d..dbfbc3f 100644 --- a/src/widget_schemes/aqua.rs +++ b/src/widget_schemes/aqua.rs @@ -250,7 +250,7 @@ fn default_button_up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { fn down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { let col = c.to_rgb(); let svg = format!( - " + " @@ -259,8 +259,8 @@ fn down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { ", - w - 1, - h - 1, + w, + h, col.0 - 10, col.1 - 10, col.2 - 10, @@ -296,9 +296,9 @@ fn border_box(x: i32, y: i32, w: i32, h: i32, c: Color) { use crate::FromColor; draw::draw_box( FrameType::RFlatBox, - x, + x + 1, y + 1, - w - 1, + w - 2, h - 2, Color::from_rgba(*self::dark::systemBlueColor), ); @@ -308,8 +308,8 @@ fn use_scheme() { app::set_scheme(app::Scheme::Gtk); app::set_frame_type_cb(FrameType::UpBox, up_box, 1, 1, 2, 2); app::set_frame_type_cb(FrameType::DiamondUpBox, default_button_up_box, 1, 1, 2, 2); - app::set_frame_type_cb(FrameType::DownBox, down_box, 1, 1, 2, 2); - app::set_frame_type_cb(FrameType::DiamondDownBox, down_box, 1, 1, 2, 2); + app::set_frame_type_cb(FrameType::DownBox, down_box, 0, 0, 0, 0); + app::set_frame_type_cb(FrameType::DiamondDownBox, down_box, 0, 0, 0, 0); app::set_frame_type_cb(FrameType::RoundDownBox, radio_round_down_box, 2, 2, 4, 4); app::set_frame_type_cb(FrameType::BorderBox, border_box, 1, 1, 2, 2); }