Skip to content

Commit

Permalink
Merge pull request #24 from ScribbleLabApp/auth
Browse files Browse the repository at this point in the history
🎸 Metal: Grayscale shader
  • Loading branch information
N3v1 authored Nov 15, 2023
2 parents c71b12a + 97286b4 commit d5a2841
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ScribbleLab/Core/Componets/Shaders/Shaders.metal
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@
#include <SwiftUI/SwiftUI_Metal.h>
using namespace metal;


// Grayscale shader
[[ stitchable ]] half4 grayscale(float2 position, SwiftUI::Layer layer) {
half4 originalColor = layer.sample(position);
float grayscaleValue = (originalColor.r + originalColor.g + originalColor.b) / 3.0;
return half4(grayscaleValue, grayscaleValue, grayscaleValue, originalColor.a);
}

0 comments on commit d5a2841

Please sign in to comment.