Skip to content
  • 0 Votes
    2 Posts
    1k Views
    SGaistS

    Hi,

    I haven't used that class but from the looks of it, using the worker object approach should be fine.

  • 0 Votes
    1 Posts
    1k Views
    No one has replied
  • 0 Votes
    10 Posts
    5k Views
    O

    @ealione I'm just saying that it's better to use scanLine than setPixel() or pixel() for larger manipulations. About the datatypes: QScriptEngine can pass or take QVariants which can be converted into QVariantList or QVariantMap. A QVariantList is just a QList<QVariant>. If you look at this example you will see that you can create custom Objects and register them so your ScriptEngine will know what they are. You could create a struct which contains the x-coordinate, the y-coordinate and a new red, blue and green value to set. Add each struct to a QVariantList and pass it to your slot which manipulates the image. Now iterate over each pixel on the image using scanLine(if you want) and set the new value if your list has a new value for the pixel. For the reading part: Same struct, read the x, y, red, green and blue into the struct, write the struct into a QVariantList for every pixel you want and then return it to your ScriptEngine.
    Also you could use a QVector<int> (as mentioned in the example).

  • 1 Votes
    7 Posts
    3k Views
    E

    hmm ok :( still thank you for the help