Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
BradLarson committed Apr 16, 2016
0 parents commit 2257aff
Show file tree
Hide file tree
Showing 487 changed files with 24,039 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .gitignore
@@ -0,0 +1,25 @@
# Exclude the build directory
build/*
examples/FilterShowcase/build*

# Exclude temp nibs and swap files
*~.nib
*.swp

# Exclude OS X folder attributes
.DS_Store
.svn

# Exclude user-specific XCode 3 and 4 files
*.mode1
*.mode1v3
*.mode2v3
*.perspective
*.perspectivev3
*.pbxuser
*.xcworkspace
xcuserdata

# Documentation
documentation/*

9 changes: 9 additions & 0 deletions License.txt
@@ -0,0 +1,9 @@
Copyright (c) 2015, Brad Larson.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the GPUImage framework nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
480 changes: 480 additions & 0 deletions README.md

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions examples/Linux-OpenGL/SimpleVideoFilter/Source/main.swift
@@ -0,0 +1,10 @@
import GPUImage

let camera = V4LCamera(size:Size(width:1280.0, height:720.0))
let renderWindow = GLUTRenderWindow(width:1280, height:720, title:"Simple Video Filter")
let edgeDetection = SobelEdgeDetection()

camera --> edgeDetection --> renderWindow

camera.startCapture()
renderWindow.loopWithFunction(camera.grabFrame)
1 change: 1 addition & 0 deletions examples/Linux-OpenGL/SimpleVideoFilter/compile.sh
@@ -0,0 +1 @@
swiftc Source/main.swift -o SimpleVideoFilter -I ../../../framework -L ../../../framework -lGPUImage
14 changes: 14 additions & 0 deletions examples/Linux-RPi/SimpleVideoFilter/Source/main.swift
@@ -0,0 +1,14 @@
import GPUImage

let camera = V4LCamera(size:Size(width:1280.0, height:720.0))
let renderWindow = RPiRenderWindow(width:1280, height:720)
let edgeDetection = SobelEdgeDetection()

camera --> edgeDetection --> renderWindow

var terminate:Int = 0

camera.startCapture()
while (terminate == 0) {
camera.grabFrame()
}
1 change: 1 addition & 0 deletions examples/Linux-RPi/SimpleVideoFilter/compile.sh
@@ -0,0 +1 @@
swiftc Source/main.swift -o SimpleVideoFilter -I ../../../framework -L ../../../framework -lGPUImage
423 changes: 423 additions & 0 deletions examples/Mac/FilterShowcase/FilterShowcase.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions examples/Mac/FilterShowcase/FilterShowcase/AppDelegate.swift
@@ -0,0 +1,15 @@
import Cocoa

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {

@IBOutlet weak var window: NSWindow!

var windowController:FilterShowcaseWindowController?

func applicationDidFinishLaunching(aNotification: NSNotification) {
self.windowController = FilterShowcaseWindowController(windowNibName:"FilterShowcaseWindowController")
self.windowController?.showWindow(self)
}
}

667 changes: 667 additions & 0 deletions examples/Mac/FilterShowcase/FilterShowcase/Base.lproj/MainMenu.xib

Large diffs are not rendered by default.

@@ -0,0 +1,60 @@
import Foundation
import GPUImage

enum FilterSliderSetting {
case Disabled
case Enabled(minimumValue:Float, maximumValue:Float, initialValue:Float)
}

typealias FilterSetupFunction = (camera:Camera, filter:ImageProcessingOperation, outputView:RenderView) -> ImageSource?

enum FilterOperationType {
case SingleInput
case Blend
case Custom(filterSetupFunction:FilterSetupFunction)
}

protocol FilterOperationInterface {
var filter: ImageProcessingOperation { get }
var secondInput:ImageSource? { get }
var listName: String { get }
var titleName: String { get }
var sliderConfiguration: FilterSliderSetting { get }
var filterOperationType: FilterOperationType { get }

func configureCustomFilter(secondInput:ImageSource?)
func updateBasedOnSliderValue(sliderValue:Float)
}

class FilterOperation<FilterClass: ImageProcessingOperation>: FilterOperationInterface {
lazy var internalFilter:FilterClass = {
return self.filterCreationFunction()
}()
let filterCreationFunction:() -> FilterClass
var secondInput:ImageSource?
let listName:String
let titleName:String
let sliderConfiguration:FilterSliderSetting
let filterOperationType:FilterOperationType
let sliderUpdateCallback: ((filter:FilterClass, sliderValue:Float) -> ())?
init(filter:() -> FilterClass, listName: String, titleName: String, sliderConfiguration: FilterSliderSetting, sliderUpdateCallback:((filter:FilterClass, sliderValue:Float) -> ())?, filterOperationType: FilterOperationType) {
self.listName = listName
self.titleName = titleName
self.sliderConfiguration = sliderConfiguration
self.filterOperationType = filterOperationType
self.sliderUpdateCallback = sliderUpdateCallback
self.filterCreationFunction = filter
}

var filter: ImageProcessingOperation {
return internalFilter
}

func configureCustomFilter(secondInput:ImageSource?) {
self.secondInput = secondInput
}

func updateBasedOnSliderValue(sliderValue:Float) {
sliderUpdateCallback?(filter:internalFilter, sliderValue:sliderValue)
}
}

0 comments on commit 2257aff

Please sign in to comment.