WizardBackgroundView.swift 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. // _____ _
  2. // |_ _| |_ _ _ ___ ___ _ __ __ _
  3. // | | | ' \| '_/ -_) -_) ' \/ _` |_
  4. // |_| |_||_|_| \___\___|_|_|_\__,_(_)
  5. //
  6. // Threema iOS Client
  7. // Copyright (c) 2020 Threema GmbH
  8. //
  9. // This program is free software: you can redistribute it and/or modify
  10. // it under the terms of the GNU Affero General Public License, version 3,
  11. // as published by the Free Software Foundation.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU Affero General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Affero General Public License
  19. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. import Foundation
  21. @objc public class WizardBackgroundView: UIView {
  22. @objc override public func draw(_ rect: CGRect) {
  23. super.draw(rect)
  24. self.drawCanvas1(frame: rect )
  25. }
  26. func drawCanvas1(frame: CGRect = CGRect(x: 0, y: 0, width: 2890, height: 1380)) {
  27. //// General Declarations
  28. // This non-generic function dramatically improves compilation times of complex expressions.
  29. func fastFloor(_ x: CGFloat) -> CGFloat { return floor(x) }
  30. //// Color Declarations
  31. let fillColor = UIColor(red: 0.169, green: 0.169, blue: 0.169, alpha: 1.000)
  32. let fillColor2 = UIColor(red: 0.000, green: 0.000, blue: 0.000, alpha: 0.130)
  33. let fillColor3 = UIColor(red: 0.000, green: 0.000, blue: 0.000, alpha: 0.200)
  34. let fillColor4 = UIColor(red: 0.000, green: 0.000, blue: 0.000, alpha: 0.180)
  35. let fillColor5 = UIColor(red: 0.000, green: 0.000, blue: 0.000, alpha: 0.350)
  36. let fillColor6 = UIColor(red: 0.000, green: 0.000, blue: 0.000, alpha: 0.250)
  37. let fillColor7 = UIColor(red: 0.000, green: 0.000, blue: 0.000, alpha: 0.500)
  38. //// Subframes
  39. let wizardBgpdfGroup: CGRect = CGRect(x: frame.minX, y: frame.minY, width: frame.width, height: frame.height)
  40. //// WizardBg.pdf Group
  41. //// Rectangle Drawing
  42. let rectanglePath = UIBezierPath(rect: CGRect(x: wizardBgpdfGroup.minX + fastFloor(wizardBgpdfGroup.width * 0.00000 + 0.5), y: wizardBgpdfGroup.minY + fastFloor(wizardBgpdfGroup.height * 0.00000 + 0.5), width: fastFloor(wizardBgpdfGroup.width * 1.00000 + 0.5) - fastFloor(wizardBgpdfGroup.width * 0.00000 + 0.5), height: fastFloor(wizardBgpdfGroup.height * 1.00000 + 0.5) - fastFloor(wizardBgpdfGroup.height * 0.00000 + 0.5)))
  43. fillColor.setFill()
  44. rectanglePath.fill()
  45. //// Bezier Drawing
  46. let bezierPath = UIBezierPath()
  47. bezierPath.move(to: CGPoint(x: wizardBgpdfGroup.minX + 0.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 0.12246 * wizardBgpdfGroup.height))
  48. bezierPath.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 1.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 0.23700 * wizardBgpdfGroup.height))
  49. bezierPath.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 1.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 1.00000 * wizardBgpdfGroup.height))
  50. bezierPath.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 0.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 1.00000 * wizardBgpdfGroup.height))
  51. bezierPath.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 0.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 0.12246 * wizardBgpdfGroup.height))
  52. bezierPath.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 0.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 0.12246 * wizardBgpdfGroup.height))
  53. bezierPath.close()
  54. bezierPath.usesEvenOddFillRule = true
  55. fillColor2.setFill()
  56. bezierPath.fill()
  57. //// Bezier 2 Drawing
  58. let bezier2Path = UIBezierPath()
  59. bezier2Path.move(to: CGPoint(x: wizardBgpdfGroup.minX + 1.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 0.00000 * wizardBgpdfGroup.height))
  60. bezier2Path.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 1.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 1.00000 * wizardBgpdfGroup.height))
  61. bezier2Path.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 0.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 1.00000 * wizardBgpdfGroup.height))
  62. bezier2Path.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 0.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 0.62747 * wizardBgpdfGroup.height))
  63. bezier2Path.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 0.66701 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 0.00000 * wizardBgpdfGroup.height))
  64. bezier2Path.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 1.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 0.00000 * wizardBgpdfGroup.height))
  65. bezier2Path.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 1.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 0.00000 * wizardBgpdfGroup.height))
  66. bezier2Path.close()
  67. bezier2Path.usesEvenOddFillRule = true
  68. fillColor3.setFill()
  69. bezier2Path.fill()
  70. //// Bezier 3 Drawing
  71. let bezier3Path = UIBezierPath()
  72. bezier3Path.move(to: CGPoint(x: wizardBgpdfGroup.minX + 0.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 0.26232 * wizardBgpdfGroup.height))
  73. bezier3Path.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 1.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 0.69998 * wizardBgpdfGroup.height))
  74. bezier3Path.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 1.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 1.00000 * wizardBgpdfGroup.height))
  75. bezier3Path.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 0.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 1.00000 * wizardBgpdfGroup.height))
  76. bezier3Path.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 0.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 0.26232 * wizardBgpdfGroup.height))
  77. bezier3Path.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 0.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 0.26232 * wizardBgpdfGroup.height))
  78. bezier3Path.close()
  79. bezier3Path.usesEvenOddFillRule = true
  80. fillColor4.setFill()
  81. bezier3Path.fill()
  82. //// Bezier 4 Drawing
  83. let bezier4Path = UIBezierPath()
  84. bezier4Path.move(to: CGPoint(x: wizardBgpdfGroup.minX + 1.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 0.36531 * wizardBgpdfGroup.height))
  85. bezier4Path.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 1.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 1.00000 * wizardBgpdfGroup.height))
  86. bezier4Path.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 0.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 1.00000 * wizardBgpdfGroup.height))
  87. bezier4Path.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 0.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 0.83415 * wizardBgpdfGroup.height))
  88. bezier4Path.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 1.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 0.36531 * wizardBgpdfGroup.height))
  89. bezier4Path.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 1.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 0.36531 * wizardBgpdfGroup.height))
  90. bezier4Path.close()
  91. bezier4Path.usesEvenOddFillRule = true
  92. fillColor5.setFill()
  93. bezier4Path.fill()
  94. //// Bezier 5 Drawing
  95. let bezier5Path = UIBezierPath()
  96. bezier5Path.move(to: CGPoint(x: wizardBgpdfGroup.minX + 0.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 0.69783 * wizardBgpdfGroup.height))
  97. bezier5Path.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 1.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 0.92059 * wizardBgpdfGroup.height))
  98. bezier5Path.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 1.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 1.00000 * wizardBgpdfGroup.height))
  99. bezier5Path.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 0.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 1.00000 * wizardBgpdfGroup.height))
  100. bezier5Path.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 0.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 0.69783 * wizardBgpdfGroup.height))
  101. bezier5Path.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 0.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 0.69783 * wizardBgpdfGroup.height))
  102. bezier5Path.close()
  103. bezier5Path.usesEvenOddFillRule = true
  104. fillColor6.setFill()
  105. bezier5Path.fill()
  106. //// Bezier 6 Drawing
  107. let bezier6Path = UIBezierPath()
  108. bezier6Path.move(to: CGPoint(x: wizardBgpdfGroup.minX + 1.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 0.62617 * wizardBgpdfGroup.height))
  109. bezier6Path.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 1.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 0.99968 * wizardBgpdfGroup.height))
  110. bezier6Path.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 0.50000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 1.00000 * wizardBgpdfGroup.height))
  111. bezier6Path.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 1.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 0.62617 * wizardBgpdfGroup.height))
  112. bezier6Path.addLine(to: CGPoint(x: wizardBgpdfGroup.minX + 1.00000 * wizardBgpdfGroup.width, y: wizardBgpdfGroup.minY + 0.62617 * wizardBgpdfGroup.height))
  113. bezier6Path.close()
  114. bezier6Path.usesEvenOddFillRule = true
  115. fillColor7.setFill()
  116. bezier6Path.fill()
  117. }
  118. }