mirror of
https://github.com/status-im/react-native-transparent-video.git
synced 2025-02-22 11:18:17 +00:00
21 lines
539 B
Metal
21 lines
539 B
Metal
|
//
|
||
|
// AlphaFrameFilter.metal
|
||
|
// MyTransparentVideoExample
|
||
|
//
|
||
|
// Created by Quentin Fasquel on 22/03/2020.
|
||
|
// Copyright © 2020 Quentin Fasquel. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#include <metal_stdlib>
|
||
|
#include <CoreImage/CoreImage.h> // includes CIKernelMetalLib.h
|
||
|
|
||
|
extern "C" {
|
||
|
namespace coreimage {
|
||
|
float4 alphaFrame(sampler source, sampler mask) {
|
||
|
float4 color = source.sample(source.coord());
|
||
|
float opacity = mask.sample(mask.coord()).r;
|
||
|
return float4(color.rgb, opacity);
|
||
|
}
|
||
|
}
|
||
|
}
|