GithubHelp home page GithubHelp logo

Comments (9)

mrousavy avatar mrousavy commented on July 20, 2024 2

whoops, docs were wrong. try this:

  const invertColorsFilter = Skia.RuntimeEffect.Make(`
    uniform shader image;
    half4 main(vec2 pos) {
      vec4 color = image.eval(pos);
      return vec4((1.0 - color).rgb, 1.0);
    }
  `)
  const shaderBuilder = Skia.RuntimeShaderBuilder(invertColorsFilter!)
  const imageFilter = Skia.ImageFilter.MakeRuntimeShader(shaderBuilder, null, null)

  const paint = Skia.Paint()
  paint.setImageFilter(imageFilter)


// later:
frame.render(paint)

from react-native-vision-camera.

mrousavy avatar mrousavy commented on July 20, 2024 1

I'm already on it

from react-native-vision-camera.

mrousavy avatar mrousavy commented on July 20, 2024 1

nice

from react-native-vision-camera.

mrousavy avatar mrousavy commented on July 20, 2024

Yea they aren't up to date yet.

from react-native-vision-camera.

EkaanshArora avatar EkaanshArora commented on July 20, 2024

Happy to make a PR to fix this if you can describe the process to use a shader within the worklet.

from react-native-vision-camera.

Space6188 avatar Space6188 commented on July 20, 2024

Any news?

from react-native-vision-camera.

mrousavy avatar mrousavy commented on July 20, 2024

yes, I just released 4.0.0 and updated the docs.

from react-native-vision-camera.

Space6188 avatar Space6188 commented on July 20, 2024

Thank you for pretty library, that really cool
Unfortunately, this not working:
const invertColorsFilter = Skia.RuntimeEffect.Make(uniform shader image; half4 main(vec2 pos) { vec4 color = image.eval(pos); return vec4((1.0 - color).rgb, 1.0); });
const paint = Skia.Paint(invertColorsFilter);

const frameProcessor = useSkiaFrameProcessor(
frame => {
'worklet';
frame.render(paint);
},
[paint],
);

I have this error - 'Expected arguments: 0, received: 1.ts(2554)' inside Skia.paint(invertColorsFilter)

i working with android and this is my versions of packeges:
"react-native-vision-camera": "^4.0.1",
"@shopify/react-native-skia": "1.2.3",
"react-native-reanimated": "^3.5.4",

Maybe you know how to fix it, maybe i do something wrong

from react-native-vision-camera.

Space6188 avatar Space6188 commented on July 20, 2024

This is working now!, thank you so much

from react-native-vision-camera.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.