PDA

View Full Version : how can QPixmap transformation to QBitmap faster



duduqq
30th April 2008, 04:27
Hello :
In my programe I used the fun setMask(pixmap->createHeuristicMask()), it is very slow
to transformation,if is other fun to transformation faster.
If I used setMask(*pixmap),the programe will break down ,and I must restart my computer .
and the programe is very use the memory,how can I don't new the pixmap all the time.
If someone can help me.
the code is here:

void Ruler::paintEvent(QPaintEvent *)
{
setWindowOpacity(transparency); //设置透明度
brush->setStyle(Qt::SolidPattern) ;
brush->setColor(Qt::lightGray) ;
pixmap = new QPixmap(m_fwidth,m_fheight);
painter = new QPainter(pixmap) ;

painter->setRenderHint(QPainter::Antialiasing);

painter->translate(m_xcenter,m_ycenter);

painter->rotate(m_rotation) ;
painter->fillRect(-10,0,frulerw,frulerh,*brush) ;


painter->setPen(Qt::black) ;
//painter.setPen(Qt::SolidLine);
painter->drawRect(-10,0,frulerw,frulerh) ;

painter->setPen(Qt::black) ;

setPalette(*palette);
setMask(pixmap->createHeuristicMask(false));

delete painter ;

}

duduqq
30th April 2008, 11:01
Can you help me!!!!
Or if my bad english you cann't understand what I said ?
This program made me could not do other thing.

duduqq
2nd May 2008, 07:47
help !!!!!

duduqq
4th May 2008, 05:21
help again!!!

duduqq
4th May 2008, 05:44
In my programe I used the fun setMask(pixmap->createHeuristicMask()), it is very slow
to transformation,if is other fun to transformation faster.
If I used setMask(*pixmap),the programe will break down ,and I must restart my computer .
and the programe is very use the memory,how can I don't new the pixmap all the time.
If someone can help me.
the code is here:

void Ruler::paintEvent(QPaintEvent *)
{
setWindowOpacity(transparency); //设置透明度
brush->setStyle(Qt::SolidPattern) ;
brush->setColor(Qt::lightGray) ;
pixmap = new QPixmap(m_fwidth,m_fheight);
painter = new QPainter(pixmap) ;

painter->setRenderHint(QPainter::Antialiasing);

painter->translate(m_xcenter,m_ycenter);

painter->rotate(m_rotation) ;
painter->fillRect(-10,0,frulerw,frulerh,*brush) ;


painter->setPen(Qt::black) ;
//painter.setPen(Qt::SolidLine);
painter->drawRect(-10,0,frulerw,frulerh) ;

painter->setPen(Qt::black) ;

setPalette(*palette);
setMask(pixmap->createHeuristicMask(false));

delete painter ;

}