All Manuals > CAPI User Guide and Reference Manual > 22 GRAPHICS-PORTS Reference Entries

with-pixmap-graphics-port Macro

Summary

Binds a port to a new pixmap graphics port for the duration of the macro's code body.

Package

graphics-ports

Signature

with-pixmap-graphics-port (port pane width height &key background foreground collect relative clear drawing-mode) &body body => result

Arguments
port
A graphics port.
pane
An output pane.
width
An integer.
height
An integer.
background
A color specification, or nil.
foreground
A color specification, or nil.
collect
A boolean.
relative
A boolean.
clear
A list or t.
drawing-mode
One of the keywords :compatible and :quality.
body
A body of Lisp code.
Values
result
The return value of the last form executed in body.
Description

The macro with-pixmap-graphics-port binds port to a new pixmap graphics-port.

pane, width, height, background, foreground, collect, relative, clear AND drawing-mode are used as specified by create-pixmap-port. The forms in body are then evaluated as an implicit progn. port is destroyed when body returns.

Examples

In the code below the background in p2 inherits from p1, so it draws two green rectangles.

(let ((op (capi:contain
           (make-instance 'capi:output-pane
                          :background :red))))
  (sleep 0.1)
  (gp:with-pixmap-graphics-port (p1 op 20 30
                                    :background :green
                                    :clear t)
    (gp:with-pixmap-graphics-port (p2 p1 20 30 :clear t)
      (gp:copy-pixels op p1 10 10 20 30 0 0)
      (gp:copy-pixels op p2 10 60 20 30 0 0))))
See also

create-pixmap-port
13 Drawing - Graphics Ports


CAPI User Guide and Reference Manual (Macintosh version) - 01 Dec 2021 19:31:44