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

NextPrevUpTopContentsIndex

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 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 keyword.

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 and the other arguments are passed to create-pixmap-port. The body is then evaluated. The port is destroyed when body returns.

The background and foreground default to the values in the graphics state of pane .

Example

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
Drawing - Graphics Ports


CAPI User Guide and Reference Manual (Windows version) - 3 Aug 2017

NextPrevUpTopContentsIndex