Package: hsetroot
Version: 1.0.2-3
Severity: wishlist
Tags: patch

Hello,

I noticed that hsetroot includes the -extend option now which is awesome.

I also figured out how to implement the other option for massaging
(not so) slightly wrong aspect images. This one just renders the image
large enough so that there is no free space on the root window and the
image potentially overflows on some sides. Awesome with images of some
patterns like leaves or water and slightly mismatched images of
landscape and the like.

Thanks

Michal


-- System Information:
Debian Release: 7.0
  APT prefers testing
  APT policy: (990, 'testing'), (990, 'stable'), (171, 'unstable'), (151, 
'experimental'), (121, 'precise-updates'), (121, 'precise-security'), (121, 
'precise'), (101, 'stable'), (101, 'oldstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.7.1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages hsetroot depends on:
ii  libc6         2.17-3
ii  libfreetype6  2.4.9-1.1
ii  libimlib2     1.4.5-1
ii  libx11-6      2:1.5.0-1+deb7u1
ii  libxext6      2:1.3.1-2+deb7u1
ii  zlib1g        1:1.2.7.dfsg-13

hsetroot recommends no packages.

hsetroot suggests no packages.

-- no debconf information
Index: hsetroot-1.0.2/debian/hsetroot.1
===================================================================
--- hsetroot-1.0.2.orig/debian/hsetroot.1	2013-04-28 22:06:38.000000000 +0200
+++ hsetroot-1.0.2/debian/hsetroot.1	2013-08-05 23:07:56.000000000 +0200
@@ -32,6 +32,9 @@
 \fB\-center\fR <image>
 Render an image centered on screen
 .TP
+\fB\-cover\fR <image>
+Render an image centered on screen scaled so that all of screen is covered.
+.TP
 \fB\-tile\fR <image>
 Render an image tiled
 .TP
Index: hsetroot-1.0.2/src/hsetroot.c
===================================================================
--- hsetroot-1.0.2.orig/src/hsetroot.c	2013-08-05 23:04:54.000000000 +0200
+++ hsetroot-1.0.2/src/hsetroot.c	2013-08-05 23:21:12.000000000 +0200
@@ -8,7 +8,7 @@
 #include "config.h"
 
 typedef enum
-{ Full, Fill, Center, Tile, Xtend } ImageMode;
+{ Full, Fill, Center, Tile, Xtend, Cover } ImageMode;
 
 void
 usage (char *commandline)
@@ -28,6 +28,7 @@
 	  "\n"
 	  "Image files:\n"
 	  " -center <image>            Render an image centered on screen\n"
+	  " -cover <image>             Render an image centered on screen scaled to fill the screen fully\n"
 	  " -tile <image>              Render an image tiled\n"
 	  " -full <image>              Render an image maximum aspect\n"
 	  " -extend <image>            Render an image max aspect and fill borders\n"
@@ -200,11 +201,11 @@
       imlib_blend_image_onto_image (buffer, 0, 0, 0, imgW, imgH,
 				    0, 0, rootW, rootH);
     }
-  else if ((mode == Full) || (mode == Xtend))
+  else if ((mode == Full) || (mode == Xtend) || (mode == Cover))
     {
       double aspect = ((double) rootW) / imgW;
       int top, left;
-      if ((int) (imgH * aspect) > rootH)
+      if (((int) (imgH * aspect) > rootH) != /*xor*/ (mode == Cover))
 	aspect = (double) rootH / (double) imgH;
       top = (rootH - (int) (imgH * aspect)) / 2;
       left = (rootW - (int) (imgW * aspect)) / 2;
@@ -485,6 +486,20 @@
 		  0)
 		{
 		  fprintf (stderr, "Bad image (%s)\n", argv[i]);
+		  continue;
+		}
+	    }
+	  else if (strcmp (argv[i], "-cover") == 0)
+	    {
+	      if ((++i) >= argc)
+		{
+		  fprintf (stderr, "Missing image\n");
+		  continue;
+		}
+	      if (load_image (Cover, argv[i], width, height, alpha, image) ==
+		  0)
+		{
+		  fprintf (stderr, "Bad image (%s)\n", argv[i]);
 		  continue;
 		}
 	    }

Reply via email to