Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
e8a18f99
Commit
e8a18f99
authored
Jul 19, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed files that should have been deleted by xcode
parent
aee72822
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
0 additions
and
353 deletions
+0
-353
Sources/iOS/AnimateKeyframe.swift
+0
-69
Sources/iOS/Material+UIImage+FilterBlur.swift
+0
-155
Sources/iOS/Material+UIImage+Resize.swift
+0
-70
Sources/iOS/Material+UIImage+TintColor.swift
+0
-59
No files found.
Sources/iOS/AnimateKeyframe.swift
deleted
100644 → 0
View file @
aee72822
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* 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 CosmicMind 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.
*/
import
UIKit
public
typealias
AnimateRotationModeType
=
String
public
enum
AnimateRotationMode
{
case
None
case
Auto
case
AutoReverse
}
/**
:name: AnimateRotationModeToValue
*/
public
func
AnimateRotationModeToValue
(
mode
:
AnimateRotationMode
)
->
AnimateRotationModeType
?
{
switch
mode
{
case
.
none
:
return
nil
case
.
Auto
:
return
kCAAnimationRotateAuto
case
.
AutoReverse
:
return
kCAAnimationRotateAutoReverse
}
}
public
extension
Animate
{
/**
:name: path
*/
public
static
func
path
(
bezierPath
:
UIBezierPath
,
mode
:
AnimateRotationMode
=
.
Auto
,
duration
:
CFTimeInterval
?
=
nil
)
->
CAKeyframeAnimation
{
let
animation
:
CAKeyframeAnimation
=
CAKeyframeAnimation
()
animation
.
keyPath
=
"position"
animation
.
path
=
bezierPath
.
CGPath
animation
.
rotationMode
=
AnimateRotationModeToValue
(
mode
)
if
let
v
:
CFTimeInterval
=
duration
{
animation
.
duration
=
v
}
return
animation
}
}
Sources/iOS/Material+UIImage+FilterBlur.swift
deleted
100644 → 0
View file @
aee72822
///*
//* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
//* 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 CosmicMind 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.
//*/
//
//import UIKit
//import Accelerate
//
///// Creates an effect buffer for images that are already effected.
//private func createEffectBuffer(context: CGContext) -> vImage_Buffer {
// let data = CGBitmapContextGetData(context)
// let width = vImagePixelCount(CGBitmapContextGetWidth(context))
// let height = vImagePixelCount(CGBitmapContextGetHeight(context))
// let rowBytes = CGBitmapContextGetBytesPerRow(context)
// return vImage_Buffer(data: data, height: height, width: width, rowBytes: rowBytes)
//}
//
//public extension UIImage {
// /**
// Applies a blur effect to a UIImage.
// - Parameter blurRadius: The radius of the blur effect.
// - Parameter tintColor: The color used for the blur effect (optional).
// - Parameter saturationDeltaFactor: The delta factor for the saturation of the blur effect.
// - Returns: a UIImage.
// */
// func filterBlur(blurRadius: CGFloat = 0, tintColor: UIColor? = nil, saturationDeltaFactor: CGFloat = 0) -> UIImage? {
// var effectImage: UIImage = self
//
// let screenScale: CGFloat = Device.scale
// let imageRect: CGRect = CGRect(origin: CGPoint.zero, size: size)
// let hasBlur: Bool = blurRadius > CGFloat(FLT_EPSILON)
// let hasSaturationChange: Bool = fabs(saturationDeltaFactor - 1.0) > CGFloat(FLT_EPSILON)
//
// if hasBlur || hasSaturationChange {
// UIGraphicsBeginImageContextWithOptions(size, false, screenScale)
// let effectInContext: CGContext = UIGraphicsGetCurrentContext()!
// CGContextScaleCTM(effectInContext, 1.0, -1.0)
// CGContextTranslateCTM(effectInContext, 0, -size.height)
// CGContextDrawImage(effectInContext, imageRect, self.cgImage)
// var effectInBuffer: vImage_Buffer = createEffectBuffer(effectInContext)
//
// UIGraphicsBeginImageContextWithOptions(size, false, screenScale)
// let effectOutContext: CGContext = UIGraphicsGetCurrentContext()!
// var effectOutBuffer: vImage_Buffer = createEffectBuffer(effectOutContext)
//
// if hasBlur {
// let inputRadius: CGFloat = blurRadius * screenScale
// var radius: UInt32 = UInt32(floor(inputRadius * 3.0 * CGFloat(sqrt(2 * M_PI)) / 4 + 0.5))
// if 1 != radius % 2 {
// radius += 1 // force radius to be odd so that the three box-blur methodology works.
// }
//
// let imageEdgeExtendFlags: UInt32 = vImage_Flags(kvImageEdgeExtend)
//
// vImageBoxConvolve_ARGB8888(&effectInBuffer, &effectOutBuffer, nil, 0, 0, radius, radius, nil, imageEdgeExtendFlags)
// vImageBoxConvolve_ARGB8888(&effectOutBuffer, &effectInBuffer, nil, 0, 0, radius, radius, nil, imageEdgeExtendFlags)
// vImageBoxConvolve_ARGB8888(&effectInBuffer, &effectOutBuffer, nil, 0, 0, radius, radius, nil, imageEdgeExtendFlags)
// }
//
// var effectImageBuffersAreSwapped: Bool = false
//
// if hasSaturationChange {
// let s: CGFloat = saturationDeltaFactor
// let floatingPointSaturationMatrix: Array<CGFloat> = [
// 0.0722 + 0.9278 * s, 0.0722 - 0.0722 * s, 0.0722 - 0.0722 * s, 0,
// 0.7152 - 0.7152 * s, 0.7152 + 0.2848 * s, 0.7152 - 0.7152 * s, 0,
// 0.2126 - 0.2126 * s, 0.2126 - 0.2126 * s, 0.2126 + 0.7873 * s, 0,
// 0, 0, 0, 1
// ]
//
// let divisor: CGFloat = 256
// let matrixSize: Int = floatingPointSaturationMatrix.count
// var saturationMatrix: Array<Int16> = Array<Int16>(count: matrixSize, repeatedValue: 0)
//
// for i: Int in 0 ..< matrixSize {
// saturationMatrix[i] = Int16(round(floatingPointSaturationMatrix[i] * divisor))
// }
//
// if hasBlur {
// vImageMatrixMultiply_ARGB8888(&effectOutBuffer, &effectInBuffer, saturationMatrix, Int32(divisor), nil, nil, vImage_Flags(kvImageNoFlags))
// effectImageBuffersAreSwapped = true
// } else {
// vImageMatrixMultiply_ARGB8888(&effectInBuffer, &effectOutBuffer, saturationMatrix, Int32(divisor), nil, nil, vImage_Flags(kvImageNoFlags))
// }
// }
//
// if !effectImageBuffersAreSwapped {
// effectImage = UIGraphicsGetImageFromCurrentImageContext()
// }
//
// UIGraphicsEndImageContext()
//
// if effectImageBuffersAreSwapped {
// effectImage = UIGraphicsGetImageFromCurrentImageContext()
// }
//
// UIGraphicsEndImageContext()
// }
//
// // Set up output context.
// UIGraphicsBeginImageContextWithOptions(size, false, screenScale)
// let outputContext: CGContext = UIGraphicsGetCurrentContext()!
// CGContextScaleCTM(outputContext, 1.0, -1.0)
// CGContextTranslateCTM(outputContext, 0, -size.height)
//
// // Draw base image.
// CGContextDrawImage(outputContext, imageRect, self.cgImage)
//
// // Draw effect image.
// if hasBlur {
// CGContextSaveGState(outputContext)
// CGContextDrawImage(outputContext, imageRect, effectImage.cgImage)
// CGContextRestoreGState(outputContext)
// }
//
// // Add in color tint.
// if let v: UIColor = tintColor {
// CGContextSaveGState(outputContext)
// CGContextSetFillColorWithColor(outputContext, v.cgColor)
// CGContextFillRect(outputContext, imageRect)
// CGContextRestoreGState(outputContext)
// }
//
// // Output image is ready.
// let outputImage: UIImage = UIGraphicsGetImageFromCurrentImageContext()
// UIGraphicsEndImageContext()
//
// return outputImage
// }
//}
Sources/iOS/Material+UIImage+Resize.swift
deleted
100644 → 0
View file @
aee72822
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* 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 CosmicMind 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.
*/
import
UIKit
public
extension
UIImage
{
/**
:name: internalResize
*/
private
func
internalResize
(
toWidth
tw
:
CGFloat
=
0
,
toHeight
th
:
CGFloat
=
0
)
->
UIImage
?
{
var
w
:
CGFloat
?
var
h
:
CGFloat
?
if
0
<
tw
{
h
=
height
*
tw
/
width
}
else
if
0
<
th
{
w
=
width
*
th
/
height
}
let
g
:
UIImage
?
let
t
:
CGRect
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
w
??
tw
,
height
:
h
??
th
)
UIGraphicsBeginImageContextWithOptions
(
t
.
size
,
false
,
Device
.
scale
)
draw
(
in
:
t
,
blendMode
:
.
normal
,
alpha
:
1
)
g
=
UIGraphicsGetImageFromCurrentImageContext
()
UIGraphicsEndImageContext
()
return
g
}
/**
:name: resize
*/
public
func
resize
(
toWidth
w
:
CGFloat
)
->
UIImage
?
{
return
internalResize
(
toWidth
:
w
)
}
/**
:name: resize
*/
public
func
resize
(
toHeight
h
:
CGFloat
)
->
UIImage
?
{
return
internalResize
(
toHeight
:
h
)
}
}
Sources/iOS/Material+UIImage+TintColor.swift
deleted
100644 → 0
View file @
aee72822
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* 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 CosmicMind 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.
*/
import
UIKit
public
extension
UIImage
{
/**
Creates a new image with the passed in color.
- Parameter color: The UIColor to create the image from.
- Returns: A UIImage that is the color passed in.
*/
public
func
tintWithColor
(
color
:
UIColor
)
->
UIImage
?
{
UIGraphicsBeginImageContextWithOptions
(
size
,
false
,
Device
.
scale
)
guard
let
context
=
UIGraphicsGetCurrentContext
()
else
{
return
nil
}
context
.
scale
(
x
:
1.0
,
y
:
-
1.0
)
context
.
translate
(
x
:
0.0
,
y
:
-
size
.
height
)
context
.
setBlendMode
(
.
multiply
)
let
rect
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
size
.
width
,
height
:
size
.
height
)
context
.
clipToMask
(
rect
,
mask
:
cgImage
!
)
color
.
setFill
()
context
.
fill
(
rect
)
let
image
:
UIImage
=
UIGraphicsGetImageFromCurrentImageContext
()
!
UIGraphicsEndImageContext
()
return
image
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment