<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIWarpKernel",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Core Image"
    ],
    "preciseIdentifier" : "c:objc(cs)CIWarpKernel"
  },
  "title" : "CIWarpKernel"
}
-->

# CIWarpKernel

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

```
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.

```c
#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:

```c
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](https://developer.apple.com/library/archive/documentation/GraphicsImaging/Reference/CIKernelLangRef/Introduction/Introduction.html#//apple_ref/doc/uid/TP40004397) and [Core Image Programming Guide](https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/CoreImaging/ci_intro/ci_intro.html#//apple_ref/doc/uid/TP30001185) for more details.

## Topics

### Creating a Kernel

[`init(source:)`](/documentation/CoreImage/CIWarpKernel/init(source:))

Creates a warp kernel object from the specified kernel source code.

### Applying a Kernel to Filter an Image

[`apply(extent:roiCallback:image:arguments:)`](/documentation/CoreImage/CIWarpKernel/apply(extent:roiCallback:image:arguments:))

Creates a new image using the kernel and the specified input image and arguments.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)