You are here: Lua Scripting Resources eGuide > Lua Scripting API Reference Guide > Platform Library > invalidate

14.7.2 invalidate

platform.window:invalidate(x, y, width, height)

This function invalidates a region of the window and forces it to repaint. x and y default to (0, 0) and width and height default to the pixel width and height of the window. The entire window can be forced to repaint with a call to platform.window:invalidate(), which allows all parameters to take their default values.

For performance reasons, especially for large screen resolutions, it is advisable to invalidate not all of the screen but the smallest possible region.

Caution

Please make sure for moving objects to invalidate both the old and the new location of the object. In addition, based on the selected pen setting of the graphics library, drawing lines and other shapes may draw to some degree outside of the specified area. The extent of this area around the specified area might vary in addition by platform. Therefore, add some additional space around the invalidate region to avoid drawing artifacts.


Invalidating multiple regions at a time might result in one or multiple calls to on.paint depending on the region and the platform. Therefore the implementation of on.paint should not make any assumptions about the region to draw, but always draw all of the screen.

Introduced in platform.apiLevel = '1.0'