Skip to content
Vadim Grigoruk edited this page Nov 22, 2026 · 1 revision

paint(x, y, color, bordercolor=-1)

Parameters

  • x, y : coordinates of the pixel where the fill starts
  • color : the index of the color in the palette that will be used to fill the area; see fill patterns
  • bordercolor : an optional color index the fill stops at. -1 (default) fills the whole contiguous area of the starting pixel's color

Description

This function fills a contiguous area with a new color — the paint-bucket tool of the code layer. Without bordercolor, every pixel connected to (x, y) that has the same color as (x, y) is replaced. With bordercolor, the fill spreads until it reaches a pixel of that color, which lets you fill an area enclosed by an outline.

Calling paint on a screen coordinate outside 0..239 / 0..135 does nothing.

Example

function TIC()
    cls(0)

    -- an outlined area
    circb(60, 68, 40, 12)
    circb(60, 68, 30, 12)

    -- fill the ring between the two circles with color 4
    paint(60, 68 + 35, 4, 12)

    -- a plain flood fill
    rectb(140, 30, 60, 60, 11)
    paint(170, 60, 9)
end

Home
Tips for newcomers

Built-in Editors

Code | Sprites | Maps | SFX | Music

Console

All commands

save | export | load | import | menu | config | surf | shelf | demo | eval 

Platform

RAM | VRAM | Display | Palette | Bits per Pixel (BPP) | .tic Format | Supported Languages

Other

Tutorials | Code Snippets | Libraries | External Tools | FFT


API

All API functions

Callbacks

TIC | BOOT | MENU | BDR

  • SCN (deprecated)
  • OVR (deprecated)

Input

btn | btnp | btnr | key | keyp | keyr | mouse

Drawing

circ | circb | clip | cls | elli | ellib | font | line | map | paint | pix | print | rect | rectb | rrect | rrectb | spr | tri | trib | ttri | fill patterns

Sound

music | sfx | FFT | VQT

Memory

memcpy | memset | mget | mset | peek | poke | pmem | sync | vbank

System

exit | reset | time | tstamp | trace

Clone this wiki locally