     }
 }
 
+public enum WrappingMode {
+    
+    case none
+    case clamp
+    case `repeat`
+    case mirror
+}
+
+extension WrappingMode {
+    
+    @_inlineable
+    public static var `default` : WrappingMode {
+        return .none
+    }
+}
+
 public struct Texture<Pixel: ColorPixelProtocol> {
     
     public let width: Int

    @inline(__always)
    func read_source(_ x: Int, _ y: Int) -> ColorPixel<Pixel.Model> {
        
        let x_range = 0..<width
        let y_range = 0..<height
        
        if x_range ~= x && y_range ~= y {
            return ColorPixel(pixels[y * width + x])
        }
        
        let _x = x.clamped(to: x_range)
        let _y = y.clamped(to: y_range)
        
        return ColorPixel(color: pixels[_y * width + _x].color, opacity: 0)
    }
    
    @_versioned

    @_inlineable
    public func pixel(_ point: Point) -> ColorPixel<Pixel.Model> {
        
        switch resamplingAlgorithm {
        case .none: return read_source(Int(point.x), Int(point.y))
        case .linear: return sampling2(point: point, sampler: LinearInterpolate)
        case .cosine: return sampling2(point: point, sampler: CosineInterpolate)
