Results 1 to 2 of 2

Thread: Need help simplifying the logic of an image editor program

  1. #1
    Join Date
    Jun 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Question Need help simplifying the logic of an image editor program

    I am creating an image editor where I perform pixel manipulations to a QImage object, and use a QPixmap (displayed through a QLabel) to represent the changes made to the QImage. The reason why I am using two separate objects for the image is that the QLabel is resizable (to offer the user a better view), and hence, the QPixmap may not be the exact representation of the image. For a better explanation of the relationship between the objects, see the following diagram:

    Document 1.jpg

    Therefore, this is what is happening in my program:

    1. The user performs mouse movements over the QLabel, in order to edit the image.
    2. The x, y coordinates of the mouse events are used to determine the particular pixel of the QPixmap (the resized image).
    3. The pixel's x, y values and the resize factor of the QPixmap are used to determine the target pixel of the QImage.
    4. The target pixel is modified.
    5. A new QPixmap is created from the modified QImage, which is then used to replace the old one.



    As you can probably guess, this design is pretty slow. It won't be a big issue for smaller images, but for larger images I need to speed things up. How do I do it? How do programs like Photoshop achieve this?

  2. #2
    Join Date
    Jun 2012
    Posts
    14
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Need help simplifying the logic of an image editor program

    You could do without the QPixmap if you subclass QLabel and override the paintEvent. You'ld probably need to keep track of your transform but that shouldn't be a problem.

Similar Threads

  1. Looking for good text/image editor for printer
    By Ratheendrans in forum Qt Programming
    Replies: 2
    Last Post: 9th October 2013, 09:37
  2. Logic of communication program
    By pupqt in forum Newbie
    Replies: 1
    Last Post: 7th April 2011, 08:19
  3. How to separate program logic from GUI
    By radex99 in forum Qt Programming
    Replies: 1
    Last Post: 19th September 2010, 19:14
  4. Ladder logic editor
    By GuL in forum Newbie
    Replies: 4
    Last Post: 23rd October 2009, 23:02
  5. Is there any property editor to use in my program?
    By Morea in forum Qt Programming
    Replies: 2
    Last Post: 25th December 2008, 19:21

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.