Contents

CIWarpKernel

A GPU-based image-processing routine that processes only the geometry information in an image, used to create custom Core Image filters.

Declaration

class CIWarpKernel

Overview

The kernel language routine for a warp kernel has the following characteristics:

  • It uses exactly one input image.

  • Its return type is vec2 (Core Image Kernel Language) or float2 (Metal Shading Language), specifying a position in source image coordinates.

A warp kernel routine requires no input parameters (but can use additional custom parameters you declare). Typically, a warp kernel uses the destination coordinate function to look up the coordinates of the destination pixel currently being rendered, then computes a corresponding position in source image coordinates (output using the return keyword). Core Image then samples from the source image at the returned coordinates to produce a pixel color for the output image. 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 {
        float2 do_nothing(destination dest) {
            return dest.coord();
        }
    }
}

The equivalent code in Core Image Kernel Language is:

kernel vec2 do_nothing() {
    return destCoord();
}

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.

Topics

Creating a Kernel

Applying a Kernel to Filter an Image

See Also

Custom Filters