Welcome to PixelFlux
PixelFlux is a modern Swift framework for GPU-accelerated image processing on iOS. Leveraging Apple's Metal framework, PixelFlux provides blazing-fast image filtering and effects with minimal CPU overhead.
What is PixelFlux?
PixelFlux is a lightweight image processing framework that harnesses the power of GPU compute shaders to perform image transformations efficiently. Instead of processing pixels on the CPU, PixelFlux offloads the heavy lifting to the GPU, resulting in:
- Exceptional Performance: GPU compute shaders process thousands of pixels in parallel
- Low Power Consumption: Specialized GPU hardware is more efficient than CPU for image operations
- Beautiful API: Simple, Swift-native interface for applying filters
- Extensible Architecture: Build custom filters by implementing the Filter protocol
Key Features
🚀 GPU-Accelerated
Uses Metal compute shaders for parallel pixel processing, delivering exceptional performance.
⚙️ Easy to Use
Simple, intuitive Swift API makes it easy to apply filters to any UIImage.
🔧 Extensible
Implement the Filter protocol to create custom image processing pipelines.
📦 Well-Tested
Comprehensive unit tests ensure reliability across different iOS devices and simulators.
🛡️ Type-Safe
Leverages Swift's type system for compile-time safety and runtime error handling.
🔌 SwiftPM Ready
Distributed as a Swift Package for easy integration into your projects.
Quick Start
Get up and running with PixelFlux in just a few lines of code:
Swift Example
import PixelFlux
import UIKit
// Create an image
let image = UIImage(named: "example")!
// Apply a brightness filter
let filter = try BrightnessFilter(brightness: 0.3)
let result = try filter.apply(to: image)
// Use the result
imageView.image = result
Available Filters
PixelFlux comes with built-in filters for common image processing tasks:
- BrightnessFilter: Adjust image brightness with smooth, real-time control
- PassthroughFilter: Verify GPU pipeline functionality with identity transformation
Build Custom Filters
The framework is designed to be extensible. Implement the Filter protocol to create your own GPU-accelerated filters:
Custom Filter Example
public protocol Filter {
func process(_ input: MTLTexture) throws -> MTLTexture
}
// Implement your custom filter
public class CustomFilter: Filter {
func process(_ input: MTLTexture) throws -> MTLTexture {
// Your Metal compute implementation here
let output = makeEmptyTexture(matching: input)
// Encode GPU commands...
return output
}
}
Requirements
- iOS 16.0 or later
- Swift 5.9 or later
- Xcode 14.0 or later
- A device or simulator with Metal support
Next Steps
Ready to get started? Check out the Getting Started guide for installation instructions and detailed examples. For API details, see the API Reference. To understand how PixelFlux works internally, read the Architecture documentation.