Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Pixel Manipulation on QML Canvas Question... Uint8ClampedArray
Qt 6.11 is out! See what's new in the release blog

Pixel Manipulation on QML Canvas Question... Uint8ClampedArray

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 1.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    patrik08
    wrote on last edited by
    #1

    Is here a way to manipolate/swap image pixel color like in html5 canvas method?
    Read image is simple ... but swap color
    how i can swap black pixel to other color?

    function picData() {
                        var ctx = canvas.getContext('2d');
                        var im = ctx.createImageData(pixelurl);
                        //// im.data[3] = 128;
                        return im
                    }
    /// after draw in other position
     ctx.putImageData(picData(),cursor,fromTop,colNr(col),rowNr(row),515,315)
    
    

    My method is to read a full image like a excel table

    Only one big icon

    0_1506775098070_framectrl.png

    a sample to test is :
    https://github.com/pehohlva/QOASIS/tree/master/test/control_m

    1 Reply Last reply
    0
    • timdayT Offline
      timdayT Offline
      timday
      wrote on last edited by timday
      #2

      I'm not sure I really understand what you're trying to do, and I know little about what canvas is capable of... but I have had cases where I've wanted to recolour an image (or do some other per-pixel operation) and have found by far the easiest way is to use one of the QML Graphical Effects (if there's an existing one which does the job) or write a custom ShaderEffect (pixel manipulation logic typically 1-3 lines of GLSL in amongst the other boilerplate for an identity operation). I haven't tried it but I can't think of any reason a ShaderEffect shouldn't work on top of a canvas (unless you're not on an OpenGL platform that is).

      Another approach I've used where the application's images weren't quite right was to write (C++) a QQuickImageProvider to load a QImage, apply the needed adjustments to the QImage and then expose the tweaked result to the QML Image.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved