Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

Filter Invert Colors #120

Closed
jeremywilliams opened this issue Dec 6, 2015 · 11 comments
Closed

Filter Invert Colors #120

jeremywilliams opened this issue Dec 6, 2015 · 11 comments
Labels

Comments

@jeremywilliams
Copy link

jeremywilliams commented Dec 6, 2015

This is more of a question, is it possible to enable the capability to invert video colors on Web Chimera? If not, is there a way to build in this capability?

@RSATom
Copy link
Owner

RSATom commented Dec 6, 2015

Didn't find any libvlc option for it, and didn't find any QML effect, but it's still doable by modify shader a little bit at https://github.com/RSATom/QmlVlc/blob/master/SGVlcVideoNode.cpp#L76

@RSATom RSATom added the question label Dec 6, 2015
@jeremywilliams
Copy link
Author

Ah great thank you!

@RSATom RSATom changed the title Filter Invert Colors Filter Invert Colors [$100] Dec 10, 2015
@RSATom RSATom added the bounty label Dec 10, 2015
@colek42
Copy link

colek42 commented Dec 22, 2015

we are having some trouble compiling the source fron the current HEAD of master. vs2013 is giving the error mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in Chimera.obj. Any suggestions? We have some custom QML files so we need to compile from source.

@RSATom
Copy link
Owner

RSATom commented Dec 23, 2015

Try delete build folder and rerun prep script

@RSATom
Copy link
Owner

RSATom commented Jan 3, 2016

I've found how to solve this task solely on QML level:

    VlcVideoSurface {
        id: s1;
        source: vlcPlayer;
        anchors.fill: parent;
    }
    ShaderEffect {
        property variant source: ShaderEffectSource { sourceItem: s1; hideSource: true }
        anchors.fill: parent

        fragmentShader: "
            varying highp vec2 qt_TexCoord0;
            uniform sampler2D source;
            void main(void)
            {
                lowp vec4 tex = texture2D( source, qt_TexCoord0 );
                gl_FragColor = vec4( 1. - tex.r, 1. - tex.g, 1. - tex.b, tex.a );
            }
        "
    }

Btw, maybe it will be interesting to you, I've released proof-of-concept of desktop WebChimera: https://github.com/RSATom/WebChimera-desktop/releases

@RSATom RSATom closed this as completed Jan 3, 2016
@sclem
Copy link

sclem commented Jan 14, 2016

@RSATom,

The invert filter worked great. How can I hide it at runtime? I tried setting visible: false, but it hides the VlcVideoSurface as well. I also tried opacity: 0. I've got my javascript functions hooked up with emitJsMessage on WebChimeraPlayer. and in Functions.qml.

@RSATom
Copy link
Owner

RSATom commented Jan 14, 2016

I think you should try set hideSource = false first. If it will not help - I'll try find solution. I think it should be something simple.

@sclem
Copy link

sclem commented Jan 14, 2016

Just tried hideSource = false, no effect? Let me know if you find another solution, thanks!

@RSATom
Copy link
Owner

RSATom commented Jan 14, 2016

following works for me:

    VlcPlayer {
        id: vlcPlayer;
        mrl: "http://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_480p_stereo.avi";
    }
    VlcVideoSurface {
        id: s1
        source: vlcPlayer;

        anchors.centerIn: parent;
        width: parent.width / 2;
        height: parent.height / 2;
    }
    ShaderEffectSource {
        id: shaderSource;
        sourceItem: s1;
        hideSource: true;
    }
    ShaderEffect {
        id: shaderEffect;
        anchors.centerIn: parent;
        width: parent.width / 2;
        height: parent.height / 2;

        property variant source: shaderSource;

        fragmentShader: "
            varying highp vec2 qt_TexCoord0;
            uniform sampler2D source;
            void main(void)
            {
                lowp vec4 tex = texture2D( source, qt_TexCoord0 );
                gl_FragColor = vec4( 1. - tex.r, 1. - tex.g, 1. - tex.b, tex.a );
            }
        "
    }
    MouseArea {
        anchors.fill: parent
        onClicked: { shaderSource.hideSource = !shaderSource.hideSource; shaderEffect.visible =  shaderSource.hideSource; }
    }

@sclem
Copy link

sclem commented Jan 14, 2016

You're the man. That worked perfect, thanks!

@RSATom
Copy link
Owner

RSATom commented Jan 14, 2016

I'm glad to see you happy :)

@RSATom RSATom changed the title Filter Invert Colors [$100] Filter Invert Colors [$100 awarded] Nov 5, 2016
@RSATom RSATom changed the title Filter Invert Colors [$100 awarded] Filter Invert Colors Dec 28, 2016
@RSATom RSATom removed the bounty label Dec 28, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants