Repository Public
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project : MacLustr Storage Node9// File : Scripts/make-icon.swift10// Description : Draws the app icon (graphite ground, a stack of storage11// fragments, one lit in the MacLustr accent). usage: swift12// Scripts/make-icon.swift <out.png> [size]13// Module : Scripts14// Repository : https://git.spboucher.ai/maclustr-storage-ios15// Project Website : https://storage.spboucher.ai16// Created : 2026-12-0117// Last Modified : 2026-12-0118//19// =============================================================================20// AUTHOR & PROFESSIONAL AFFILIATION21// =============================================================================22//23// Author : Simon-Pierre Boucher24// Position : Professor of Finance25// Institution : Université du Québec en Outaouais (UQO)26// Department : Département des sciences administratives27// Organization : SP Boucher28//29// Website : https://spboucher.ai30// Git : https://git.spboucher.ai31//32// =============================================================================33// OFFICIAL CONTACT DIRECTORY34// =============================================================================35//36// General : info@spboucher.ai37// Professional : contact@spboucher.ai38// Direct : simon@spboucher.ai39// Research : research@spboucher.ai40// Development : dev@spboucher.ai41// Support : support@spboucher.ai42// Security/Admin : admin@spboucher.ai43// Notifications : notifications@spboucher.ai44//45// Preferred Contact: admin@spboucher.ai46//47// =============================================================================48// COPYRIGHT & INTELLECTUAL PROPERTY49// =============================================================================50//51// Copyright (c) 202652// Simon-Pierre Boucher53//54// All rights reserved where applicable.55//56// This file is governed by the applicable project license,57// copyright notices, institutional agreements and relevant law.58//59// Unless expressly authorized by the applicable license or60// rights holder, copying, redistribution, sublicensing,61// publication and commercial exploitation are not permitted.62//63// Existing third-party rights and notices remain unaffected.64//65// =============================================================================66// CONFIDENTIALITY & SECURITY67// =============================================================================68//69// Classification : Public70// Distribution : Public repository; use is governed by the project license71// Security Contact : admin@spboucher.ai72//73// Access to this source does not independently grant permission74// to redistribute or disclose confidential materials.75//76// Do not embed credentials, private keys, access tokens,77// certificates or confidential personal information.78//79// =============================================================================80// LICENSE & MAINTENANCE81// =============================================================================82//83// License : None specified (no license file in this repository)84// Maintainer : Simon-Pierre Boucher85// Technical Contact: dev@spboucher.ai86//87// =============================================================================88// END OF SP BOUCHER SOURCE HEADER89// =============================================================================9091import AppKit9293let out = CommandLine.arguments[1]94let size = CommandLine.arguments.count > 2 ? Int(CommandLine.arguments[2])! : 102495let S = CGFloat(size)96let rep = NSBitmapImageRep(bitmapDataPlanes: nil, pixelsWide: size, pixelsHigh: size, bitsPerSample: 8, samplesPerPixel: 4, hasAlpha: true, isPlanar: false, colorSpaceName: .deviceRGB, bytesPerRow: 0, bitsPerPixel: 0)!97NSGraphicsContext.current = NSGraphicsContext(bitmapImageRep: rep)98let ctx = NSGraphicsContext.current!.cgContext99func rgb(_ h: UInt32) -> CGColor { CGColor(red: CGFloat((h >> 16) & 0xFF) / 255, green: CGFloat((h >> 8) & 0xFF) / 255, blue: CGFloat(h & 0xFF) / 255, alpha: 1) }100ctx.setFillColor(rgb(0x0A0B0D)); ctx.fill(CGRect(x: 0, y: 0, width: S, height: S))101// grid of fragments: 4 columns x 4 rows, filled from the bottom like storage in use102let cols = 4, rows = 4103let margin = S * 0.20, gap = S * 0.028104let cell = (S - 2 * margin - CGFloat(cols - 1) * gap) / CGFloat(cols)105let filled: Set<Int> = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] // bottom rows hold fragments106let lit = 10 // the fragment being written107for r in 0..<rows { for c in 0..<cols {108 let i = r * cols + c109 let rect = CGRect(x: margin + CGFloat(c) * (cell + gap), y: margin + CGFloat(r) * (cell + gap), width: cell, height: cell)110 let path = CGPath(roundedRect: rect, cornerWidth: cell * 0.14, cornerHeight: cell * 0.14, transform: nil)111 if i == lit { ctx.setFillColor(rgb(0x7CB7FF)); ctx.addPath(path); ctx.fillPath() }112 else if filled.contains(i) { ctx.setFillColor(rgb(0x2A2F38)); ctx.addPath(path); ctx.fillPath() }113 else { ctx.setStrokeColor(rgb(0x2A2F38)); ctx.setLineWidth(S * 0.006); ctx.addPath(CGPath(roundedRect: rect.insetBy(dx: S * 0.003, dy: S * 0.003), cornerWidth: cell * 0.14, cornerHeight: cell * 0.14, transform: nil)); ctx.strokePath() }114} }115ctx.flush()116try! rep.representation(using: .png, properties: [:])!.write(to: URL(fileURLWithPath: out))117