Results 1 to 6 of 6

Thread: Pixmap Overlay

  1. #1
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Red face Pixmap Overlay

    I am finally back working on my video player and I am still having problems with my overlay. I am rendering the video using DirectShow so I can enable frame skipping. What I am trying to do is click on a spot on the video, and display a red dot to show where I clicked. I thought I would create a QPixmap with a fill color of Qt::transparent so I could display this over the video. I then thought I could add the red dot to the overlay using DrawPoint with a QPainter created saying QPainter* paintOverlay = new QPainter(mpOverlay), but this did not work. The only way I can get the red point to display is on the frame itself and not the overlay or video that I display inside the frame. And everytime the update occurs, it puts the video on the screen for a split second and then shows the empty frame with its red dot. Is there anyway to add this red dot to the overlay and then display this almost transparent overlay on top of the video window? Thanks for your help!

  2. #2
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Pixmap Overlay

    see if this helps.

  3. #3
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Pixmap Overlay

    I don't think this is really going to help me. I have looked at the code and run the program, but it just makes something fade from nothing to being 100% visible. But it never shows the old image and the new image at the same time. I want my video to be shown at all times and the red dot to be displayed on top of it. I thought a transparent QPixmap with one red pixel would be able to work for this, but I am having problems getting the red pixel to draw on the transparent QPixmap and display over the video. Thanks again for your help!

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Pixmap Overlay

    Some ActiveX controls might not allow overlays. First thing you should try is to decode a frame, draw it on a QImage, draw a red dot on the image and display the result on your widget. Of course it might prove to be too slow, but it's worth to try it.

  5. #5
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Pixmap Overlay

    Should it matter what the activeX control wants since I have my DirectShow object inside a QAxWidget? I would think the QAxWidget would allow an alomst-transparent QPixmap to be displayed over it. Or does the QAxWidget have no control or say over this? Thanks again but I will take what you said into consideration!

  6. #6
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Red face Re: Pixmap Overlay

    After looking through adding an overlay through some DirectShow commands, I discovered DirectShow's functionality to add the overlay was not sufficient enough to handle my needs. Right now, I am trying to just create an overlay to put on top of my buttons to get a handle on how to use transparent overlays. Here is essentially what I want it to do.

    I intialize a couple things like this:
    Qt Code:
    1. QWidget* privateLayoutWidget = new QWidget( this );
    2. privateLayoutWidget->setGeometry( QRect( 182, 429, 248, 40 ) );
    3. mpButtonLayout = new QHBoxLayout( privateLayoutWidget );
    4.  
    5. QSize videoButtonSize( 30, 25 );
    6. mpGoBeginningButton = new QToolButton( privateLayoutWidget );
    7. mpGoBeginningButton->setMinimumSize(videoButtonSize );
    8. QFont webDings_font( "Webdings", 12 );
    9. mpGoBeginningButton->setFont( webDings_font );
    10. mpGoBeginningButton->setText( "9" );
    11. mpGoBeginningButton->setToolTip( "Jump to beginning of video" );
    12. mpButtonLayout->addWidget( mpGoBeginningButton );
    13. ...
    14. mpTest = new QPixmap( 500, 500 );
    15. mpTest->fill( Qt::transparent );
    To copy to clipboard, switch view to plain text mode 

    Then to draw my pixmap onto my object, I do the following:
    Qt Code:
    1. if( event->type( ) == QEvent::Paint )
    2. {
    3. if( pMediaSeeking != NULL )
    4. {
    5. QPainter* painter2;
    6. painter2 = new QPainter( mpTest );
    7. painter2->setPen( QPen( Qt::green, 3 ) );
    8. for( int i = 0 ; i < azElPoints.size( ) ; i++ )
    9. {
    10. if( azElPoints[i].frameNumber == getCurrentFrame( ) )
    11. {
    12. if( erasePoint == true )
    13. {
    14. // Fill the overlay with transparent again since using a
    15. // transparent pen does not remove the red dot.
    16. mpTest->fill( Qt::transparent );
    17. }
    18. painter2->drawPoint( azElPoints[i].xPos, azElPoints[i].yPos );
    19. }
    20. }
    21. //updateAlphaBitmap( );
    22. repaintWindow( );
    23. delete painter2;
    24. QPainter *painter = new QPainter( mpGoBeginningButton );
    25. painter->drawPixmap( 0, 0, *mpTest );
    26. delete painter;
    27. return true;
    28. }
    29. }
    To copy to clipboard, switch view to plain text mode 

    Is this the correct way to try and make a transparent QPixmap because if so, I cannot get it to work. I am thinking maybe I should do something other than a fill( transparent ) to make the transparent QPixmap besides the occasional dot of color, but I do not know what it is that I am missing. Any more guidance with this would be great! Thanks!
    Last edited by ToddAtWSU; 22nd June 2006 at 20:42.

Similar Threads

  1. Invalid pixmap
    By munna in forum Newbie
    Replies: 2
    Last Post: 8th June 2006, 08:00
  2. Paint XP radio button to pixmap
    By Ben.Hines in forum Qt Programming
    Replies: 2
    Last Post: 26th April 2006, 21:15
  3. Changing pixmap in PixmapLabel
    By bullerwj in forum Qt Tools
    Replies: 1
    Last Post: 11th April 2006, 22:28
  4. What's the correct way of clearing a pixmap?
    By karye in forum Qt Programming
    Replies: 4
    Last Post: 19th January 2006, 17:46
  5. How to paint a selection rectangle on a pixmap?
    By SkripT in forum Qt Programming
    Replies: 6
    Last Post: 8th January 2006, 19:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.