Skip to content

Commit 3aa21db

Browse files
authored
Merge pull request #42 from Automattic/add/gift
Add gift icon
2 parents 732c50a + 4562686 commit 3aa21db

File tree

4 files changed

+100
-2
lines changed

4 files changed

+100
-2
lines changed

Gridicons.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "Gridicons"
3-
s.version = "0.18"
3+
s.version = "0.19"
44
s.summary = "Gridicons is a tiny framework which generates Gridicon images at any resolution."
55

66
s.homepage = "http://apps.wordpress.com"

Gridicons/Gridicons/Gridicons.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ public enum GridiconType: Int {
116116
case heading
117117
case grid
118118
case globe
119+
case gift
119120
case fullscreenExit
120121
case fullscreen
121122
case folderMultiple
@@ -450,6 +451,8 @@ public final class Gridicon: NSObject {
450451
return GridiconsGenerated.imageOfGridiconsgrid(size: size)
451452
case .globe:
452453
return GridiconsGenerated.imageOfGridiconsglobe(size: size)
454+
case .gift:
455+
return GridiconsGenerated.imageOfGridiconsgift(size: size)
453456
case .fullscreen:
454457
return GridiconsGenerated.imageOfGridiconsfullscreen(size: size)
455458
case .fullscreenExit:

Gridicons/Gridicons/GridiconsGenerated.swift

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12405,6 +12405,90 @@ class GridiconsGenerated: NSObject {
1240512405

1240612406
context.restoreGState()
1240712407
}
12408+
12409+
class func drawGridiconsgift(frame targetFrame: CGRect = CGRect(x: 0, y: 0, width: 20, height: 21), resizing: ResizingBehavior = .aspectFit) {
12410+
/// General Declarations
12411+
let context = UIGraphicsGetCurrentContext()!
12412+
12413+
/// Resize to Target Frame
12414+
context.saveGState()
12415+
let resizedFrame = resizing.apply(rect: CGRect(x: 0, y: 0, width: 20, height: 21), target: targetFrame)
12416+
context.translateBy(x: resizedFrame.minX, y: resizedFrame.minY)
12417+
context.scaleBy(x: resizedFrame.width / 20, y: resizedFrame.height / 21)
12418+
context.translateBy(x: -178, y: -323)
12419+
12420+
/// gridicons-gift
12421+
do {
12422+
context.saveGState()
12423+
context.translateBy(x: 178, y: 323)
12424+
12425+
/// Shape
12426+
let shape = UIBezierPath()
12427+
shape.move(to: CGPoint(x: 20, y: 5))
12428+
shape.addLine(to: CGPoint(x: 15.2, y: 5))
12429+
shape.addCurve(to: CGPoint(x: 16, y: 3), controlPoint1: CGPoint(x: 15.7, y: 4.5), controlPoint2: CGPoint(x: 16, y: 3.8))
12430+
shape.addCurve(to: CGPoint(x: 13, y: 0), controlPoint1: CGPoint(x: 16, y: 1.3), controlPoint2: CGPoint(x: 14.7, y: 0))
12431+
shape.addCurve(to: CGPoint(x: 10, y: 3), controlPoint1: CGPoint(x: 11.3, y: 0), controlPoint2: CGPoint(x: 10, y: 1.3))
12432+
shape.addCurve(to: CGPoint(x: 7, y: 0), controlPoint1: CGPoint(x: 10, y: 1.3), controlPoint2: CGPoint(x: 8.7, y: 0))
12433+
shape.addCurve(to: CGPoint(x: 4, y: 3), controlPoint1: CGPoint(x: 5.3, y: 0), controlPoint2: CGPoint(x: 4, y: 1.3))
12434+
shape.addCurve(to: CGPoint(x: 4.8, y: 5), controlPoint1: CGPoint(x: 4, y: 3.8), controlPoint2: CGPoint(x: 4.3, y: 4.5))
12435+
shape.addLine(to: CGPoint(x: 0, y: 5))
12436+
shape.addLine(to: CGPoint(x: 0, y: 11))
12437+
shape.addLine(to: CGPoint(x: 1, y: 11))
12438+
shape.addLine(to: CGPoint(x: 1, y: 19))
12439+
shape.addCurve(to: CGPoint(x: 3, y: 21), controlPoint1: CGPoint(x: 1, y: 20.1), controlPoint2: CGPoint(x: 1.9, y: 21))
12440+
shape.addLine(to: CGPoint(x: 17, y: 21))
12441+
shape.addCurve(to: CGPoint(x: 19, y: 19), controlPoint1: CGPoint(x: 18.1, y: 21), controlPoint2: CGPoint(x: 19, y: 20.1))
12442+
shape.addLine(to: CGPoint(x: 19, y: 11))
12443+
shape.addLine(to: CGPoint(x: 20, y: 11))
12444+
shape.addLine(to: CGPoint(x: 20, y: 5))
12445+
shape.close()
12446+
shape.move(to: CGPoint(x: 18, y: 9))
12447+
shape.addLine(to: CGPoint(x: 11, y: 9))
12448+
shape.addLine(to: CGPoint(x: 11, y: 7))
12449+
shape.addLine(to: CGPoint(x: 18, y: 7))
12450+
shape.addLine(to: CGPoint(x: 18, y: 9))
12451+
shape.close()
12452+
shape.move(to: CGPoint(x: 14, y: 3))
12453+
shape.addCurve(to: CGPoint(x: 13, y: 2), controlPoint1: CGPoint(x: 14, y: 2.4), controlPoint2: CGPoint(x: 13.6, y: 2))
12454+
shape.addCurve(to: CGPoint(x: 12, y: 3), controlPoint1: CGPoint(x: 12.4, y: 2), controlPoint2: CGPoint(x: 12, y: 2.4))
12455+
shape.addCurve(to: CGPoint(x: 13, y: 4), controlPoint1: CGPoint(x: 12, y: 3.6), controlPoint2: CGPoint(x: 12.4, y: 4))
12456+
shape.addCurve(to: CGPoint(x: 14, y: 3), controlPoint1: CGPoint(x: 13.6, y: 4), controlPoint2: CGPoint(x: 14, y: 3.6))
12457+
shape.close()
12458+
shape.move(to: CGPoint(x: 7, y: 2))
12459+
shape.addCurve(to: CGPoint(x: 8, y: 3), controlPoint1: CGPoint(x: 7.6, y: 2), controlPoint2: CGPoint(x: 8, y: 2.4))
12460+
shape.addCurve(to: CGPoint(x: 7, y: 4), controlPoint1: CGPoint(x: 8, y: 3.6), controlPoint2: CGPoint(x: 7.6, y: 4))
12461+
shape.addCurve(to: CGPoint(x: 6, y: 3), controlPoint1: CGPoint(x: 6.4, y: 4), controlPoint2: CGPoint(x: 6, y: 3.6))
12462+
shape.addCurve(to: CGPoint(x: 7, y: 2), controlPoint1: CGPoint(x: 6, y: 2.4), controlPoint2: CGPoint(x: 6.4, y: 2))
12463+
shape.close()
12464+
shape.move(to: CGPoint(x: 9, y: 7))
12465+
shape.addLine(to: CGPoint(x: 2, y: 7))
12466+
shape.addLine(to: CGPoint(x: 2, y: 9))
12467+
shape.addLine(to: CGPoint(x: 9, y: 9))
12468+
shape.addLine(to: CGPoint(x: 9, y: 7))
12469+
shape.close()
12470+
shape.move(to: CGPoint(x: 9, y: 11))
12471+
shape.addLine(to: CGPoint(x: 9, y: 19))
12472+
shape.addLine(to: CGPoint(x: 3, y: 19))
12473+
shape.addLine(to: CGPoint(x: 3, y: 11))
12474+
shape.addLine(to: CGPoint(x: 9, y: 11))
12475+
shape.close()
12476+
shape.move(to: CGPoint(x: 11, y: 11))
12477+
shape.addLine(to: CGPoint(x: 11, y: 19))
12478+
shape.addLine(to: CGPoint(x: 17, y: 19))
12479+
shape.addLine(to: CGPoint(x: 17, y: 11))
12480+
shape.addLine(to: CGPoint(x: 11, y: 11))
12481+
shape.close()
12482+
12483+
context.saveGState()
12484+
shape.usesEvenOddFillRule = true
12485+
UIColor.black.setFill()
12486+
shape.fill()
12487+
context.restoreGState()
12488+
}
12489+
12490+
context.restoreGState()
12491+
}
1240812492

1240912493

1241012494
//MARK: - Canvas Images
@@ -14423,6 +14507,17 @@ class GridiconsGenerated: NSObject {
1442314507

1442414508
return image
1442514509
}
14510+
14511+
class func imageOfGridiconsgift(size: CGSize) -> UIImage {
14512+
var image: UIImage
14513+
14514+
UIGraphicsBeginImageContextWithOptions(size, false, 0)
14515+
GridiconsGenerated.drawGridiconsgift(frame: CGRect(origin: CGPoint.zero, size: size))
14516+
image = UIGraphicsGetImageFromCurrentImageContext()!
14517+
UIGraphicsEndImageContext()
14518+
14519+
return image
14520+
}
1442614521

1442714522
//MARK: - Resizing Behavior
1442814523

Gridicons/Gridicons/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.18</string>
18+
<string>0.19</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

0 commit comments

Comments
 (0)