Contents

CIBlendKernel

A GPU-based image-processing routine that is optimized for blending two images.

Declaration

class CIBlendKernel

Overview

The blend kernel function has the following characteristics:

  • It has two arguments of type __sample (Core Image Kernel Language) or sample_t (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.

#include <CoreImage/CoreImage.h>
 
float4 averageBlend(sample_t foreground, sample_t background) {
    return (foreground + background) / 2.0;
}

Generally, the extent of the output image is the union of the extents of the foreground and background images.

Topics

Creating a Kernel

Applying a Kernel to Filter an Image

Builtin Blend Kernels

Instance Methods

See Also

Custom Filters