Repository Public License
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project : ORIX Monitor9// File : Scripts/tools/dmg-background.swift10// Description : Draws the disk-image window background (660 × 440 pt,11// rendered at 2x): ORIX canvas, arrow and install hint.12// Module : Scripts13// Repository : https://git.spboucher.ai/orix-monitor14// Created : 2026-11-2115// Last Modified : 2026-11-2116//17// =============================================================================18// AUTHOR & PROFESSIONAL AFFILIATION19// =============================================================================20//21// Author : Simon-Pierre Boucher22// Position : Professor of Finance23// Institution : Université du Québec en Outaouais (UQO)24// Department : Département des sciences administratives25// Organization : SP Boucher26//27// Website : https://spboucher.ai28// Git : https://git.spboucher.ai29//30// =============================================================================31// OFFICIAL CONTACT DIRECTORY32// =============================================================================33//34// General : info@spboucher.ai35// Professional : contact@spboucher.ai36// Direct : simon@spboucher.ai37// Research : research@spboucher.ai38// Development : dev@spboucher.ai39// Support : support@spboucher.ai40// Security/Admin : admin@spboucher.ai41// Notifications : notifications@spboucher.ai42//43// Preferred Contact: support@spboucher.ai44//45// =============================================================================46// COPYRIGHT & INTELLECTUAL PROPERTY47// =============================================================================48//49// Copyright (c) 202650// Simon-Pierre Boucher51//52// All rights reserved where applicable.53//54// This file is governed by the applicable project license,55// copyright notices, institutional agreements and relevant law.56//57// Unless expressly authorized by the applicable license or58// rights holder, copying, redistribution, sublicensing,59// publication and commercial exploitation are not permitted.60//61// Existing third-party rights and notices remain unaffected.62//63// =============================================================================64// CONFIDENTIALITY & SECURITY65// =============================================================================66//67// Classification : Public68// Distribution : Public repository; use is governed by the project license69// Security Contact : admin@spboucher.ai70//71// Access to this source does not independently grant permission72// to redistribute or disclose confidential materials.73//74// Do not embed credentials, private keys, access tokens,75// certificates or confidential personal information.76//77// =============================================================================78// LICENSE & MAINTENANCE79// =============================================================================80//81// License : Proprietary, all rights reserved (see license file)82// License File : LICENSE83// Maintainer : Simon-Pierre Boucher84// Technical Contact: dev@spboucher.ai85//86// =============================================================================87// END OF SP BOUCHER SOURCE HEADER88// =============================================================================8990import AppKit9192let out = CommandLine.arguments.count > 1 ? CommandLine.arguments[1] : "dmg-background.png"93let size = CGSize(width: 660, height: 440), scale: CGFloat = 294let space = CGColorSpace(name: CGColorSpace.sRGB)!95let c = CGContext(data: nil, width: Int(size.width * scale), height: Int(size.height * scale), bitsPerComponent: 8, bytesPerRow: 0, space: space, bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue)!96c.scaleBy(x: scale, y: scale)97func rgb(_ hex: UInt32, _ a: CGFloat = 1) -> CGColor { CGColor(srgbRed: CGFloat((hex >> 16) & 0xFF) / 255, green: CGFloat((hex >> 8) & 0xFF) / 255, blue: CGFloat(hex & 0xFF) / 255, alpha: a) }98c.drawLinearGradient(CGGradient(colorsSpace: space, colors: [rgb(0x1D2440), rgb(0x0A0D18)] as CFArray, locations: nil)!, start: CGPoint(x: 0, y: size.height), end: CGPoint(x: 0, y: 0), options: [])99c.drawRadialGradient(CGGradient(colorsSpace: space, colors: [rgb(0x22D3EE, 0.16), rgb(0x22D3EE, 0)] as CFArray, locations: nil)!, startCenter: CGPoint(x: 170, y: 250), startRadius: 0, endCenter: CGPoint(x: 170, y: 250), endRadius: 320, options: [])100// Arrow from the app icon (170, 240 from the bottom) to the Applications alias (490).101c.setStrokeColor(rgb(0x22D3EE, 0.9)); c.setLineWidth(5); c.setLineCap(.round); c.setLineJoin(.round)102c.move(to: CGPoint(x: 272, y: 240)); c.addLine(to: CGPoint(x: 388, y: 240))103c.move(to: CGPoint(x: 368, y: 258)); c.addLine(to: CGPoint(x: 388, y: 240)); c.addLine(to: CGPoint(x: 368, y: 222))104c.strokePath()105NSGraphicsContext.current = NSGraphicsContext(cgContext: c, flipped: false)106func draw(_ text: String, _ font: NSFont, _ color: NSColor, y: CGFloat) {107 let a = NSAttributedString(string: text, attributes: [.font: font, .foregroundColor: color])108 a.draw(at: CGPoint(x: (size.width - a.size().width) / 2, y: y))109}110draw("ORIX Monitor", .systemFont(ofSize: 24, weight: .bold), .white, y: 372)111draw("Understand Every Pulse of Your Mac.", .systemFont(ofSize: 13, weight: .regular), NSColor(white: 1, alpha: 0.65), y: 348)112draw("Drag ORIX Monitor to the Applications folder", .systemFont(ofSize: 13, weight: .medium), NSColor(white: 1, alpha: 0.8), y: 52)113let rep = NSBitmapImageRep(cgImage: c.makeImage()!)114rep.size = size // 144 dpi: Finder shows it at 660 × 440 pt115try! rep.representation(using: .png, properties: [:])!.write(to: URL(fileURLWithPath: out))116