Comments (5)
I'm closing this, it looks like it will be fixed upstream with Skia: https://groups.google.com/g/skia-discuss/c/WzZaQU3-Lds
I hope this helps
from react-native-skia.
from react-native-skia.
@wcandillon I tried the code below on the web but it doesn't work. 🥲
const half3 W = half3(0.2125, 0.7154, 0.0721);
half3 overlayBlender(half3 Color, half3 filter) {
half3 filter_result;
float luminance = dot(filter, W);
if (luminance < 0.5)
filter_result = 2. * filter * Color;
else
filter_result = 1. - (1. - (2. * (filter - 0.5))) * (1. - Color);
return filter_result;
}
half3 BrightnessContrastSaturation(half3 color, float brt, float con, float sat) {
half3 black = half3(0., 0., 0.);
half3 middle = half3(0.5, 0.5, 0.5);
float luminance = dot(color, W);
half3 gray = half3(luminance, luminance, luminance);
half3 brtColor = mix(black, color, brt);
half3 conColor = mix(middle, brtColor, con);
half3 satColor = mix(gray, conColor, sat);
return satColor;
}
half4 setFilter(vec2 uv) {
half3 imageColor = iImage1.eval(uv).rgb;
// Adjust the brightness/contrast/saturation
float T_bright = 1.0;
float T_contrast = 1.0;
float T_saturation = 1.0;
half3 bcs_result = BrightnessContrastSaturation(imageColor, T_bright, T_contrast, T_saturation);
// More red, less blue
half3 rb_result = half3(bcs_result.r * 1.3, bcs_result.g, bcs_result.b * 0.9);
// Add filter (overlay blending)
half3 after_filter = mix(rb_result, overlayBlender(rb_result, imageColor), 0.55);
return half4(after_filter, 1);
}
half4 main(float2 fragCoord) {
return setFilter(fragCoord);
}
from react-native-skia.
Thank you @daehyeonmun2021 for such a concise and nicely reproducible example. if you replace the use of the filter variable name, it will work nicely on Android too. I am currently investigating why this error wasn't nicely throw on the React Native side.
from react-native-skia.
@wcandillon Thanks :D
from react-native-skia.
Related Issues (20)
- Gestures example not working HOT 1
- How to make a shape move along a predetermined path
- android build examples fails: libsvg.a missing and no known rule to make it HOT 1
- Alpha channel not working properly in sksl shader HOT 2
- Using React Native Skia With Expo: Could not find component config for native component HOT 6
- Expo Web doesnt work in development mode HOT 4
- How to handle SVG images on web? HOT 12
- Shadow for SVG `<Path>` is not working (its just a rect) HOT 1
- A black screen appeared after pausing the video HOT 4
- Some frames are missing at the very end of a video
- Derived value (useDerivedValue) doesn't work for BoxShadow / Shadow HOT 1
- Taking a screenshot on the Android's webView shows a black screen. HOT 8
- Box is missing from sidebar HOT 2
- Creating Image from Uint8Array HOT 2
- Packaged fonts show as system fonts on iOS but not Android HOT 2
- Sampling issue with WebP HOT 2
- Android release apk crash HOT 11
- Snapshot View with react-native-svg inside
- "Timed out waiting for modules to be invalidated" error after reloading app over metro [iOS] HOT 11
- Animations Colors gives when running jest (0 , _interpolate.interpolate) is not a function HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-skia.