Skip to content

Commit

Permalink
Updated to Swift 1.2. Translated to English. Added new license GPL v3.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Butron committed Apr 12, 2015
1 parent ca06918 commit 845b38c
Show file tree
Hide file tree
Showing 30 changed files with 448 additions and 195 deletions.
Binary file not shown.
10 changes: 6 additions & 4 deletions CoreImage/CoreImage.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
075FD4A61A34D3BA00513A3A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 075FD4A51A34D3BA00513A3A /* Images.xcassets */; };
075FD4A91A34D3BA00513A3A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 075FD4A71A34D3BA00513A3A /* LaunchScreen.xib */; };
075FD4B51A34D3BB00513A3A /* CoreImageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 075FD4B41A34D3BB00513A3A /* CoreImageTests.swift */; };
075FD4BF1A34D3EE00513A3A /* imagen.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 075FD4BE1A34D3EE00513A3A /* imagen.jpg */; };
075FD4BF1A34D3EE00513A3A /* image.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 075FD4BE1A34D3EE00513A3A /* image.jpg */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand All @@ -37,7 +37,7 @@
075FD4AE1A34D3BB00513A3A /* CoreImageTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CoreImageTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
075FD4B31A34D3BB00513A3A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
075FD4B41A34D3BB00513A3A /* CoreImageTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreImageTests.swift; sourceTree = "<group>"; };
075FD4BE1A34D3EE00513A3A /* imagen.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = imagen.jpg; sourceTree = "<group>"; };
075FD4BE1A34D3EE00513A3A /* image.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = image.jpg; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -79,7 +79,7 @@
075FD49B1A34D3BA00513A3A /* CoreImage */ = {
isa = PBXGroup;
children = (
075FD4BE1A34D3EE00513A3A /* imagen.jpg */,
075FD4BE1A34D3EE00513A3A /* image.jpg */,
075FD49E1A34D3BA00513A3A /* AppDelegate.swift */,
075FD4A01A34D3BA00513A3A /* ViewController.swift */,
075FD4A21A34D3BA00513A3A /* Main.storyboard */,
Expand Down Expand Up @@ -197,7 +197,7 @@
files = (
075FD4A41A34D3BA00513A3A /* Main.storyboard in Resources */,
075FD4A91A34D3BA00513A3A /* LaunchScreen.xib in Resources */,
075FD4BF1A34D3EE00513A3A /* imagen.jpg in Resources */,
075FD4BF1A34D3EE00513A3A /* image.jpg in Resources */,
075FD4A61A34D3BA00513A3A /* Images.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -409,6 +409,7 @@
075FD4BA1A34D3BB00513A3A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
075FD4BB1A34D3BB00513A3A /* Build configuration list for PBXNativeTarget "CoreImageTests" */ = {
isa = XCConfigurationList;
Expand All @@ -417,6 +418,7 @@
075FD4BD1A34D3BB00513A3A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDESourceControlProjectFavoriteDictionaryKey</key>
<false/>
<key>IDESourceControlProjectIdentifier</key>
<string>0782C0DF-963A-4E25-AC74-B052EAEB55EC</string>
<key>IDESourceControlProjectName</key>
<string>CoreImage</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>9FCBC930A8DBEE5E1E1094396CDFC4C7EE814530</key>
<string>https://github.com/CarlosButron/Swift.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>CoreImage/CoreImage.xcodeproj</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>9FCBC930A8DBEE5E1E1094396CDFC4C7EE814530</key>
<string>../../..</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>https://github.com/CarlosButron/Swift.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>111</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>9FCBC930A8DBEE5E1E1094396CDFC4C7EE814530</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>9FCBC930A8DBEE5E1E1094396CDFC4C7EE814530</string>
<key>IDESourceControlWCCName</key>
<string>Swift</string>
</dict>
</array>
</dict>
</plist>
Binary file not shown.
10 changes: 9 additions & 1 deletion CoreImage/CoreImage/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
// CoreImage
//
// Created by Carlos Butron on 07/12/14.
// Copyright (c) 2014 Carlos Butron. All rights reserved.
// Copyright (c) 2015 Carlos Butron. All rights reserved.
//
// This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
// version.
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along with this program. If not, see
// http:/www.gnu.org/licenses/.
//

import UIKit
Expand Down
10 changes: 5 additions & 5 deletions CoreImage/CoreImage/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6250" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="ql8-4A-IBN">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6250" systemVersion="14D131" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="ql8-4A-IBN">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="Fgx-QL-x9l">
<objects>
<viewController id="ql8-4A-IBN" customClass="ViewController" customModule="T6E1CarlosButron" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="ql8-4A-IBN" customClass="ViewController" customModule="CoreImage" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="3ub-Uj-99o"/>
<viewControllerLayoutGuide type="bottom" id="k8I-on-9ET"/>
Expand Down Expand Up @@ -76,14 +76,14 @@
<action selector="slider:" destination="ql8-4A-IBN" eventType="valueChanged" id="Zgq-Rx-RUh"/>
</connections>
</slider>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="imagen.jpg" translatesAutoresizingMaskIntoConstraints="NO" id="DqV-Rk-JZg">
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="image.jpg" translatesAutoresizingMaskIntoConstraints="NO" id="DqV-Rk-JZg">
<rect key="frame" x="0.0" y="42" width="320" height="320"/>
</imageView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
<connections>
<outlet property="imagen" destination="DqV-Rk-JZg" id="1fM-HG-v6x"/>
<outlet property="myImage" destination="DqV-Rk-JZg" id="6qI-4z-H8c"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="RdA-s1-dew" sceneMemberID="firstResponder"/>
Expand All @@ -92,7 +92,7 @@
</scene>
</scenes>
<resources>
<image name="imagen.jpg" width="640" height="480"/>
<image name="image.jpg" width="640" height="480"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
Expand Down
75 changes: 41 additions & 34 deletions CoreImage/CoreImage/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
// CoreImage
//
// Created by Carlos Butron on 07/12/14.
// Copyright (c) 2014 Carlos Butron. All rights reserved.
// Copyright (c) 2015 Carlos Butron. All rights reserved.
//
// This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
// version.
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along with this program. If not, see
// http:/www.gnu.org/licenses/.
//

import UIKit
Expand All @@ -13,13 +21,13 @@ import CoreImage
class ViewController: UIViewController {


//SLIDER APLICADA A LOS DOS PRIMEROS FILTROS
//el funcionamiento es el siguiente: al cambiar el slider cambia el valor
//una vez cambiado hay que volver a pulsar sobre el botón del filtro "sepia" o "vignette" para que se aplique
//SLIDER TO FIRST AND SECOND FILTER
//when you do slider value change
//then push in filter button "sepia" or "vignette" to apply it

var sliderValue: Float = 0.0

@IBOutlet weak var imagen: UIImageView!
@IBOutlet weak var myImage: UIImageView!

@IBAction func sepia(sender: UIButton) {
applyfilter(1);
Expand Down Expand Up @@ -66,54 +74,53 @@ class ViewController: UIViewController {

func applyfilter(numberFilter: Int) {

let filePath : NSString = NSBundle.mainBundle().pathForResource("imagen", ofType: "jpg")!
let filePath : NSString = NSBundle.mainBundle().pathForResource("image", ofType: "jpg")!
let fileUrl : NSURL = NSURL (fileURLWithPath: filePath)!
let inputImage : CIImage = CIImage (contentsOfURL: fileUrl)

switch numberFilter {
case 1:
var filtro : CIFilter = CIFilter (name: "CISepiaTone")
filtro.setValue(inputImage, forKey: kCIInputImageKey)
//filtro.setValue(1.0, forKey: "InputIntensity")
filtro.setValue(sliderValue, forKey: "InputIntensity")
let outputImage : CIImage = filtro.valueForKey(kCIOutputImageKey) as CIImage
var filter : CIFilter = CIFilter (name: "CISepiaTone")
filter.setValue(inputImage, forKey: kCIInputImageKey)
filter.setValue(sliderValue, forKey: "InputIntensity")
let outputImage : CIImage = filter.valueForKey(kCIOutputImageKey) as CIImage
var img : UIImage = UIImage (CIImage: outputImage)!
imagen.image = img
myImage.image = img
case 2:
var filtro : CIFilter = CIFilter (name: "CIVignette")
filtro.setValue(inputImage, forKey: kCIInputImageKey)
filtro.setValue(sliderValue, forKey: "InputRadius")
filtro.setValue(sliderValue, forKey: "InputIntensity")
let outputImage : CIImage = filtro.valueForKey(kCIOutputImageKey) as CIImage
var filter : CIFilter = CIFilter (name: "CIVignette")
filter.setValue(inputImage, forKey: kCIInputImageKey)
filter.setValue(sliderValue, forKey: "InputRadius")
filter.setValue(sliderValue, forKey: "InputIntensity")
let outputImage : CIImage = filter.valueForKey(kCIOutputImageKey) as CIImage
var img : UIImage = UIImage (CIImage: outputImage)!
imagen.image = img
myImage.image = img
case 3:
var filtro : CIFilter = CIFilter (name: "CIColorInvert")
filtro.setValue(inputImage, forKey: kCIInputImageKey)
let outputImage : CIImage = filtro.valueForKey(kCIOutputImageKey) as CIImage
var filter : CIFilter = CIFilter (name: "CIColorInvert")
filter.setValue(inputImage, forKey: kCIInputImageKey)
let outputImage : CIImage = filter.valueForKey(kCIOutputImageKey) as CIImage
var img : UIImage = UIImage (CIImage: outputImage)!
imagen.image = img
myImage.image = img
case 4:
var filtro : CIFilter = CIFilter (name: "CIPhotoEffectMono")
filtro.setValue(inputImage, forKey: kCIInputImageKey)
var filter : CIFilter = CIFilter (name: "CIPhotoEffectMono")
filter.setValue(inputImage, forKey: kCIInputImageKey)

let outputImage : CIImage = filtro.valueForKey(kCIOutputImageKey) as CIImage
let outputImage : CIImage = filter.valueForKey(kCIOutputImageKey) as CIImage
var img : UIImage = UIImage (CIImage: outputImage)!
imagen.image = img
myImage.image = img
case 5:
var filtro : CIFilter = CIFilter (name: "CIPerspectiveTransform")
filtro.setValue(inputImage, forKey: kCIInputImageKey)
var filter : CIFilter = CIFilter (name: "CIPerspectiveTransform")
filter.setValue(inputImage, forKey: kCIInputImageKey)

let outputImage : CIImage = filtro.valueForKey(kCIOutputImageKey) as CIImage
let outputImage : CIImage = filter.valueForKey(kCIOutputImageKey) as CIImage
var img : UIImage = UIImage (CIImage: outputImage)!
imagen.image = img
myImage.image = img
case 6:
var filtro : CIFilter = CIFilter (name: "CIGaussianBlur")
filtro.setValue(inputImage, forKey: kCIInputImageKey)
var filter : CIFilter = CIFilter (name: "CIGaussianBlur")
filter.setValue(inputImage, forKey: kCIInputImageKey)

let outputImage : CIImage = filtro.valueForKey(kCIOutputImageKey) as CIImage
let outputImage : CIImage = filter.valueForKey(kCIOutputImageKey) as CIImage
var img : UIImage = UIImage (CIImage: outputImage)!
imagen.image = img
myImage.image = img
default:
println("test")

Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDESourceControlProjectFavoriteDictionaryKey</key>
<false/>
<key>IDESourceControlProjectIdentifier</key>
<string>A15A31D0-7CEC-4B9F-95C3-52B2F7BC5EEA</string>
<key>IDESourceControlProjectName</key>
<string>CoreImageCIDetector</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>9FCBC930A8DBEE5E1E1094396CDFC4C7EE814530</key>
<string>https://github.com/CarlosButron/Swift.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>CoreImageCIDetector/CoreImageCIDetector.xcodeproj</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>9FCBC930A8DBEE5E1E1094396CDFC4C7EE814530</key>
<string>../../..</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>https://github.com/CarlosButron/Swift.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>111</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>9FCBC930A8DBEE5E1E1094396CDFC4C7EE814530</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>9FCBC930A8DBEE5E1E1094396CDFC4C7EE814530</string>
<key>IDESourceControlWCCName</key>
<string>Swift</string>
</dict>
</array>
</dict>
</plist>
Binary file not shown.
10 changes: 9 additions & 1 deletion CoreImageCIDetector/CoreImageCIDetector/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
// CoreImageCIDetector
//
// Created by Carlos Butron on 07/12/14.
// Copyright (c) 2014 Carlos Butron. All rights reserved.
// Copyright (c) 2015 Carlos Butron. All rights reserved.
//
// This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
// version.
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along with this program. If not, see
// http:/www.gnu.org/licenses/.
//

import UIKit
Expand Down
Loading

0 comments on commit 845b38c

Please sign in to comment.