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

List:       kde-core-devel
Subject:    Re: kde 3.1 -- make Keramik default?
From:       Allan Sandfeld Jensen <snowwolf () one2one-networks ! com>
Date:       2002-06-14 14:59:27
[Download RAW message or body]

On Thursday 13 June 2002 09:28, Vadim Plessky wrote:
> On Thursday 13 June 2002 5:17 am, Maks Orlovich wrote:
>
> I like Maks' modifications better (not to offend anyone here).
Yes, they are very good. But a little too shiny.

> But:
> 1) widgets still look like to blurry
>  check top part of buttons, scrollbars
>
> 2) scrollbars's arows and listboxes' arrows are HUGE
> I know this issue was addresed soem time ago - but ANY kind of testing
> would be useful only with well-sized widgets. Before this, it's too early
> to say wether widget looks ok with this color, or not.
>
> 3) Window Decoratiojns - they are BLUE on all screenshots!
> No respect for theme colors (color scheme).
> To tell more: Atlas and Win2k colors look like incompatible with this
> (Keramik-Blue) Window Decorations.
>
Take a look at these screenshots then:

http://sneulv.dk/snapshot-atlas.png
http://sneulv.dk/snapshot-default.png
http://sneulv.dk/snapshot-redmond2000.png
http://sneulv.dk/snapshot-default.png

It uses both the base and the blend colour for colourizing the window 
decorations.  Unfortunately this method doesnt look very good on 
colourschemes that does not have gradients.

The patch is attached.

greetings
Allan

["blender-patch" (text/x-diff)]

? blender-patch
Index: keramik.cpp
===================================================================
RCS file: /home/kde/kdebase/kwin/clients/keramik/keramik.cpp,v
retrieving revision 1.3
diff -u -3 -p -r1.3 keramik.cpp
--- keramik.cpp	2002/05/18 06:41:41	1.3
+++ keramik.cpp	2002/06/14 14:54:04
@@ -60,7 +60,7 @@ static const int buttonMargin    = 9;
 static const int buttonSpacing   = 4;
 static const int iconSpacing     = 5;
 
-static const bool recolorPixmaps = false; // ### only for debugging
+static const bool recolorPixmaps = true; // ### only for debugging
 
 // Default button layout
 static const char default_left[]  = "M";
@@ -190,44 +190,47 @@ KeramikHandler::~KeramikHandler()
 
 void KeramikHandler::createPixmaps()
 {
-	QColor titleColor  = options->color( Options::TitleBar, true );
+	QColor activeTitleColor  = options->color( Options::TitleBar, true );
+	QColor activeTitleBlend  = options->color( Options::TitleBlend, true );
+	QColor inactiveTitleColor  = options->color( Options::TitleBar, false );
+	QColor inactiveTitleBlend  = options->color( Options::TitleBlend, false \
);  QColor buttonColor = options->color( Options::ButtonBg, true );
 
-	activeTiles[ TitleLeft ]       = loadPixmap( "titlebar-active-left",   \
                titleColor );
-	activeTiles[ TitleCenter ]     = loadPixmap( "titlebar-active-center", \
                titleColor );
-	activeTiles[ TitleRight ]      = loadPixmap( "titlebar-active-right",  \
                titleColor );
-
-	inactiveTiles[ TitleLeft ]     = loadPixmap( "titlebar-inactive-left",   \
                titleColor );
-	inactiveTiles[ TitleCenter ]   = loadPixmap( "titlebar-inactive-center", \
                titleColor );
-	inactiveTiles[ TitleRight ]    = loadPixmap( "titlebar-inactive-right",  \
titleColor ); +	activeTiles[ TitleLeft ]       = loadPixmap( \
"titlebar-active-left",   activeTitleColor, activeTitleBlend ); \
+	activeTiles[ TitleCenter ]     = loadPixmap( "titlebar-active-center", \
activeTitleColor, activeTitleBlend ); +	activeTiles[ TitleRight ]      = \
loadPixmap( "titlebar-active-right",  activeTitleColor, activeTitleBlend ); \
+ +	inactiveTiles[ TitleLeft ]     = loadPixmap( "titlebar-inactive-left",  \
inactiveTitleColor, inactiveTitleBlend ); +	inactiveTiles[ TitleCenter ]   \
= loadPixmap( "titlebar-inactive-center", inactiveTitleColor, \
inactiveTitleBlend ); +	inactiveTiles[ TitleRight ]    = loadPixmap( \
"titlebar-inactive-right",  inactiveTitleColor, inactiveTitleBlend );  
 	if ( smallCaptionBubbles ) {
-		activeTiles[ CaptionLeft ]   = loadPixmap( "caption-active-small-left",  \
                titleColor );
-		activeTiles[ CaptionCenter ] = loadPixmap( \
                "caption-active-small-center", titleColor );
-		activeTiles[ CaptionRight ]  = loadPixmap( "caption-active-small-right", \
titleColor ); +		activeTiles[ CaptionLeft ]   = loadPixmap( \
"caption-active-small-left",   activeTitleColor, activeTitleBlend ); \
+		activeTiles[ CaptionCenter ] = loadPixmap( \
"caption-active-small-center", activeTitleColor, activeTitleBlend ); \
+		activeTiles[ CaptionRight ]  = loadPixmap( "caption-active-small-right", \
activeTitleColor, activeTitleBlend );  } else {
-		activeTiles[ CaptionLeft ]   = loadPixmap( "caption-active-large-left",  \
                titleColor );
-		activeTiles[ CaptionCenter ] = loadPixmap( \
                "caption-active-large-center", titleColor );
-		activeTiles[ CaptionRight ]  = loadPixmap( "caption-active-large-right", \
titleColor ); +		activeTiles[ CaptionLeft ]   = loadPixmap( \
"caption-active-large-left",   activeTitleColor, activeTitleBlend ); \
+		activeTiles[ CaptionCenter ] = loadPixmap( \
"caption-active-large-center", activeTitleColor, activeTitleBlend ); \
+		activeTiles[ CaptionRight ]  = loadPixmap( "caption-active-large-right", \
activeTitleColor, activeTitleBlend );  }
 
-	inactiveTiles[ CaptionLeft ]   = loadPixmap( "caption-inactive-left",   \
                titleColor );
-	inactiveTiles[ CaptionCenter ] = loadPixmap( "caption-inactive-center", \
                titleColor );
-	inactiveTiles[ CaptionRight ]  = loadPixmap( "caption-inactive-right",  \
                titleColor );
-
-	activeTiles[ GrabBarLeft ]     = loadPixmap( "grabbar-active-left",   \
                titleColor );
-	activeTiles[ GrabBarCenter ]   = loadPixmap( "grabbar-active-center", \
                titleColor );
-	activeTiles[ GrabBarRight ]    = loadPixmap( "grabbar-active-right",  \
                titleColor );
-
-	inactiveTiles[ GrabBarLeft ]   = loadPixmap( "grabbar-inactive-left",   \
                titleColor );
-	inactiveTiles[ GrabBarCenter ] = loadPixmap( "grabbar-inactive-center", \
                titleColor );
-	inactiveTiles[ GrabBarRight ]  = loadPixmap( "grabbar-inactive-right",  \
titleColor ); +	inactiveTiles[ CaptionLeft ]   = loadPixmap( \
"caption-inactive-left",   inactiveTitleColor, inactiveTitleBlend ); \
+	inactiveTiles[ CaptionCenter ] = loadPixmap( "caption-inactive-center", \
inactiveTitleColor, inactiveTitleBlend ); +	inactiveTiles[ CaptionRight ]  \
= loadPixmap( "caption-inactive-right",  inactiveTitleColor, \
inactiveTitleBlend ); +
+	activeTiles[ GrabBarLeft ]     = loadPixmap( "grabbar-active-left",   \
activeTitleColor, activeTitleBlend ); +	activeTiles[ GrabBarCenter ]   = \
loadPixmap( "grabbar-active-center", activeTitleColor, activeTitleBlend ); \
+	activeTiles[ GrabBarRight ]    = loadPixmap( "grabbar-active-right",  \
activeTitleColor, activeTitleBlend ); +
+	inactiveTiles[ GrabBarLeft ]   = loadPixmap( "grabbar-inactive-left",   \
inactiveTitleColor, inactiveTitleBlend ); +	inactiveTiles[ GrabBarCenter ] \
= loadPixmap( "grabbar-inactive-center", inactiveTitleColor, \
inactiveTitleBlend ); +	inactiveTiles[ GrabBarRight ]  = loadPixmap( \
"grabbar-inactive-right",  inactiveTitleColor, inactiveTitleBlend );  
-	activeTiles[ BorderLeft ]    = loadPixmap( "border-active-left",  \
                titleColor );
-	activeTiles[ BorderRight ]   = loadPixmap( "border-active-right", \
titleColor ); +	activeTiles[ BorderLeft ]    = loadPixmap( \
"border-active-left",  activeTitleColor, activeTitleBlend ); +	activeTiles[ \
BorderRight ]   = loadPixmap( "border-active-right", activeTitleColor, \
activeTitleBlend );  
-	inactiveTiles[ BorderLeft ]  = loadPixmap( "border-inactive-left",  \
                titleColor );
-	inactiveTiles[ BorderRight ] = loadPixmap( "border-inactive-right", \
titleColor ); +	inactiveTiles[ BorderLeft ]  = loadPixmap( \
"border-inactive-left",  inactiveTitleColor, inactiveTitleBlend ); \
+	inactiveTiles[ BorderRight ] = loadPixmap( "border-inactive-right", \
inactiveTitleColor, inactiveTitleBlend );  
 	titleButtonRound  = loadPixmap( "titlebutton-round",  buttonColor );
 	titleButtonSquare = loadPixmap( "titlebutton-square", buttonColor );
@@ -328,13 +331,24 @@ QPixmap *KeramikHandler::loadPixmap( con
 {
 	if ( recolorPixmaps ) {
 		QImage img = qembed_findImage( name ).copy();
-		//KIconEffect::colorize( img, col, 1.0 );
-		recolor( img, col );
+		KIconEffect::colorize( img, col, 1.0 );
+		//recolor( img, col );
 		return new QPixmap( img );
 	} else
 		return new QPixmap( qembed_findImage(name) );
 }
 
+QPixmap *KeramikHandler::loadPixmap( const QString &name, const QColor \
&color, +						          const QColor &blend)
+{
+	if ( recolorPixmaps ) {
+		QImage img = qembed_findImage( name ).copy();
+		//KIconEffect::colorize( img, col, 1.0 );
+		recolor( img, color, blend );
+		return new QPixmap( img );
+	} else
+		return new QPixmap( qembed_findImage(name) );
+}
 
 // This is the recoloring method from the Keramik widget style,
 // copyright (c) 2002 Malte Starostik <malte@kde.org>.
@@ -361,6 +375,44 @@ void KeramikHandler::recolor( QImage &im
 	}
 }
 
+static QColor blender(const QColor& base, const int sat, const QColor& \
blend)  +{
+    float rsat = sat;
+    float vbase = rsat / 256.0;
+    float vblend = (1-vbase);
+    float rbase, gbase, bbase, rblend, gblend, bblend;
+    rbase = base.red(); gbase = base.green(); bbase = base.blue();
+    rblend = blend.red(); gblend = blend.green(); bblend = blend.blue();
+    
+    float rval, bval, gval;
+    rval = rbase * vbase + rblend * vblend;
+    gval = gbase * vbase + gblend * vblend;
+    bval = bbase * vbase + bblend * vblend;
+    
+    return QColor((int)rval, (int)gval, (int)bval);
+}
+
+
+// This is a recoloring method using a blender.
+// copyright (c) 2002 Allan Sandfeld.
+void KeramikHandler::recolor( QImage &img, const QColor& color, const \
QColor& blend ) +{
+	int pixels = (img.depth() > 8 ? img.width() * img.height() : \
img.numColors()); +	Q_UINT32* data = ( img.depth() > 8 ? \
(Q_UINT32*)img.bits() +				           : (Q_UINT32*)img.colorTable());
+	
+	for ( int i = 0; i < pixels; i++ )
+	{
+		QColor c( *data );
+		int h, s, v , v2;
+		c.hsv( &h, &s, &v );
+		c = blender(color,s,blend);
+		c.hsv( &h, &s, &v2 );
+		c.setHsv( h, s, QMIN( v * v2 / 228, 255 ) );
+		*data = ( c.rgb() & RGB_MASK ) | ( *data & ~RGB_MASK );
+		data++;
+	}
+}
 
 void KeramikHandler::reset()
 {
Index: keramik.h
===================================================================
RCS file: /home/kde/kdebase/kwin/clients/keramik/keramik.h,v
retrieving revision 1.1.1.1
diff -u -3 -p -r1.1.1.1 keramik.h
--- keramik.h	2002/05/17 16:33:40	1.1.1.1
+++ keramik.h	2002/06/14 14:54:05
@@ -92,7 +92,9 @@ namespace KWinInternal {
 			void flip( QPixmap *&, QPixmap *& );
 			void flip( QPixmap *& );
 			void recolor( QImage &, const QColor & );
+			void recolor( QImage &, const QColor &, const QColor & );
 			QPixmap *loadPixmap( const QString &, const QColor & );
+			QPixmap *loadPixmap( const QString &, const QColor &, const QColor & );
 
 		private:
 			bool showIcons, shadowedText, smallCaptionBubbles;



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

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