Canvas.requestPaint() renders Image data tinted blue

REPRODUCIBILITY: 100%
OS VERSION: > 3.4
HARDWARE: vollaphone/gigaset gs290, XA2, Xperia 10 ii
UI LANGUAGE: en
REGRESSION: YES

DESCRIPTION:

Give an Image and a Canvas, calling something like drawingCanvas.requestPaint() causes the Image to be rendered in the Canvas with a blue tint. An example in @kimmolindholm s paint (which I’m trying to resurrect):

Possibly related to:

PRECONDITIONS:

Application context:

       view->setPersistentOpenGLContext(true);
       view->setPersistentSceneGraph(true);

STEPS TO REPRODUCE:

  1. call canvas.requestPaint() with a Image object on the page.

EXPECTED RESULT:

The image should retain it’s hues. Same source deployed to 3.4 works fine.

ACTUAL RESULT:

The image is tinted.

MODIFICATIONS:

Good question, but I’ve tested on a clean install device. No difference.

ADDITIONAL INFORMATION:

Copying the data from the Image (insertedImage is an Image {} tag) ‘sometimes’ works.

        insertedImage.grabToImage(function(result, rotation)
        {
            var url = result.url
            drawingCanvas.loadImage(url)
            var ctx = drawingCanvas.getContext('2d')
            Draw.clear(ctx)
            ctx.drawImage(url, 0, 0)
            ctx.rotate(rotation)
            drawingCanvas.unloadImage(url)
            drawingCanvas.requestPaint()
            previewCanvas.clear()
        })

I would use this work-a-round BUT, ctx.rotate(rotation) does not work.

I’ve now tried this on Vollas(GS290 also) and on an Experia 10 ii.

1 Like

Same issue?

I mentioned that above, but that ticket is about ‘richtext’ in ‘Label’. This is in Canvas. I think it’s related, but haven’t figured out how.

tbh, if my suspicion is correct [that this has nothing to do with Qt and everything to do with the HAL], then both issues will be the same.

1 Like

Ah, I was thinking it had something to do with QT, but HAL, > 3.4 could be the culprit. However, I believe, the tint in html image in richtext Labels was also present in 3.4. The issue with paint was/is not. I’m uncertain since there are some issues on the Vollaphone, so I’d appreciate if people tested the build of ‘Paint’ that I’ve made available on chum and open repos.

In 3.4 (on Volla) the images in Labels (richtext) are rendered tinted. But the images loadaed and drawn to a canvas are not tinted.

@attah just confirmed that the compositing issue reported here does not appear on official sony devices. If anyone with other ports could try the paint app at Paint | OpenRepos.net — Community Repository System (also on chum) to share if importing image and compositing leads to a tint, that would be really helpful.

Tryed on XA2 4.4 licenced.
Issue also present.

Original:

Import in paint:

Thanks! So it looks like it’s more general a problem.

Seems like “negatived”.
Blue → Orange
Orange → Blue

Not exactly. Inverted / negative would be more dramatic :wink: If you take the blue highway and run the RGB-BRG swap it’s almost normal. @attah had showed QML Label dispays images with a blue-ish tint - #13 by attah a method for get back swapping Red and Green, I believe. I’ll implement a filter in paint!

1 Like

So some part of Qt is reading rgb data as grb?

It could be ‘lower’ level, but I’m still poking. @attah had some ideas as well …

Ok, I’ve implemented all the channel swaps and it is not that. It’s a swap, apply bgra (blue green red alpha) and the image is back to normal.

void main(void)
{
    if (texture2D(mask, qt_TexCoord0.st).a > 0.5)
        gl_FragColor = texture2D(source, qt_TexCoord0.st).bgra * qt_Opacity;
    else
        gl_FragColor = texture2D(source, qt_TexCoord0.st) * qt_Opacity;
}

Does the trick.

1 Like

Actually you’re more or less right :wink: blue swapped with red. close enough :slight_smile:

1 Like

On a tip from @attah I implemented a format conversion which works for me. I’d appreciate feedback. Is this a fix for an original ‘error’ in implementation?

@attah 's concise version:

works. solved. but why!

1 Like