A GPU-based image processing routine that is optimized for blending two images.
- iOS 11.0+
- macOS 10.13+
- Mac Catalyst 13.0+
- tvOS 11.0+
- Core Image
The blend kernel function has the following characteristics:
It has two arguments of type
_(Core Image Kernel Language) or
sample(Metal Shading Language), representing the foreground and background images.
Its return type is
vec4(Core Image Kernel Language) or
float4(Metal Shading Language); that is, it returns a pixel color for the output image.
A blend kernel routine receives as input single-pixel colors (one sampled from each input image) and computes a final pixel color (output using the return keyword). For example, the Metal Shading Language source below implements a filter that returns the average of its two input images.
Generally, the extent of the output image is the union of the extents of the foreground and background images.