CIColorKernel
A GPU-based image-processing routine that processes only the color information in images, used to create custom Core Image filters.
Declaration
class CIColorKernelOverview
The kernel language routine for a color kernel has the following characteristics:
Its return type is
vec4(Core Image Kernel Language) orfloat4(Metal Shading Language); that is, it returns a pixel color for the output image.It may use zero or more input images. Each input image is represented by a parameter of type
__sample(Core Image Kernel Language) orsample_t(Metal Shading Language), which can be treated as a single pixel color of typevec4(Core Image Kernel Language) orfloat4(Metal Shading Language);.
A color 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 passes through its input image unchanged.
#include <CoreImage/CoreImage.h>
extern "C" {
namespace coreimage {
float4 do_nothing(sample_t s) {
return s;
}
}
}The equivalent code in Core Image Kernel Language is:
kernel vec4 do_nothing(__sample s) {
return s.rgba;
}The Core Image Kernel Language is a dialect of the OpenGL Shading Language. See Core Image Kernel Language Reference and Core Image Programming Guide for more details.