You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

hirsch

Beginner

  • "hirsch" is male
  • "hirsch" started this thread

Posts: 6

Location: Rhineland-Palatinate

  • Send private message

1

Monday, February 23rd 2004, 10:31am

bitBlt

Hi,

I have a problem with the bitBlt() method.
I wanna draw a histogram of an Image from a QPixmap to a QPixmap using bitBlt and a Qt::OrROP function. The target QPixmap contains two colored rects to indicate the upper and lower binarization bounds.
The histogram is now drawn in the color of the rects because of the OR function. Now I copy the QPixmap to a QLabel to display it.
This works fine, no flickering, smooth updating, but the problem is: When I move my dialog out of the desktop rectangle, the colored bounds disappear and only the black histogram is drawn. The same happens if I move another dialog over the histogram.
I did it this way:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
    QPainter p;
    m_pBoundsPixmap->fill( Qt::black );
    p.begin(m_pBoundsPixmap);
    p.setPen( QPen( Qt::red ) );
    p.setBrush( Qt::red );
    p.drawRect( 0,0,m_pLowSpinBox->value(), 255 );

    p.setPen( QPen( Qt::blue ) );
    p.setBrush( Qt::blue );
    p.drawRect( m_pHighSpinBox->value(), 0, 255-m_pHighSpinBox->value(), 255 );
    p.end();

    bitBlt( m_pBoundsPixmap, QPoint( 0,0 ), m_pHistPixmap, m_pHistPixmap->rect(), Qt::OrROP );
    bitBlt( m_pHistLabel, QPoint( 0,0 ), m_pBoundsPixmap, m_pBoundsPixmap->rect(), Qt::CopyROP );


Any ideas?

Falco

Posts: 2,162

Location: Graz, Austria

Occupation: Student

  • Send private message

2

Monday, February 23rd 2004, 8:15pm

Try setting the resulting pixmap on the label using setPixmap().

Cheers,
_
Qt/KDE Developer
Debian User