hex-world
    Preparing search index...

    Interface MapImageOptions

    Placement options shared by the transform and the renderer.

    interface MapImageOptions {
        scale?: number;
        padding?: number;
        background?: string;
        type?: "image/png" | "image/jpeg" | "image/webp";
        quality?: number;
        elevationShading?: number;
        fog?: FogData;
        fogDimOpacity?: number;
        fogHideUnexplored?: boolean;
        cellTint?: (col: number, row: number) => string | null | undefined;
        rivers?: boolean | MapImageLineStyle;
        roads?: boolean | MapImageLineStyle;
        transparent?: boolean;
    }

    Hierarchy (View Summary)

    Index

    Properties

    scale?: number

    Pixels per world unit. Default: 4. Controls output resolution.

    padding?: number

    Padding in pixels on each side. Default: 2.

    background?: string

    CSS color string for cells with unknown terrain indices. Default: '#1a1a1a'.

    type?: "image/png" | "image/jpeg" | "image/webp"

    Output MIME type. Default: 'image/png'. Ignored by drawMapImage.

    quality?: number

    JPEG/WebP quality 0–1. Default: 0.92. Ignored for PNG and by drawMapImage.

    elevationShading?: number

    Darken or lighten cells based on elevation. Each elevation step multiplies brightness by this factor (>1 = lighter, <1 = darker). Default: 0 (disabled).

    fog?: FogData

    Fog-of-war data to apply. When provided, cells are shaded by visibility state. Use fogDimOpacity and fogHideUnexplored to control how fog is drawn.

    fogDimOpacity?: number

    Opacity of the black overlay drawn over explored-but-not-currently-visible cells. 0 = no dimming, 1 = fully black. Default: 0.5. Has no effect without fog.

    fogHideUnexplored?: boolean

    If true, cells that have never been explored are rendered solid black. Default: false. Has no effect without fog.

    cellTint?: (col: number, row: number) => string | null | undefined

    Per-cell overlay color, painted over the terrain fill. Return a CSS color (use rgba(...) to tint rather than replace) or null to leave the cell alone. This is the hook for anything the map itself doesn't describe — territory ownership, resource highlights, a selection.

    Called once per cell, so keep it cheap.

    rivers?: boolean | MapImageLineStyle

    Draw river channels as lines through each cell. Default: false.

    roads?: boolean | MapImageLineStyle

    Draw roads as lines through each cell. Default: false.

    transparent?: boolean

    Clear the canvas to transparent before drawing instead of filling it with background. Default: false. Only meaningful for drawMapImage.