Fix downscale issues
Signed-off-by: Vasiliy Doylov <nekocwd@mainlining.org>
This commit is contained in:
parent
9324cf63f3
commit
65ece768c6
3 changed files with 10 additions and 5 deletions
|
@ -42,9 +42,9 @@ namespace Color {
|
|||
return histogram;
|
||||
}
|
||||
|
||||
public Gdk.RGBA get_most_common_color (ref Gee.HashMap<Gdk.RGBA?, int> histogram, double? luma = null, double luma_delta = 0.4, bool inv = false) {
|
||||
public Gdk.RGBA ? get_most_common_color (ref Gee.HashMap<Gdk.RGBA?, int> histogram, double? luma = null, double luma_delta = 0.4, bool inv = false) {
|
||||
int max = 0;
|
||||
Gdk.RGBA color = {};
|
||||
Gdk.RGBA? color = null;
|
||||
foreach (var kv in histogram) {
|
||||
if (kv.value > max) {
|
||||
if (luma != null) {
|
||||
|
|
|
@ -2,6 +2,7 @@ using Gtk 4.0; // That's fake
|
|||
template $MediaPlayerPlayer: Box {
|
||||
visible: true;
|
||||
orientation: horizontal;
|
||||
height-request: 120;
|
||||
|
||||
styles [
|
||||
"nekoplayer",
|
||||
|
@ -10,6 +11,10 @@ template $MediaPlayerPlayer: Box {
|
|||
Image image {
|
||||
visible: true;
|
||||
icon-name: "org.gnome.Totem-symbolic";
|
||||
pixel-size: 110;
|
||||
hexpand: false;
|
||||
vexpand: false;
|
||||
valign: center;
|
||||
}
|
||||
|
||||
Box {
|
||||
|
|
|
@ -117,9 +117,9 @@ public class MediaPlayer.Player : Gtk.Box {
|
|||
return icon;
|
||||
}
|
||||
// Downscale to 110x110
|
||||
pixbuff = pixbuff.scale_simple (110, 110, Gdk.InterpType.BILINEAR);
|
||||
// pixbuff = pixbuff.scale_simple (110, 110, Gdk.InterpType.BILINEAR);
|
||||
// Start background generator
|
||||
run_color_thred (pixbuff);
|
||||
run_color_thred (pixbuff.scale_simple (64, 64, Gdk.InterpType.BILINEAR));
|
||||
|
||||
var width = pixbuff.width;
|
||||
var height = pixbuff.height;
|
||||
|
@ -127,7 +127,7 @@ public class MediaPlayer.Player : Gtk.Box {
|
|||
var surface = new Cairo.ImageSurface (Cairo.Format.ARGB32, width, height);
|
||||
var cr = new Cairo.Context (surface);
|
||||
{ // That's a hack for GTK3. TODO: Remove when phosh will be moved to gtk4
|
||||
var radius = 10;
|
||||
var radius = int.max (width, height) / 110 * 10;
|
||||
cr.new_path ();
|
||||
cr.arc (width - radius, radius, radius, deg (-90), deg (0));
|
||||
cr.arc (width - radius, height - radius, radius, deg (0), deg (90));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue