Results 1 to 13 of 13

Thread: How can I copy image from anohter image

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How can I copy image from anohter image

    Try something like this for a slow approach
    Qt Code:
    1. for (int x = 0; x < oldImage.width(); ++x) {
    2. for (int y = 0; y < oldImage.width(); ++y) {
    3. QPoint p(x, y);
    4. if (polygon.containsPoint(p, Qt::OddEvenFill)) {
    5. QRgb color = oldImage.pixel(p);
    6. newImage.setPixel(p, color);
    7. }
    8. }
    9. }
    To copy to clipboard, switch view to plain text mode 
    (Untested code)

    You should investigate ways to use the image composition modes to draw a filled version of your polygon over a copy of the original leaving only the intersection. This would be much faster.

  2. The following user says thank you to ChrisW67 for this useful post:

    chong_kimkeang (27th September 2012)

Similar Threads

  1. Qwebview Copy Text And Save Image
    By ShapeShiftme in forum Qt Programming
    Replies: 4
    Last Post: 11th August 2016, 06:30
  2. Replies: 3
    Last Post: 3rd August 2012, 10:35
  3. Replies: 1
    Last Post: 29th November 2009, 20:33
  4. How to copy sellected ellipse area from image
    By adamsakli in forum Newbie
    Replies: 2
    Last Post: 24th September 2009, 22:11
  5. How to copy selected ellipse area from image
    By adamsakli in forum Qt Programming
    Replies: 5
    Last Post: 24th September 2009, 19:54

Tags for this Thread

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.