maptile

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const MaxTileZoom = 5

MaxTileZoom is the highest zoom level for which we generate tiles server-side.

View Source
const SpritePixels = 32

SpritePixels is the native sprite resolution in the SPR file.

View Source
const SpriteZoomThreshold = 3

SpriteZoomThreshold is the zoom level at which sprite rendering begins. Below this, minimap colors (single floor, no stacking). At and above, actual sprites with floor stacking.

View Source
const TileSize = 256

Variables

This section is empty.

Functions

func BlendOver

func BlendOver(src, dst color.RGBA) color.RGBA

BlendOver performs alpha-over compositing of src over dst.

func BuildFloorStack

func BuildFloorStack(floor int) []uint8

BuildFloorStack returns the floor rendering order for sprite compositing.

func DrawSpriteScaled

func DrawSpriteScaled(dst *image.RGBA, src *image.RGBA, dstX, dstY, outW, outH int) bool

DrawSpriteScaled draws a sprite onto the output image with nearest-neighbor scaling.

func EncodePNG

func EncodePNG(img *image.RGBA) ([]byte, error)

EncodePNG encodes an RGBA image to PNG bytes using the shared buffer pool.

func From8Bit

func From8Bit(c uint8) color.RGBA

From8Bit converts an 8-bit Tibia minimap color index to RGBA. The color space uses a 6x6x6 color cube (216 colors).

func GameTilesForZoom

func GameTilesForZoom(zoom int) int

GameTilesForZoom returns how many game tiles one 256px tile covers at the given zoom.

Types

type Renderer

type Renderer struct {
	// contains filtered or unexported fields
}

Renderer produces 256x256 map tile PNGs. All methods are thread-safe (read-only access to shared data).

func NewRenderer

func NewRenderer(gameMap *otbm.GameMap, otb *otbm.OTB, dat *sprite.DatFile, spr *sprite.SpriteFile, g gpu.Renderer) *Renderer

func (*Renderer) GameMap

func (r *Renderer) GameMap() *otbm.GameMap

GameMap returns the underlying parsed map for metadata access.

func (*Renderer) RenderMinimapImage

func (r *Renderer) RenderMinimapImage(floor int, startX, startY, width, height int) *image.RGBA

RenderMinimapImage renders a minimap-colored image for the given tile data region. Useful for services that need an image.RGBA directly instead of PNG bytes.

func (*Renderer) RenderTile

func (r *Renderer) RenderTile(floor int, zoom, x, y int) (data []byte, err error)

RenderTile renders a 256x256 PNG tile at the given floor, zoom, and tile coordinates. Returns nil if the tile has no data (empty region).

Jump to

Keyboard shortcuts

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