---
title: CIBlendKernel
framework: coreimage
role: symbol
role_heading: Class
path: coreimage/ciblendkernel
---

# CIBlendKernel

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

## Declaration

```swift
class CIBlendKernel
```

## Overview

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

- [init(source:)](coreimage/ciblendkernel/init(source:).md)

### Applying a Kernel to Filter an Image

- [apply(foreground:background:)](coreimage/ciblendkernel/apply(foreground:background:).md)

### Builtin Blend Kernels

- [clear](coreimage/ciblendkernel/clear.md)
- [color](coreimage/ciblendkernel/color.md)
- [colorBurn](coreimage/ciblendkernel/colorburn.md)
- [colorDodge](coreimage/ciblendkernel/colordodge.md)
- [componentAdd](coreimage/ciblendkernel/componentadd.md)
- [componentMax](coreimage/ciblendkernel/componentmax.md)
- [componentMin](coreimage/ciblendkernel/componentmin.md)
- [componentMultiply](coreimage/ciblendkernel/componentmultiply.md)
- [darken](coreimage/ciblendkernel/darken.md)
- [darkerColor](coreimage/ciblendkernel/darkercolor.md)
- [destination](coreimage/ciblendkernel/destination.md)
- [destinationAtop](coreimage/ciblendkernel/destinationatop.md)
- [destinationIn](coreimage/ciblendkernel/destinationin.md)
- [destinationOut](coreimage/ciblendkernel/destinationout.md)
- [destinationOver](coreimage/ciblendkernel/destinationover.md)
- [difference](coreimage/ciblendkernel/difference.md)
- [divide](coreimage/ciblendkernel/divide.md)
- [exclusion](coreimage/ciblendkernel/exclusion.md)
- [exclusiveOr](coreimage/ciblendkernel/exclusiveor.md)
- [hardLight](coreimage/ciblendkernel/hardlight.md)
- [hardMix](coreimage/ciblendkernel/hardmix.md)
- [hue](coreimage/ciblendkernel/hue.md)
- [lighten](coreimage/ciblendkernel/lighten.md)
- [lighterColor](coreimage/ciblendkernel/lightercolor.md)
- [linearBurn](coreimage/ciblendkernel/linearburn.md)
- [linearDodge](coreimage/ciblendkernel/lineardodge.md)
- [linearLight](coreimage/ciblendkernel/linearlight.md)
- [luminosity](coreimage/ciblendkernel/luminosity.md)
- [multiply](coreimage/ciblendkernel/multiply.md)
- [overlay](coreimage/ciblendkernel/overlay.md)
- [pinLight](coreimage/ciblendkernel/pinlight.md)
- [saturation](coreimage/ciblendkernel/saturation.md)
- [screen](coreimage/ciblendkernel/screen.md)
- [softLight](coreimage/ciblendkernel/softlight.md)
- [source](coreimage/ciblendkernel/source.md)
- [sourceAtop](coreimage/ciblendkernel/sourceatop.md)
- [sourceIn](coreimage/ciblendkernel/sourcein.md)
- [sourceOut](coreimage/ciblendkernel/sourceout.md)
- [sourceOver](coreimage/ciblendkernel/sourceover.md)
- [subtract](coreimage/ciblendkernel/subtract.md)
- [vividLight](coreimage/ciblendkernel/vividlight.md)

### Instance Methods

- [apply(foreground:background:colorSpace:)](coreimage/ciblendkernel/apply(foreground:background:colorspace:).md)

## Relationships

### Inherits From

- [CIColorKernel](coreimage/cicolorkernel.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Custom Filters

- [Writing Custom Kernels](coreimage/writing-custom-kernels.md)
- [CIKernel](coreimage/cikernel.md)
- [CIColorKernel](coreimage/cicolorkernel.md)
- [CIWarpKernel](coreimage/ciwarpkernel.md)
- [CISampler](coreimage/cisampler.md)
- [CIFilterShape](coreimage/cifiltershape.md)
- [CIFormat](coreimage/ciformat.md)
