Results 1 to 4 of 4

Thread: How to implement transparent pencil tool in Qt?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2010
    Posts
    7
    Thanks
    8

    Default How to implement transparent pencil tool in Qt?

    I'm currently making a Painter like program. And I want to implement a painting tool, pencil, can draw in transparent color, such as rgb(255,0,0,100).

    I've tried to use QPainter and draw things in a QImage and then draw on a QWidget.

    Using QPainter::drawLine with QWidget::mouseMoveEvent is nice when the color is totally opacity one. However, if I use a transparent color, the point that both belongs to the last line and current line, will drawn twice(see attachment).

    And I also tried using QPainter:drawPath and QPainter::drawLines, but none of them are right for this. They won't double draw the "last point" between two lines, but can't draw twice even when user intend to do so( saying you're drawing "8" and the cross should be drawn twice).

    So, maybe impossible, is there a way to solve this? Implement a basic pencil tool?
    Attached Images Attached Images

Similar Threads

  1. Replies: 1
    Last Post: 28th December 2010, 09:43
  2. How to implement a graphical curve drawing/editing tool
    By hakiim35 in forum Qt Programming
    Replies: 3
    Last Post: 21st December 2010, 21:40
  3. Replies: 0
    Last Post: 25th August 2010, 17:39
  4. Grouping of Tool buttons in Tool bar
    By febil in forum Qt Programming
    Replies: 1
    Last Post: 24th March 2009, 11:51
  5. Transparent background on QLabel on transparent QWidget
    By codeslicer in forum Qt Programming
    Replies: 1
    Last Post: 13th February 2008, 02:10

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
  •  
Qt is a trademark of The Qt Company.