SPB Git

Repository Public

icone.swift 7.0 KB 145 lines swift

1// =============================================================================2//                  SP BOUCHER | SOFTWARE & RESEARCH3//             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project          : Immo-Ka Admin iOS9// File             : Scripts/icone.swift10// Description      : dessine l'icône de l'app (1024 × 1024, variantes claire et11//                    sombre) sans outil graphique : la maison d'Immo-Ka en12//                    filet de chaux sur fond ardoise, battant de porte13//                    entrouvert, béquille de laiton. L'app publique d'Immo-Ka14//                    porte une maison pleine, charbon, sur fond de chaux, avec15//                    une porte rouge ; Lou-Ka Admin porte une porte seule sur16//                    fond charbon. Les trois se distinguent par la couleur du17//                    fond et par la forme. usage : swift Scripts/icone.swift18//                    <dossier de sortie>19// Module           : Scripts20// Repository       : https://git.spboucher.ai/immo-ka-admin-ios21// Project Website  : https://www.immo-ka.com22// Created          : 2026-11-3023// Last Modified    : 2026-11-3024//25// =============================================================================26// AUTHOR & PROFESSIONAL AFFILIATION27// =============================================================================28//29// Author           : Simon-Pierre Boucher30// Position         : Professor of Finance31// Institution      : Université du Québec en Outaouais (UQO)32// Department       : Département des sciences administratives33// Organization     : SP Boucher34//35// Website          : https://spboucher.ai36// Git              : https://git.spboucher.ai37//38// =============================================================================39// OFFICIAL CONTACT DIRECTORY40// =============================================================================41//42// General          : info@spboucher.ai43// Professional     : contact@spboucher.ai44// Direct           : simon@spboucher.ai45// Research         : research@spboucher.ai46// Development      : dev@spboucher.ai47// Support          : support@spboucher.ai48// Security/Admin   : admin@spboucher.ai49// Notifications    : notifications@spboucher.ai50//51// Preferred Contact: support@spboucher.ai52//53// =============================================================================54// COPYRIGHT & INTELLECTUAL PROPERTY55// =============================================================================56//57// Copyright (c) 202658// Simon-Pierre Boucher59//60// All rights reserved where applicable.61//62// This file is governed by the applicable project license,63// copyright notices, institutional agreements and relevant law.64//65// Unless expressly authorized by the applicable license or66// rights holder, copying, redistribution, sublicensing,67// publication and commercial exploitation are not permitted.68//69// Existing third-party rights and notices remain unaffected.70//71// =============================================================================72// CONFIDENTIALITY & SECURITY73// =============================================================================74//75// Classification   : Public76// Distribution     : Public repository; use is governed by the project license77// Security Contact : admin@spboucher.ai78//79// Access to this source does not independently grant permission80// to redistribute or disclose confidential materials.81//82// Do not embed credentials, private keys, access tokens,83// certificates or confidential personal information.84//85// =============================================================================86// LICENSE & MAINTENANCE87// =============================================================================88//89// License          : None specified (no license file in this repository)90// Maintainer       : Simon-Pierre Boucher91// Technical Contact: dev@spboucher.ai92//93// =============================================================================94// END OF SP BOUCHER SOURCE HEADER95// =============================================================================9697import AppKit98import CoreGraphics99100func color(_ hex: UInt32, _ a: CGFloat = 1) -> CGColor {101    CGColor(srgbRed: CGFloat((hex >> 16) & 0xFF) / 255, green: CGFloat((hex >> 8) & 0xFF) / 255, blue: CGFloat(hex & 0xFF) / 255, alpha: a)102}103104/// Géométrie de la marque d'Immo-Ka sur une grille de 64 (silhouette à avant-toits retroussés, cheminée, embrasure).105func draw(background: UInt32, line: UInt32, handle: UInt32, to url: URL) {106    let size = 1024107    let ctx = CGContext(data: nil, width: size, height: size, bitsPerComponent: 8, bytesPerRow: 0, space: CGColorSpace(name: CGColorSpace.sRGB)!,108                        bitmapInfo: CGImageAlphaInfo.noneSkipLast.rawValue)!109    ctx.setFillColor(color(background))110    ctx.fill(CGRect(x: 0, y: 0, width: size, height: size))111    let scale: CGFloat = 10.6, ox: CGFloat = (1024 - 64 * scale) / 2, oy: CGFloat = (1024 - 66 * scale) / 2112    func p(_ x: CGFloat, _ y: CGFloat) -> CGPoint { CGPoint(x: ox + x * scale, y: 1024 - (oy + y * scale)) }113    ctx.setLineCap(.round); ctx.setLineJoin(.round)114    ctx.setStrokeColor(color(line))115    // silhouette de la maison, d'un seul contour116    ctx.setLineWidth(2.4 * scale)117    ctx.move(to: p(32, 6.5)); ctx.addLine(to: p(41.5, 15.3))118    ctx.addLine(to: p(41.5, 9.5)); ctx.addLine(to: p(47, 9.5)); ctx.addLine(to: p(47, 20.4)); ctx.addLine(to: p(49.7, 22.9))119    ctx.addCurve(to: p(59.8, 27.9), control1: p(52.7, 25.7), control2: p(55.7, 27.2))120    ctx.addCurve(to: p(59.5, 31.5), control1: p(62.1, 28.3), control2: p(61.9, 31.5))121    ctx.addLine(to: p(53, 31.5)); ctx.addLine(to: p(53, 58)); ctx.addLine(to: p(11, 58)); ctx.addLine(to: p(11, 31.5)); ctx.addLine(to: p(4.5, 31.5))122    ctx.addCurve(to: p(4.2, 27.9), control1: p(2.1, 31.5), control2: p(1.9, 28.3))123    ctx.addCurve(to: p(14.3, 22.9), control1: p(8.3, 27.2), control2: p(11.3, 25.7))124    ctx.closePath()125    ctx.strokePath()126    // battant entrouvert, en filet127    ctx.setLineWidth(1.9 * scale)128    ctx.move(to: p(24.5, 31.5)); ctx.addLine(to: p(36.5, 34.6)); ctx.addLine(to: p(36.5, 55.2)); ctx.addLine(to: p(24.5, 58)); ctx.closePath()129    ctx.strokePath()130    // seuil131    ctx.setLineWidth(2.4 * scale)132    ctx.move(to: p(5, 62)); ctx.addLine(to: p(59, 62)); ctx.strokePath()133    // béquille134    ctx.setFillColor(color(handle))135    let c = p(33.2, 44.6), r = 1.9 * scale136    ctx.fillEllipse(in: CGRect(x: c.x - r, y: c.y - r, width: 2 * r, height: 2 * r))137    let rep = NSBitmapImageRep(cgImage: ctx.makeImage()!)138    try! rep.representation(using: .png, properties: [:])!.write(to: url)139}140141let out = URL(fileURLWithPath: CommandLine.arguments.count > 1 ? CommandLine.arguments[1] : ".")142draw(background: 0x2B4A63, line: 0xF6F3EC, handle: 0xD2AC62, to: out.appendingPathComponent("icon-1024.png"))143draw(background: 0x1D3549, line: 0xE8E4DA, handle: 0xD2AC62, to: out.appendingPathComponent("icon-1024-dark.png"))144print("icônes écrites dans \(out.path)")145
Files main
Menu

Theme