[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    New background option.
From:       Mofeed Shahin <shahin () labf ! org>
Date:       2001-08-28 13:29:21
[Download RAW message or body]

A little time ago I posted a patch to add a new type of background image 
option.
It is called 'Tiled Maxpect' it first streches the image as much as possible 
while keeping the aspect ratio, and then tiles it.

I have just upgraded the patch to 2.2, and here it is.

Mof.
["new_background_option" (text/x-diff)]

Common subdirectories: kdebase-2.2_old/kcontrol/background/CVS and \
                kdebase-2.2_new/kcontrol/background/CVS
diff -u kdebase-2.2_old/kcontrol/background/backgnd.cpp \
                kdebase-2.2_new/kcontrol/background/backgnd.cpp
--- kdebase-2.2_old/kcontrol/background/backgnd.cpp	Wed Aug  1 04:41:37 2001
+++ kdebase-2.2_new/kcontrol/background/backgnd.cpp	Tue Aug 28 22:29:02 2001
@@ -420,6 +420,7 @@
     m_pArrangementBox->insertItem(i18n("Tiled"));
     m_pArrangementBox->insertItem(i18n("Center Tiled"));
     m_pArrangementBox->insertItem(i18n("Centered Maxpect"));
+    m_pArrangementBox->insertItem(i18n("Tiled Maxpect"));
     m_pArrangementBox->insertItem(i18n("Scaled"));
     m_pArrangementBox->insertItem(i18n("Centered Auto Fit"));
 }
diff -u kdebase-2.2_old/kcontrol/background/bgrender.cc \
                kdebase-2.2_new/kcontrol/background/bgrender.cc
--- kdebase-2.2_old/kcontrol/background/bgrender.cc	Sun Jul 29 14:26:17 2001
+++ kdebase-2.2_new/kcontrol/background/bgrender.cc	Tue Aug 28 22:31:26 2001
@@ -341,18 +341,35 @@
             }
             // fall through
 	case CentredMaxpect:
-            double sx = (double) w / ww;
-            double sy = (double) h / wh;
-            if (sx > sy) {
-                ww = (int)(sy * ww);
-                wh = h;
-            } else {
-                wh = (int)(sx * wh);
-                ww = w;
+            {
+              double sx = (double) w / ww;
+              double sy = (double) h / wh;
+              if (sx > sy) {
+                  ww = (int)(sy * ww);
+                  wh = h;
+              } else {
+                  wh = (int)(sx * wh);
+                  ww = w;
+              }
+              wp = wp.smoothScale(ww, wh);
+	      d.setRect((w - ww) / 2, (h - wh) / 2, ww, wh);
+	      break;
+            }
+	case TiledMaxpect:
+            {
+              double sx = (double) w / ww;
+              double sy = (double) h / wh;
+              if (sx > sy) {
+                  ww = (int)(sy * ww);
+                  wh = h;
+              } else {
+                  wh = (int)(sx * wh);
+                  ww = w;
+              }
+              wp = wp.smoothScale(ww, wh);
+	      d.setRect(0, 0, w, h);
+	      break;
             }
-            wp = wp.smoothScale(ww, wh);
-	    d.setRect((w - ww) / 2, (h - wh) / 2, ww, wh);
-	    break;
     }
 
 
diff -u kdebase-2.2_old/kcontrol/background/bgsettings.cc \
                kdebase-2.2_new/kcontrol/background/bgsettings.cc
--- kdebase-2.2_old/kcontrol/background/bgsettings.cc	Thu Mar 15 19:46:04 2001
+++ kdebase-2.2_new/kcontrol/background/bgsettings.cc	Tue Aug 28 22:32:40 2001
@@ -453,6 +453,7 @@
     ADD_STRING(Tiled)
     ADD_STRING(CenterTiled)
     ADD_STRING(CentredMaxpect)
+    ADD_STRING(TiledMaxpect)
     ADD_STRING(Scaled)
     ADD_STRING(CentredAutoFit)
     #undef ADD_STRING
diff -u kdebase-2.2_old/kcontrol/background/bgsettings.h \
                kdebase-2.2_new/kcontrol/background/bgsettings.h
--- kdebase-2.2_old/kcontrol/background/bgsettings.h	Thu Mar 15 19:46:04 2001
+++ kdebase-2.2_new/kcontrol/background/bgsettings.h	Tue Aug 28 22:34:51 2001
@@ -188,7 +188,7 @@
     QString wallpaper() const { return m_Wallpaper; }
 
     enum WallpaperMode {
-	NoWallpaper, Centred, Tiled, CenterTiled, CentredMaxpect,
+	NoWallpaper, Centred, Tiled, CenterTiled, CentredMaxpect, TiledMaxpect,
 	Scaled, CentredAutoFit, lastWallpaperMode
     };
     void setWallpaperMode(int mode);
Common subdirectories: kdebase-2.2_old/kcontrol/background/pics and \
kdebase-2.2_new/kcontrol/background/pics


>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic