Results 1 to 5 of 5

Thread: how can QPixmap transformation to QBitmap faster

  1. #1
    Join Date
    Apr 2008
    Posts
    41
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default how can QPixmap transformation to QBitmap faster

    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:
    Qt Code:
    1. void Ruler::paintEvent(QPaintEvent *)
    2. {
    3. setWindowOpacity(transparency); //设置透明度
    4. brush->setStyle(Qt::SolidPattern) ;
    5. brush->setColor(Qt::lightGray) ;
    6. pixmap = new QPixmap(m_fwidth,m_fheight);
    7. painter = new QPainter(pixmap) ;
    8.  
    9. painter->setRenderHint(QPainter::Antialiasing);
    10.  
    11. painter->translate(m_xcenter,m_ycenter);
    12.  
    13. painter->rotate(m_rotation) ;
    14. painter->fillRect(-10,0,frulerw,frulerh,*brush) ;
    15.  
    16.  
    17. painter->setPen(Qt::black) ;
    18. //painter.setPen(Qt::SolidLine);
    19. painter->drawRect(-10,0,frulerw,frulerh) ;
    20.  
    21. painter->setPen(Qt::black) ;
    22.  
    23. setPalette(*palette);
    24. setMask(pixmap->createHeuristicMask(false));
    25.  
    26. delete painter ;
    27.  
    28. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by jpn; 13th May 2008 at 13:51. Reason: missing [code] tags

  2. #2
    Join Date
    Apr 2008
    Posts
    41
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default

    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.

  3. #3
    Join Date
    Apr 2008
    Posts
    41
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: how can QPixmap transformation to QBitmap faster

    help !!!!!

  4. #4
    Join Date
    Apr 2008
    Posts
    41
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: how can QPixmap convert to QBitmap faster

    help again!!!
    Last edited by duduqq; 4th May 2008 at 04:42.

  5. #5
    Join Date
    Apr 2008
    Posts
    41
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: how can QPixmap convert to QBitmap faster

    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:
    Qt Code:
    1. void Ruler::paintEvent(QPaintEvent *)
    2. {
    3. setWindowOpacity(transparency); //设置透明度
    4. brush->setStyle(Qt::SolidPattern) ;
    5. brush->setColor(Qt::lightGray) ;
    6. pixmap = new QPixmap(m_fwidth,m_fheight);
    7. painter = new QPainter(pixmap) ;
    8.  
    9. painter->setRenderHint(QPainter::Antialiasing);
    10.  
    11. painter->translate(m_xcenter,m_ycenter);
    12.  
    13. painter->rotate(m_rotation) ;
    14. painter->fillRect(-10,0,frulerw,frulerh,*brush) ;
    15.  
    16.  
    17. painter->setPen(Qt::black) ;
    18. //painter.setPen(Qt::SolidLine);
    19. painter->drawRect(-10,0,frulerw,frulerh) ;
    20.  
    21. painter->setPen(Qt::black) ;
    22.  
    23. setPalette(*palette);
    24. setMask(pixmap->createHeuristicMask(false));
    25.  
    26. delete painter ;
    27.  
    28. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by jpn; 13th May 2008 at 13:52. Reason: missing [code] tags

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.