{
"id": "fn-kanvas-refresh",
"dataComponent": "kanvas",
"heading": {
"title": "refresh",
"badges": ["Kanvas"]
},
"synopsis": "Refreshes (repaints) the Kanvas window, displaying any changes made by draw functions since the last refresh.",
"codeBlocks": [
"extend(\"kanvas\")\n\nwin = kanvas:create([ width: 320, height: 240, title: \"Demo\" ])\nkanvas:display(win)\n\n# Draw shapes, lines, pixels, etc.\nkanvas:rectangle(win, [[20,30],[100,60]], \"#00FF00\") # Draw green rectangle\nkanvas:pixel(win, [50, 50], \"#FF0000\") # Draw red pixel\nkanvas:triangle(win, [[10,10],[200,50],[50,100]], \"#FF00FF\")\n\n# Now update the window so all drawings appear\nkanvas:refresh(win)\n"
],
"notes": [
"Arguments:",
"- Window handle (returned by kanvas:create).",
"Call kanvas:refresh after one or more drawing operations (like kanvas:pixel, kanvas:rectangle, etc.) to display changes on the screen.",
"If you do not call refresh, the window may not visibly update, depending on platform or bridging implementation.",
"Does not return a value."
]
}