Skip to content

Commit 99cb141

Browse files
authored
Merge pull request #28 from Automattic/add/plans-icon
Add Plans icon
2 parents 5cf95c1 + 26c85ca commit 99cb141

File tree

2 files changed

+69
-1
lines changed

2 files changed

+69
-1
lines changed

Gridicons/Gridicons/Gridicons.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public enum GridiconType: Int {
5959
case plus
6060
case plugins
6161
case play
62+
case plans
6263
case phone
6364
case pencil
6465
case pause
@@ -332,6 +333,8 @@ public final class Gridicon: NSObject {
332333
return GridiconsGenerated.imageOfGridiconsplugins(size: size)
333334
case .play:
334335
return GridiconsGenerated.imageOfGridiconsplay(size: size)
336+
case .plans:
337+
return GridiconsGenerated.imageOfGridiconsplans(size: size)
335338
case .phone:
336339
return GridiconsGenerated.imageOfGridiconsphone(size: size)
337340
case .pencil:

Gridicons/Gridicons/GridiconsGenerated.swift

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3950,7 +3950,61 @@ class GridiconsGenerated: NSObject {
39503950

39513951
context.restoreGState()
39523952
}
3953-
3953+
3954+
class func drawGridiconsplans(frame targetFrame: CGRect = CGRect(x: 0, y: 0, width: 20, height: 20), resizing: ResizingBehavior = .aspectFit) {
3955+
/// General Declarations
3956+
let context = UIGraphicsGetCurrentContext()!
3957+
3958+
/// Resize to Target Frame
3959+
context.saveGState()
3960+
let resizedFrame = resizing.apply(rect: CGRect(x: 0, y: 0, width: 20, height: 20), target: targetFrame)
3961+
context.translateBy(x: resizedFrame.minX, y: resizedFrame.minY)
3962+
context.scaleBy(x: resizedFrame.width / 20, y: resizedFrame.height / 20)
3963+
context.translateBy(x: -994, y: -509)
3964+
3965+
/// gridicons-plans
3966+
do {
3967+
context.saveGState()
3968+
context.translateBy(x: 992, y: 507)
3969+
3970+
/// Group
3971+
do {
3972+
context.saveGState()
3973+
context.translateBy(x: 2, y: 2)
3974+
3975+
/// Shape
3976+
let shape = UIBezierPath()
3977+
shape.move(to: CGPoint(x: 10, y: 0))
3978+
shape.addCurve(to: CGPoint(x: 0, y: 10), controlPoint1: CGPoint(x: 4.5, y: 0), controlPoint2: CGPoint(x: 0, y: 4.5))
3979+
shape.addCurve(to: CGPoint(x: 10, y: 20), controlPoint1: CGPoint(x: 0, y: 15.5), controlPoint2: CGPoint(x: 4.5, y: 20))
3980+
shape.addCurve(to: CGPoint(x: 20, y: 10), controlPoint1: CGPoint(x: 15.5, y: 20), controlPoint2: CGPoint(x: 20, y: 15.5))
3981+
shape.addCurve(to: CGPoint(x: 10, y: 0), controlPoint1: CGPoint(x: 20, y: 4.5), controlPoint2: CGPoint(x: 15.5, y: 0))
3982+
shape.close()
3983+
shape.move(to: CGPoint(x: 9, y: 12))
3984+
shape.addLine(to: CGPoint(x: 4, y: 12))
3985+
shape.addLine(to: CGPoint(x: 9, y: 2))
3986+
shape.addLine(to: CGPoint(x: 9, y: 12))
3987+
shape.close()
3988+
shape.move(to: CGPoint(x: 11, y: 18))
3989+
shape.addLine(to: CGPoint(x: 11, y: 8))
3990+
shape.addLine(to: CGPoint(x: 16, y: 8))
3991+
shape.addLine(to: CGPoint(x: 11, y: 18))
3992+
shape.close()
3993+
shape.move(to: CGPoint(x: 11, y: 18))
3994+
context.saveGState()
3995+
UIColor.black.setFill()
3996+
shape.fill()
3997+
context.restoreGState()
3998+
3999+
context.restoreGState()
4000+
}
4001+
4002+
context.restoreGState()
4003+
}
4004+
4005+
context.restoreGState()
4006+
}
4007+
39544008
class func drawGridiconsphone(frame targetFrame: CGRect = CGRect(x: 0, y: 0, width: 12, height: 20), resizing: ResizingBehavior = .aspectFit) {
39554009
/// General Declarations
39564010
let context = UIGraphicsGetCurrentContext()!
@@ -12765,6 +12819,17 @@ class GridiconsGenerated: NSObject {
1276512819
return image
1276612820
}
1276712821

12822+
class func imageOfGridiconsplans(size: CGSize) -> UIImage {
12823+
var image: UIImage
12824+
12825+
UIGraphicsBeginImageContextWithOptions(size, false, 0)
12826+
GridiconsGenerated.drawGridiconsplans(frame: CGRect(origin: CGPoint.zero, size: size))
12827+
image = UIGraphicsGetImageFromCurrentImageContext()!
12828+
UIGraphicsEndImageContext()
12829+
12830+
return image
12831+
}
12832+
1276812833
class func imageOfGridiconsphone(size: CGSize) -> UIImage {
1276912834
var image: UIImage
1277012835

0 commit comments

Comments
 (0)