invalidate-rectangle

Generic Function

Summary

Invalidates the rectangle associated with the object, which causes it to be redisplayed.

Package

graphics-ports

Signature

invalidate-rectangle
object
&optional
x
y
width
height
=>
result

Arguments

object

An instance of a subclass of
graphics-ports-mixin
or a subclass of pinboard-object.

x

A real number.

y

A real number.

width

A real number.

height

A real number.

Values

result

A boolean.

Description

By default, the generic function
invalidate-rectangle
invalidates the whole rectangle, but this can be limited by passing the optional arguments.

The effect of invalidating an area is to cause the area to be redrawn. It has no effect on pixmap-port. When the pane has a supplied
display-callback
, this callback is called with an area containing the area specified by the argument to
invalidate-rectangle
. However, the call to
display-callback
is asynchronous, and the system coalesces areas from calls to
invalidate-rectangle
and actual expose events, so there is not a one-to-one relation between calls to
invalidate-rectangle
and invocations of
display-callback
.

In general,
invalidate-rectangle
should not be called inside the
display-callback
. If it is called, it must be conditional, otherwise this will cause repeated redisplay.

Notes

With
drawing-mode
:quality
, drawings are done with anti-aliasing, which means that they affect pixels which are not obviously part of the drawing. For example, drawing a rectangle with
x
= 10 may affect the pixel at
x
= 9. This needs to be taken into account when computing the arguments to
invalidate-rectangle
.

For pinboard objects the recommended way of forcing redraw is redraw-pinboard-object, which takes anti-aliasing into account.