Repository Public BSD-3-Clause
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project : ORIX Maps9// File : scripts/make-icon.swift10// Module : scripts11// Repository : https://git.spboucher.ai/orix-maps12// Created : 2026-11-2513// Last Modified : 2026-11-2514//15// =============================================================================16// AUTHOR & PROFESSIONAL AFFILIATION17// =============================================================================18//19// Author : Simon-Pierre Boucher20// Position : Professor of Finance21// Institution : Université du Québec en Outaouais (UQO)22// Department : Département des sciences administratives23// Organization : SP Boucher24//25// Website : https://spboucher.ai26// Git : https://git.spboucher.ai27//28// =============================================================================29// OFFICIAL CONTACT DIRECTORY30// =============================================================================31//32// General : info@spboucher.ai33// Professional : contact@spboucher.ai34// Direct : simon@spboucher.ai35// Research : research@spboucher.ai36// Development : dev@spboucher.ai37// Support : support@spboucher.ai38// Security/Admin : admin@spboucher.ai39// Notifications : notifications@spboucher.ai40//41// Preferred Contact: support@spboucher.ai42//43// =============================================================================44// COPYRIGHT & INTELLECTUAL PROPERTY45// =============================================================================46//47// Copyright (c) 202648// Simon-Pierre Boucher49//50// All rights reserved where applicable.51//52// This file is governed by the applicable project license,53// copyright notices, institutional agreements and relevant law.54//55// Unless expressly authorized by the applicable license or56// rights holder, copying, redistribution, sublicensing,57// publication and commercial exploitation are not permitted.58//59// Existing third-party rights and notices remain unaffected.60//61// =============================================================================62// CONFIDENTIALITY & SECURITY63// =============================================================================64//65// Classification : Public66// Distribution : Public repository; use is governed by the project license67// Security Contact : admin@spboucher.ai68//69// Access to this source does not independently grant permission70// to redistribute or disclose confidential materials.71//72// Do not embed credentials, private keys, access tokens,73// certificates or confidential personal information.74//75// =============================================================================76// LICENSE & MAINTENANCE77// =============================================================================78//79// License : Proprietary, all rights reserved (see license file)80// License File : LICENSE81// Maintainer : Simon-Pierre Boucher82// Technical Contact: dev@spboucher.ai83//84// =============================================================================85// END OF SP BOUCHER SOURCE HEADER86// =============================================================================8788// Draws the ORIX Maps application icon (1024 × 1024, opaque) with Core Graphics.89// usage: swift scripts/make-icon.swift <out.png>90// Design: a night-to-teal field crossed by contour lines and one bright route, with the ORIX ring as the place marker.91import AppKit92import CoreGraphics9394let size = 102495let space = CGColorSpace(name: CGColorSpace.sRGB)!96let ctx = CGContext(data: nil, width: size, height: size, bitsPerComponent: 8, bytesPerRow: 0, space: space, bitmapInfo: CGImageAlphaInfo.noneSkipLast.rawValue)!97let s = CGFloat(size)98func rgb(_ hex: UInt32, _ a: CGFloat = 1) -> CGColor {99 CGColor(colorSpace: space, components: [CGFloat((hex >> 16) & 0xff) / 255, CGFloat((hex >> 8) & 0xff) / 255, CGFloat(hex & 0xff) / 255, a])!100}101102// Background: deep night blue (bottom left) to ORIX teal (top right).103let bg = CGGradient(colorsSpace: space, colors: [rgb(0x0B1D33), rgb(0x0E4F63), rgb(0x00A896)] as CFArray, locations: [0, 0.55, 1])!104ctx.drawLinearGradient(bg, start: CGPoint(x: 0, y: 0), end: CGPoint(x: s, y: s), options: [])105106// Contour lines: nested, slightly irregular closed curves around two summits.107func contour(center: CGPoint, radius: CGFloat, wobble: CGFloat, phase: CGFloat) -> CGPath {108 let path = CGMutablePath()109 let n = 96110 for i in 0...n {111 let t = CGFloat(i) / CGFloat(n) * 2 * .pi112 let r = radius * (1 + wobble * sin(3 * t + phase) + wobble * 0.6 * cos(5 * t - phase * 1.7))113 let p = CGPoint(x: center.x + r * cos(t) * 1.18, y: center.y + r * sin(t) * 0.92)114 if i == 0 { path.move(to: p) } else { path.addLine(to: p) }115 }116 path.closeSubpath()117 return path118}119ctx.setLineJoin(.round)120for (center, count, base) in [(CGPoint(x: s * 0.30, y: s * 0.70), 7, s * 0.07), (CGPoint(x: s * 0.80, y: s * 0.24), 6, s * 0.06)] {121 for i in 0..<count {122 ctx.addPath(contour(center: center, radius: base + CGFloat(i) * s * 0.062, wobble: 0.07, phase: CGFloat(i) * 0.5))123 ctx.setStrokeColor(rgb(0xFFFFFF, i % 3 == 0 ? 0.20 : 0.10))124 ctx.setLineWidth(i % 3 == 0 ? 7 : 4)125 ctx.strokePath()126 }127}128129// The route: one confident curve from the lower left to the marker.130let marker = CGPoint(x: s * 0.60, y: s * 0.58)131let route = CGMutablePath()132route.move(to: CGPoint(x: s * 0.10, y: s * 0.16))133route.addCurve(to: CGPoint(x: s * 0.44, y: s * 0.30), control1: CGPoint(x: s * 0.24, y: s * 0.10), control2: CGPoint(x: s * 0.40, y: s * 0.14))134route.addCurve(to: CGPoint(x: marker.x, y: marker.y - s * 0.20), control1: CGPoint(x: s * 0.47, y: s * 0.42), control2: CGPoint(x: s * 0.60, y: s * 0.30))135ctx.setLineCap(.round)136ctx.addPath(route); ctx.setStrokeColor(rgb(0x06263A, 0.55)); ctx.setLineWidth(58); ctx.strokePath()137ctx.addPath(route); ctx.setStrokeColor(rgb(0xFFFFFF)); ctx.setLineWidth(34); ctx.strokePath()138139// The marker: the ORIX ring with a pointer, white with a soft shadow, teal core.140let R = s * 0.185141let pin = CGMutablePath()142let tip = CGPoint(x: marker.x, y: marker.y - R * 1.62)143pin.addArc(center: marker, radius: R, startAngle: -.pi / 2 + 0.62, endAngle: -.pi / 2 - 0.62 + 2 * .pi, clockwise: false)144pin.addQuadCurve(to: tip, control: CGPoint(x: marker.x - R * 0.30, y: marker.y - R * 1.18))145pin.addQuadCurve(to: CGPoint(x: marker.x + R * sin(0.62), y: marker.y - R * cos(0.62)), control: CGPoint(x: marker.x + R * 0.30, y: marker.y - R * 1.18))146pin.closeSubpath()147ctx.saveGState()148ctx.setShadow(offset: CGSize(width: 0, height: -14), blur: 36, color: rgb(0x00131F, 0.5))149ctx.addPath(pin); ctx.setFillColor(rgb(0xFFFFFF)); ctx.fillPath()150ctx.restoreGState()151ctx.addEllipse(in: CGRect(x: marker.x - R * 0.56, y: marker.y - R * 0.56, width: R * 1.12, height: R * 1.12))152ctx.clip()153let core = CGGradient(colorsSpace: space, colors: [rgb(0x00C2AE), rgb(0x0B6E8A)] as CFArray, locations: [0, 1])!154ctx.drawLinearGradient(core, start: CGPoint(x: marker.x, y: marker.y + R), end: CGPoint(x: marker.x, y: marker.y - R), options: [])155156let image = ctx.makeImage()!157let rep = NSBitmapImageRep(cgImage: image)158try! rep.representation(using: .png, properties: [:])!.write(to: URL(fileURLWithPath: CommandLine.arguments[1]))159