icon

package
v0.0.52 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package icon draws an application's face out of the game's own art.

Not a picture of a ship — THE ship. The outline is a real asset (player.lfa, enemy.lfa) read through this module's loader and filled here, so an icon that stopped looking like the game would mean the game changed. There is no image file to keep in step, in this repository or in the ones that embed it.

The rasterizer is a scanline fill over the flattened outline, rendered at several times the requested size and averaged down. That is all a polygon needs, and it is why this package pulls in no image library: one to fill a single closed path is a dependency bought for nothing.

Two callers, two faces, one drawing: the campaign wears the player hull in its own cyan, and skirmish wears a faction hull in that faction's colour, because colour says which faction there — on the battlefield and on the Dock.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PNG

func PNG(content fs.FS, dir, ref string, tint color.RGBA, size int) ([]byte, error)

PNG encodes what Ship draws, which is what the platform APIs that take bytes want (the application icon on macOS, an .iconset entry for iconutil).

func Ship

func Ship(content fs.FS, dir, ref string, tint color.RGBA, size int) image.Image

Ship draws the asset ref (in dir, of content) as a size×size icon.

A tint with a zero alpha means the art's own stroke colour, which is what the campaign wants: the player hull is cyan because the asset says so. Pass a colour to override it, which is what a faction fleet wants.

An asset that cannot be read costs the icon its fidelity and nothing else — a program that refused to start because it could not draw its own face would be a worse bug than a plain triangle, so this always returns an image.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL