removed quite some deprecated functions around pixmaps

(crossing fingers I didn't overlook some use of ::resize that
need the old pixmap data copied)

svn path=/trunk/KDE/kdebase/workspace/; revision=534212
This commit is contained in:
Stephan Kulow 2006-04-26 16:05:58 +00:00
parent 423fc126d5
commit 072a101a10
16 changed files with 178 additions and 223 deletions

View file

@ -1,5 +1,5 @@
#ifndef CLIENTS/B2/B2CLIENT.CPP
#define CLIENTS/B2/B2CLIENT.CPP
#ifndef CLIENTS_B2_B2CLIENT
#define CLIENTS_B2_B2CLIENT
/*
* B-II KWin Client
*
@ -36,6 +36,7 @@
#include <qbitmap.h>
#include <qlabel.h>
#include <qtooltip.h>
#include <kpixmap.h>
#include <X11/Xlib.h>
#include <QX11Info>
@ -200,7 +201,7 @@ static void create_pixmaps()
switch (i / NumStates) {
case P_MAX: // will be initialized by copying P_CLOSE
case P_RESIZE:
pixmap[i] = new KPixmap;
pixmap[i] = new KPixmap();
break;
case P_ICONIFY:
pixmap[i] = new KPixmap(10, 10);
@ -986,15 +987,13 @@ static void redraw_pixmaps()
}
// normalize + iconify
KPixmap smallBox;
smallBox.resize(10, 10);
KPixmap largeBox;
largeBox.resize(12, 12);
KPixmap smallBox( 10, 10 );
KPixmap largeBox( 12, 12 );
for (i = 0; i < NumStates; i++) {
bool is_act = (i < 3);
bool is_down = (i == Down || i == IDown);
KPixmap *pix = pixmap[P_NORMALIZE * NumStates + i];
QPixmap *pix = pixmap[P_NORMALIZE * NumStates + i];
drawB2Rect(&smallBox, is_act ? aGrp.color( QPalette::Button ) : iGrp.color( QPalette::Button ), is_down);
drawB2Rect(&largeBox, is_act ? aGrp.color( QPalette::Button ) : iGrp.color( QPalette::Button ), is_down);
pix->fill(options()->color(KDecoration::ColorTitleBar, is_act));
@ -1090,7 +1089,7 @@ static void redraw_pixmaps()
if (!titleGradient[i]) {
titleGradient[i] = new KPixmap;
}
titleGradient[i]->resize(64, buttonSize + 3);
*titleGradient[i] = QPixmap(64, buttonSize + 3);
KPixmapEffect::gradient(*titleGradient[i],
titleColor[2 * i], titleColor[2 * i + 1],
KPixmapEffect::VerticalGradient);
@ -1226,7 +1225,7 @@ QSizePolicy B2Button::sizePolicy() const
void B2Button::drawButton(QPainter *p)
{
KPixmap* gradient = titleGradient[client->isActive() ? 0 : 1];
QPixmap* gradient = titleGradient[client->isActive() ? 0 : 1];
if (gradient) {
p->drawTiledPixmap(0, 0, buttonSize, buttonSize, *gradient, 0, 2);
} else {
@ -1346,7 +1345,7 @@ bool B2Titlebar::x11Event(XEvent *e)
void B2Titlebar::drawTitlebar(QPainter &p, bool state)
{
KPixmap* gradient = titleGradient[state ? 0 : 1];
QPixmap* gradient = titleGradient[state ? 0 : 1];
QRect t = rect();
// black titlebar frame
@ -1371,7 +1370,7 @@ void B2Titlebar::drawTitlebar(QPainter &p, bool state)
void B2Titlebar::recalcBuffer()
{
titleBuffer.resize(width(), height());
titleBuffer = QPixmap(width(), height());
QPainter p(&titleBuffer);
drawTitlebar(p, true);

View file

@ -21,7 +21,7 @@
#include <QShowEvent>
#include <QResizeEvent>
#include <QMouseEvent>
#include <kpixmap.h>
#include <QPixmap>
#include <kdecoration.h>
#include <kdecorationfactory.h>
@ -40,8 +40,8 @@ public:
~B2Button() {};
void setBg(const QColor &c){bg = c;}
void setPixmaps(KPixmap *pix, KPixmap *pixDown, KPixmap *iPix,
KPixmap *iPixDown);
void setPixmaps(QPixmap *pix, QPixmap *pixDown, QPixmap *iPix,
QPixmap *iPixDown);
void setPixmaps(int button_id);
void setToggle(){setCheckable(true);}
void setActive(bool on){setChecked(on);}
@ -59,7 +59,7 @@ private:
void leaveEvent(QEvent *e);
bool useMiniIcon;
KPixmap *icon[6];
QPixmap *icon[6];
QColor bg; //only use one color (the rest is pixmap) so forget QPalette ;)
public:
@ -91,7 +91,7 @@ private:
B2Client *client;
QString oldTitle;
KPixmap titleBuffer;
QPixmap titleBuffer;
QPoint moveOffset;
bool set_x11mask;
bool isfullyobscured;

View file

@ -26,6 +26,7 @@
#include <qapplication.h>
#include <qlabel.h>
#include <kdebug.h>
#include <kpixmap.h>
#include <QPolygon>
#include <QStyle>
@ -118,7 +119,7 @@ static const unsigned char pinup_mask_bits[] = {
// ===========================================================================
static QPixmap* titlePix;
static KPixmap* titlePix;
static KPixmap* titleBuffer;
static KPixmap* aUpperGradient;
static KPixmap* iUpperGradient;
@ -267,7 +268,7 @@ void KDEDefaultHandler::createPixmaps()
QPainter p;
QPainter maskPainter;
int i, x, y;
titlePix = new QPixmap(132, normalTitleHeight+2);
titlePix = new KPixmap(132, normalTitleHeight+2);
QBitmap mask(132, normalTitleHeight+2);
mask.fill(Qt::color0);
@ -305,8 +306,7 @@ void KDEDefaultHandler::createPixmaps()
// Create the titlebar gradients
if (activeTitleColor1 != activeTitleColor2)
{
aUpperGradient = new KPixmap;
aUpperGradient->resize(128, normalTitleHeight+2);
aUpperGradient = new KPixmap(128, normalTitleHeight+2);
KPixmapEffect::gradient(*aUpperGradient,
activeTitleColor1,
activeTitleColor2,
@ -315,8 +315,7 @@ void KDEDefaultHandler::createPixmaps()
if (inactiveTitleColor1 != inactiveTitleColor2)
{
iUpperGradient = new KPixmap;
iUpperGradient->resize(128, normalTitleHeight+2);
iUpperGradient = new KPixmap(128, normalTitleHeight+2);
KPixmapEffect::gradient(*iUpperGradient,
inactiveTitleColor1,
@ -331,16 +330,14 @@ void KDEDefaultHandler::createPixmaps()
// Active pins
g = options()->palette( ColorButtonBg, true );
pinUpPix = new KPixmap();
pinUpPix->resize(16, 16);
pinUpPix = new KPixmap(16, 16);
p.begin( pinUpPix );
kColorBitmaps( &p, g, 0, 0, 16, 16, true, pinup_white_bits,
pinup_gray_bits, NULL, NULL, pinup_dgray_bits, NULL );
p.end();
pinUpPix->setMask( QBitmap::fromData(QSize( 16, 16 ), pinup_mask_bits) );
pinDownPix = new KPixmap();
pinDownPix->resize(16, 16);
pinDownPix = new KPixmap(16, 16);
p.begin( pinDownPix );
kColorBitmaps( &p, g, 0, 0, 16, 16, true, pindown_white_bits,
pindown_gray_bits, NULL, NULL, pindown_dgray_bits, NULL );
@ -349,16 +346,14 @@ void KDEDefaultHandler::createPixmaps()
// Inactive pins
g = options()->palette( ColorButtonBg, false );
ipinUpPix = new KPixmap();
ipinUpPix->resize(16, 16);
ipinUpPix = new KPixmap(16, 16);
p.begin( ipinUpPix );
kColorBitmaps( &p, g, 0, 0, 16, 16, true, pinup_white_bits,
pinup_gray_bits, NULL, NULL, pinup_dgray_bits, NULL );
p.end();
ipinUpPix->setMask( QBitmap::fromData(QSize( 16, 16 ), pinup_mask_bits) );
ipinDownPix = new KPixmap();
ipinDownPix->resize(16, 16);
ipinDownPix = new KPixmap(16, 16);
p.begin( ipinDownPix );
kColorBitmaps( &p, g, 0, 0, 16, 16, true, pindown_white_bits,
pindown_gray_bits, NULL, NULL, pindown_dgray_bits, NULL );
@ -369,41 +364,25 @@ void KDEDefaultHandler::createPixmaps()
titleBuffer = new KPixmap();
// Cache all possible button states
leftBtnUpPix[true] = new KPixmap();
leftBtnUpPix[true]->resize(normalTitleHeight, normalTitleHeight);
leftBtnDownPix[true] = new KPixmap();
leftBtnDownPix[true]->resize(normalTitleHeight, normalTitleHeight);
ileftBtnUpPix[true] = new KPixmap();
ileftBtnUpPix[true]->resize(normalTitleHeight, normalTitleHeight);
ileftBtnDownPix[true] = new KPixmap();
ileftBtnDownPix[true]->resize(normalTitleHeight, normalTitleHeight);
leftBtnUpPix[true] = new KPixmap(normalTitleHeight, normalTitleHeight);
leftBtnDownPix[true] = new KPixmap(normalTitleHeight, normalTitleHeight);
ileftBtnUpPix[true] = new KPixmap(normalTitleHeight, normalTitleHeight);
ileftBtnDownPix[true] = new KPixmap(normalTitleHeight, normalTitleHeight);
rightBtnUpPix[true] = new KPixmap();
rightBtnUpPix[true]->resize(normalTitleHeight, normalTitleHeight);
rightBtnDownPix[true] = new KPixmap();
rightBtnDownPix[true]->resize(normalTitleHeight, normalTitleHeight);
irightBtnUpPix[true] = new KPixmap();
irightBtnUpPix[true]->resize(normalTitleHeight, normalTitleHeight);
irightBtnDownPix[true] = new KPixmap();
irightBtnDownPix[true]->resize(normalTitleHeight, normalTitleHeight);
rightBtnUpPix[true] = new KPixmap(normalTitleHeight, normalTitleHeight);
rightBtnDownPix[true] = new KPixmap(normalTitleHeight, normalTitleHeight);
irightBtnUpPix[true] = new KPixmap(normalTitleHeight, normalTitleHeight);
irightBtnDownPix[true] = new KPixmap(normalTitleHeight, normalTitleHeight);
leftBtnUpPix[false] = new KPixmap();
leftBtnUpPix[false]->resize(toolTitleHeight, normalTitleHeight);
leftBtnDownPix[false] = new KPixmap();
leftBtnDownPix[false]->resize(toolTitleHeight, normalTitleHeight);
ileftBtnUpPix[false] = new KPixmap();
ileftBtnUpPix[false]->resize(normalTitleHeight, normalTitleHeight);
ileftBtnDownPix[false] = new KPixmap();
ileftBtnDownPix[false]->resize(normalTitleHeight, normalTitleHeight);
leftBtnUpPix[false] = new KPixmap(toolTitleHeight, normalTitleHeight);
leftBtnDownPix[false] = new KPixmap(toolTitleHeight, normalTitleHeight);
ileftBtnUpPix[false] = new KPixmap(normalTitleHeight, normalTitleHeight);
ileftBtnDownPix[false] = new KPixmap(normalTitleHeight, normalTitleHeight);
rightBtnUpPix[false] = new KPixmap();
rightBtnUpPix[false]->resize(toolTitleHeight, toolTitleHeight);
rightBtnDownPix[false] = new KPixmap();
rightBtnDownPix[false]->resize(toolTitleHeight, toolTitleHeight);
irightBtnUpPix[false] = new KPixmap();
irightBtnUpPix[false]->resize(toolTitleHeight, toolTitleHeight);
irightBtnDownPix[false] = new KPixmap();
irightBtnDownPix[false]->resize(toolTitleHeight, toolTitleHeight);
rightBtnUpPix[false] = new KPixmap(toolTitleHeight, toolTitleHeight);
rightBtnDownPix[false] = new KPixmap(toolTitleHeight, toolTitleHeight);
irightBtnUpPix[false] = new KPixmap(toolTitleHeight, toolTitleHeight);
irightBtnDownPix[false] = new KPixmap(toolTitleHeight, toolTitleHeight);
// Draw the button state pixmaps
g = options()->palette( ColorTitleBar, true );
@ -642,7 +621,7 @@ void KDEDefaultButton::drawButton(QPainter *p)
if (deco) {
// Fill the button background with an appropriate button image
KPixmap btnbg;
QPixmap btnbg;
if (isLeft() ) {
if (isDown())
@ -666,7 +645,7 @@ void KDEDefaultButton::drawButton(QPainter *p)
// Fill the button background with an appropriate color/gradient
// This is for sticky and menu buttons
KPixmap* grad = active ? aUpperGradient : iUpperGradient;
QPixmap* grad = active ? aUpperGradient : iUpperGradient;
if (!grad) {
QColor c = KDecoration::options()->color(KDecoration::ColorTitleBar, active);
p->fillRect(0, 0, width(), height(), c );
@ -887,9 +866,9 @@ void KDEDefaultClient::paintEvent( QPaintEvent* )
QPalette g;
int offset;
KPixmap* upperGradient = isActive() ? aUpperGradient : iUpperGradient;
QPixmap* upperGradient = isActive() ? aUpperGradient : iUpperGradient;
QPainter p(widget());
QPainter p(widget());
// Obtain widget bounds.
QRect r(widget()->rect());
@ -907,16 +886,16 @@ void KDEDefaultClient::paintEvent( QPaintEvent* )
r = titleRect();
int rightOffset = r.x()+r.width()+1;
// Create a disposable pixmap buffer for the titlebar
// Create a disposable pixmap buffer for the titlebar
// very early before drawing begins so there is no lag
// during painting pixels.
titleBuffer->resize( rightOffset-3, titleHeight+1 );
*titleBuffer = QPixmap( rightOffset-3, titleHeight+1 );
// Draw an outer black frame
p.setPen(Qt::black);
p.drawRect(x,y,w,h);
// Draw part of the frame that is the titlebar color
// Draw part of the frame that is the titlebar color
g = options()->palette(ColorTitleBar, isActive());
p.setPen(g.color( QPalette::Light ));
p.drawLine(x+1, y+1, rightOffset-1, y+1);

View file

@ -15,13 +15,13 @@
#include <qbitmap.h>
#include <qdatetime.h>
#include <kpixmap.h>
#include <kcommondecoration.h>
#include <kdecorationfactory.h>
class QSpacerItem;
class QBoxLayout;
class QGridLayout;
class KPixmap;
namespace Default {

View file

@ -1225,7 +1225,7 @@ void KeramikClient::updateCaptionBuffer()
QPixmap *icon = NULL;
if ( captionBuffer.size() != captionRect.size() )
captionBuffer.resize( captionRect.size() );
captionBuffer = QPixmap( captionRect.size() );
if ( captionBuffer.isNull() )
return;

View file

@ -13,6 +13,7 @@
#include <QPixmap>
#include <QPaintEvent>
#include <kpixmapeffect.h>
#include <kpixmap.h>
#include <kdrawutil.h>
#include <kglobal.h>
#include <klocale.h>
@ -144,10 +145,8 @@ static void create_pixmaps()
titlePix->setMask(mask);
if(QPixmap::defaultDepth() > 8){
aUpperGradient = new KPixmap;
aUpperGradient->resize(32, titleHeight+2);
iUpperGradient = new KPixmap;
iUpperGradient->resize(32, titleHeight+2);
aUpperGradient = new KPixmap(32, titleHeight+2);
iUpperGradient = new KPixmap(32, titleHeight+2);
QColor bgColor = options()->color(KDecoration::ColorTitleBar, true);
KPixmapEffect::gradient(*aUpperGradient,
bgColor.light(120),
@ -162,22 +161,14 @@ static void create_pixmaps()
// buttons (active/inactive, sunken/unsunken, 2 sizes each)
QColorGroup g = options()->palette(KDecoration::ColorButtonBg, true).active();
QColor c = g.background();
btnPix1 = new KPixmap;
btnPix1->resize(btnWidth1, titleHeight);
btnDownPix1 = new KPixmap;
btnDownPix1->resize(btnWidth1, titleHeight);
btnPix2 = new KPixmap;
btnPix2->resize(btnWidth2, titleHeight);
btnDownPix2 = new KPixmap;
btnDownPix2->resize(btnWidth2, titleHeight);
iBtnPix1 = new KPixmap;
iBtnPix1->resize(btnWidth1, titleHeight);
iBtnDownPix1 = new KPixmap;
iBtnDownPix1->resize(btnWidth1, titleHeight);
iBtnPix2 = new KPixmap;
iBtnPix2->resize(btnWidth2, titleHeight);
iBtnDownPix2 = new KPixmap;
iBtnDownPix2->resize(btnWidth2, titleHeight);
btnPix1 = new KPixmap(btnWidth1, titleHeight);
btnDownPix1 = new KPixmap(btnWidth1, titleHeight);
btnPix2 = new KPixmap(btnWidth2, titleHeight);
btnDownPix2 = new KPixmap(btnWidth2, titleHeight);
iBtnPix1 = new KPixmap(btnWidth1, titleHeight);
iBtnDownPix1 = new KPixmap(btnWidth1, titleHeight);
iBtnPix2 = new KPixmap(btnWidth2, titleHeight);
iBtnDownPix2 = new KPixmap(btnWidth2, titleHeight);
if(QPixmap::defaultDepth() > 8){
KPixmapEffect::gradient(*btnPix1, c.light(120), c.dark(130),
KPixmapEffect::DiagonalGradient);
@ -203,20 +194,20 @@ static void create_pixmaps()
btnDownPix1->fill(c.rgb());
btnPix2->fill(c.rgb());
btnDownPix2->fill(c.rgb());
g = options()->palette(KDecoration::ColorButtonBg, false).active();
g = options()->palette(KDecoration::ColorButtonBg, false).active();
c = g.background();
iBtnPix1->fill(c.rgb());
iBtnDownPix1->fill(c.rgb());
iBtnPix2->fill(c.rgb());
iBtnDownPix2->fill(c.rgb());
}
g = options()->palette(KDecoration::ColorButtonBg, true).active();
g = options()->palette(KDecoration::ColorButtonBg, true).active();
c = g.background();
drawButtonFrame(btnPix1, g, false);
drawButtonFrame(btnDownPix1, g, true);
drawButtonFrame(btnPix2, g, false);
drawButtonFrame(btnDownPix2, g, true);
g = options()->palette(KDecoration::ColorButtonBg, false).active();
g = options()->palette(KDecoration::ColorButtonBg, false).active();
c = g.background();
drawButtonFrame(iBtnPix1, g, false);
drawButtonFrame(iBtnDownPix1, g, true);
@ -622,8 +613,7 @@ void LaptopClient::updateActiveBuffer( )
lastBufferWidth = rTitle.width();
bufferDirty = false;
activeBuffer.resize(rTitle.width(),
rTitle.height());
activeBuffer = QPixmap(rTitle.width(), rTitle.height());
QPainter p;
QRect r(0, 0, activeBuffer.width(), activeBuffer.height());
p.begin(&activeBuffer);

View file

@ -8,7 +8,7 @@
#define __KDECLIENT_H
#include <qbitmap.h>
#include <kpixmap.h>
#include <qpixmap.h>
#include <kcommondecoration.h>
#include <kdecorationfactory.h>
@ -54,7 +54,7 @@ private:
bool mustDrawHandle() const;
bool isTransient() const;
private:
KPixmap activeBuffer;
QPixmap activeBuffer;
int lastBufferWidth;
bool bufferDirty;
};

View file

@ -10,6 +10,7 @@
#include <QPixmap>
#include <QPaintEvent>
#include <kpixmapeffect.h>
#include <kpixmap.h>
#include <kdrawutil.h>
#include <qbitmap.h>
#include <qtooltip.h>
@ -126,7 +127,7 @@ static void make_button_fx(const QColorGroup &g, QPixmap *pix, bool light=false)
srcColor.setHsv(destH, destS, srcV);
destData[i] = srcColor.rgb();
}
pix->convertFromImage(btnDest);
*pix = QPixmap::fromImage(btnDest);
}
else{
@ -160,10 +161,8 @@ static void create_pixmaps()
btnSource = new QImage(btnhighcolor_xpm);
if(QPixmap::defaultDepth() > 8){
aUpperGradient = new KPixmap;
aUpperGradient->resize(32, title_height+2);
iUpperGradient = new KPixmap;
iUpperGradient->resize(32, title_height+2);
aUpperGradient = new KPixmap( 32, title_height+2 );
iUpperGradient = new KPixmap( 32, title_height+2);;
KPixmapEffect::gradient(*aUpperGradient,
options()->color(KDecoration::ColorTitleBar, true).light(130),
options()->color(KDecoration::ColorTitleBlend, true),
@ -376,7 +375,7 @@ void ModernSys::reset( unsigned long changed)
{
KCommonDecoration::reset(changed);
titleBuffer.resize(0, 0);
titleBuffer = QPixmap();
recalcTitleBuffer();
resetButtons();
widget()->update();
@ -517,7 +516,7 @@ void ModernSys::recalcTitleBuffer()
return;
QFontMetrics fm(options()->font(true));
titleBuffer.resize(width(), title_height+2);
titleBuffer = QPixmap(width(), title_height+2);
QPainter p;
p.begin(&titleBuffer);
if(aUpperGradient)

View file

@ -2,7 +2,6 @@
#define __MODSYSTEMCLIENT_H
#include <qbitmap.h>
#include <kpixmap.h>
#include <kcommondecoration.h>
#include <kdecorationfactory.h>

View file

@ -20,7 +20,6 @@
Boston, MA 02110-1301, USA.
*/
#include <kpixmap.h>
#include <kpixmapeffect.h>
#include <qcolor.h>

View file

@ -240,7 +240,7 @@ const QPixmap &PlastikHandler::pixmap(Pixmaps type, bool active, bool toolWindow
const int titleBarTileHeight = (toolWindow ? m_titleHeightTool : m_titleHeight) + 2;
// gradient used as well in TitleBarTileTop as TitleBarTile
const int gradientHeight = 2 + titleBarTileHeight-1;
QPixmap gradient(1, gradientHeight);
KPixmap gradient(1, gradientHeight);
QPainter painter(&gradient);
KPixmap tempPixmap( 1, 4 );
KPixmapEffect::gradient(tempPixmap,
@ -248,7 +248,7 @@ const QPixmap &PlastikHandler::pixmap(Pixmaps type, bool active, bool toolWindow
getColor(TitleGradient2, active),
KPixmapEffect::VerticalGradient);
painter.drawPixmap(0,0, tempPixmap);
tempPixmap.resize(1, gradientHeight-4);
tempPixmap = QPixmap(1, gradientHeight-4);
KPixmapEffect::gradient(tempPixmap,
getColor(TitleGradient2, active),
getColor(TitleGradient3, active),

View file

@ -27,8 +27,8 @@
#include <qbitmap.h>
#include <qpainter.h>
#include <qpixmap.h>
#include <kpixmap.h>
#include <kpixmapeffect.h>
#include <kpixmap.h>
#include <qtimer.h>
#include "plastikbutton.h"
@ -173,7 +173,7 @@ void PlastikButton::drawButton(QPainter *painter)
QRect r(0,0,width(),height());
bool active = m_client->isActive();
KPixmap tempKPixmap;
KPixmap tempPixmap;
QColor highlightColor;
if(type() == CloseButton) {
@ -222,13 +222,13 @@ void PlastikButton::drawButton(QPainter *painter)
bP.drawPoint(r.x()+1, r.bottom()-1);
bP.drawPoint(r.right()-1, r.bottom()-1);
// sides of the contour
tempKPixmap.resize(1, r.height()-2*2);
KPixmapEffect::gradient(tempKPixmap,
tempPixmap = QPixmap( 1, r.height()-2*2 );
KPixmapEffect::gradient(tempPixmap,
contourTop,
contourBottom,
KPixmapEffect::VerticalGradient);
bP.drawPixmap(r.x(), r.y()+2, tempKPixmap);
bP.drawPixmap(r.right(), r.y()+2, tempKPixmap);
bP.drawPixmap(r.x(), r.y()+2, tempPixmap);
bP.drawPixmap(r.right(), r.y()+2, tempPixmap);
// sort of anti-alias for the contour
bP.setPen(alphaBlendColors(Handler()->getColor(TitleGradient2, active),
contourTop, 150) );
@ -249,12 +249,12 @@ void PlastikButton::drawButton(QPainter *painter)
bP.setPen(sourfaceBottom);
bP.drawLine(r.x()+2, r.bottom()-1, r.right()-2, r.bottom()-1 );
// fill the rest! :)
tempKPixmap.resize(1, r.height()-2*2);
KPixmapEffect::gradient(tempKPixmap,
tempPixmap = QPixmap(1, r.height()-2*2);
KPixmapEffect::gradient(tempPixmap,
sourfaceTop,
sourfaceBottom,
KPixmapEffect::VerticalGradient);
bP.drawTiledPixmap(r.x()+1, r.y()+2, r.width()-2, r.height()-4, tempKPixmap);
bP.drawTiledPixmap(r.x()+1, r.y()+2, r.width()-2, r.height()-4, tempPixmap);
}
if (type() == MenuButton)

View file

@ -22,6 +22,7 @@
#include <qbitmap.h>
#include <qdrawutil.h>
#include <qimage.h>
#include <kpixmap.h>
#include <qapplication.h>
#include "quartz.h"
@ -294,22 +295,20 @@ void QuartzHandler::drawBlocks( KPixmap *pi, KPixmap &p, const QColor &c1, const
void QuartzHandler::createPixmaps()
{
// Obtain titlebar blend colours, and create the block stuff on pixmaps.
QColorGroup g2 = options()->palette(ColorTitleBlend, true).active();
QColorGroup g2 = options()->palette(ColorTitleBlend, true).active();
QColor c2 = g2.background();
g2 = options()->palette(ColorTitleBar, true ).active();
g2 = options()->palette(ColorTitleBar, true ).active();
QColor c = g2.background().light(130);
titleBlocks = new KPixmap();
titleBlocks->resize( normalTitleHeight*25/18, normalTitleHeight );
titleBlocks = new KPixmap( normalTitleHeight*25/18, normalTitleHeight );
drawBlocks( titleBlocks, *titleBlocks, c, c2 );
g2 = options()->palette(ColorTitleBlend, false).active();
g2 = options()->palette(ColorTitleBlend, false).active();
c2 = g2.background();
g2 = options()->palette(ColorTitleBar, false ).active();
g2 = options()->palette(ColorTitleBar, false ).active();
c = g2.background().light(130);
ititleBlocks = new KPixmap();
ititleBlocks->resize( normalTitleHeight*25/18, normalTitleHeight );
ititleBlocks = new KPixmap( normalTitleHeight*25/18, normalTitleHeight );
drawBlocks( ititleBlocks, *ititleBlocks, c, c2 );
// Set the on all desktops pin pixmaps;
@ -320,16 +319,14 @@ void QuartzHandler::createPixmaps()
c = onAllDesktopsButtonOnLeft ? g.background().light(130) : g.background();
g2 = options()->palette( ColorButtonBg, true ).active();
pinUpPix = new KPixmap();
pinUpPix->resize(16, 16);
pinUpPix = new KPixmap(16, 16);
p.begin( pinUpPix );
p.fillRect( 0, 0, 16, 16, c);
kColorBitmaps( &p, g2, 0, 1, 16, 16, true, pinup_white_bits,
pinup_gray_bits, NULL, NULL, pinup_dgray_bits, NULL );
p.end();
pinDownPix = new KPixmap();
pinDownPix->resize(16, 16);
pinDownPix = new KPixmap(16, 16);
p.begin( pinDownPix );
p.fillRect( 0, 0, 16, 16, c);
kColorBitmaps( &p, g2, 0, 1, 16, 16, true, pindown_white_bits,
@ -342,16 +339,14 @@ void QuartzHandler::createPixmaps()
c = onAllDesktopsButtonOnLeft ? g.background().light(130) : g.background();
g2 = options()->palette( ColorButtonBg, false ).active();
ipinUpPix = new KPixmap();
ipinUpPix->resize(16, 16);
ipinUpPix = new KPixmap(16, 16);
p.begin( ipinUpPix );
p.fillRect( 0, 0, 16, 16, c);
kColorBitmaps( &p, g2, 0, 1, 16, 16, true, pinup_white_bits,
pinup_gray_bits, NULL, NULL, pinup_dgray_bits, NULL );
p.end();
ipinDownPix = new KPixmap();
ipinDownPix->resize(16, 16);
ipinDownPix = new KPixmap(16, 16);
p.begin( ipinDownPix );
p.fillRect( 0, 0, 16, 16, c);
kColorBitmaps( &p, g2, 0, 1, 16, 16, true, pindown_white_bits,
@ -498,10 +493,8 @@ void QuartzButton::drawButton(QPainter *p)
// Shrink the miniIcon for tiny titlebars.
if ( height() < 16)
{
QPixmap tmpPix;
// Smooth scale the image
tmpPix.convertFromImage( btnpix.toImage().scaled(height(), height(), Qt::IgnoreAspectRatio,Qt::SmoothTransformation));
QPixmap tmpPix = QPixmap::fromImage( btnpix.toImage().scaled(height(), height(), Qt::IgnoreAspectRatio,Qt::SmoothTransformation));
p->drawPixmap( 0, 0, tmpPix );
} else {
Offset += (height() - 16)/2;
@ -748,8 +741,7 @@ void QuartzClient::paintEvent( QPaintEvent* )
QColor c2 = options()->color(ColorTitleBlend, isActive() );
// Create a disposable pixmap buffer for the titlebar
KPixmap* titleBuffer = new KPixmap;
titleBuffer->resize( maxFull?w-2:(w-2*(borderSize-1)), titleHeight );
QPixmap* titleBuffer = new QPixmap( maxFull?w-2:(w-2*(borderSize-1)), titleHeight );
QPainter p2( titleBuffer );

View file

@ -17,7 +17,6 @@
#define __KDEGALLIUM_QUARTZ_H
#include <qbitmap.h>
#include <kpixmap.h>
#include "../../lib/kcommondecoration.h"
#include "../../lib/kdecorationfactory.h"

View file

@ -23,6 +23,7 @@
#include <kimageeffect.h>
#include <kdrawutil.h>
#include <klocale.h>
#include <kpixmap.h>
#include <qbitmap.h>
#include <qimage.h>
@ -90,7 +91,7 @@ static KPixmap *iMiniBtnPix1;
static KPixmap *miniBtnDownPix1;
static KPixmap *iMiniBtnDownPix1;
static QPixmap *defaultMenuPix;
static KPixmap *defaultMenuPix;
static QColor *btnForeground;
static bool pixmaps_created = false;
@ -103,7 +104,7 @@ static inline const KDecorationOptions *options()
return KDecoration::options();
}
static void drawButtonFrame( KPixmap *pix, const QColorGroup &g, bool sunken )
static void drawButtonFrame( QPixmap *pix, const QColorGroup &g, bool sunken )
{
QPainter p;
int x2 = pix->width() - 1;
@ -149,20 +150,20 @@ static void create_pixmaps ()
miniBtnDownPix1 = new KPixmap;
iMiniBtnPix1 = new KPixmap;
iMiniBtnDownPix1 = new KPixmap;
defaultMenuPix = new QPixmap(kdelogo);
defaultMenuPix = new KPixmap(kdelogo);
// buttons (active/inactive, sunken/unsunken)
QColorGroup g = options()->palette(KDecoration::ColorButtonBg, true).active();
QColor c = g.background();
btnPix1->resize(normalTitleHeight, normalTitleHeight-2);
btnDownPix1->resize(normalTitleHeight, normalTitleHeight-2);
iBtnPix1->resize(normalTitleHeight, normalTitleHeight-2);
iBtnDownPix1->resize(normalTitleHeight, normalTitleHeight-2);
*btnPix1 = QPixmap(normalTitleHeight, normalTitleHeight-2);
*btnDownPix1 = QPixmap(normalTitleHeight, normalTitleHeight-2);
*iBtnPix1 = QPixmap(normalTitleHeight, normalTitleHeight-2);
*iBtnDownPix1 = QPixmap(normalTitleHeight, normalTitleHeight-2);
miniBtnPix1->resize(toolTitleHeight, toolTitleHeight);
miniBtnDownPix1->resize(toolTitleHeight, toolTitleHeight);
iMiniBtnPix1->resize(toolTitleHeight, toolTitleHeight);
iMiniBtnDownPix1->resize(toolTitleHeight, toolTitleHeight);
*miniBtnPix1 = QPixmap(toolTitleHeight, toolTitleHeight);
*miniBtnDownPix1 = QPixmap(toolTitleHeight, toolTitleHeight);
*iMiniBtnPix1 = QPixmap(toolTitleHeight, toolTitleHeight);
*iMiniBtnDownPix1 = QPixmap(toolTitleHeight, toolTitleHeight);
if (highcolor && false) {
KPixmapEffect::gradient(*btnPix1, c.light(130), c.dark(130),
@ -280,7 +281,7 @@ void RedmondButton::reset(unsigned long changed)
void RedmondButton::setBitmap(const unsigned char *bitmap)
{
pix.resize(0, 0);
pix = QPixmap();
if (bitmap)
deco = QBitmap(10, 10, bitmap, true);
@ -294,7 +295,7 @@ void RedmondButton::setBitmap(const unsigned char *bitmap)
void RedmondButton::setPixmap( const QPixmap &p )
{
deco.resize(0, 0);
deco = QPixmap();
pix = p;
repaint(false);
@ -335,11 +336,10 @@ void RedmondButton::drawButton(QPainter *p)
}
if ( type()==MenuButton && height() < 16) {
QPixmap tmpPix;
// Smooth scale the menu button pixmap
tmpPix.convertFromImage(
pix.toImage().scaled( height(), height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation ));
// Smooth scale the menu button pixmap
QPixmap tmpPix = QPixmap::fromImage(
pix.toImage().scaled( height(), height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation ));
p->drawPixmap( 0, 0, tmpPix );
} else {
@ -547,7 +547,7 @@ void RedmondDeco::paintEvent( QPaintEvent* )
// Create a disposable pixmap buffer for the title blend
KPixmap* titleBuffer = new KPixmap;
titleBuffer->resize(w-2*modBorderWidth, titleHeight);
*titleBuffer = QPixmap(w-2*modBorderWidth, titleHeight);
if (titleBuffer->depth() > 16) {
KPixmapEffect::gradient(*titleBuffer, c1, c2,

View file

@ -19,7 +19,6 @@
#define __KDE_REDMOND_H
#include <qbitmap.h>
#include <kpixmap.h>
#include <kcommondecoration.h>
#include <kdecorationfactory.h>