Generic FunctionPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.2
Unrevised from 8.1 to 8.2.
8.1 version


Arguments: graphical-stream

Returns the current paint operation of the specified stream, which should be a graphical-stream. The value may be changed at any time by calling (setf paint-operation) or with-paint-operation. The initial paint operation of any graphical-stream is po-replace.

A paint operation determines how the colors of new content that is being drawn are combined with the current colors of the stream's pixels to determine the final colors that will appear.

A paint operation value should be the value of one of the following constants: po-replace, po-paint, po-xor, po-invert, po-fill, po-erase, and po-and. Here is an example that uses several of them:

(in-package :cg-user)

(let* ((frame (make-window :paint-operations
                :class 'bitmap-window
                :exterior (make-box-relative 100 200 300 300)))
       (pane (frame-child frame)))
  ;; Starting out with a black background is handy for 
  ;; some paint operations.
  (with-background-color (pane black)
    (clear-page pane))
  ;; Draw a basic red block using the default po-replace operation.
  (with-foreground-color (pane red)
    (fill-box pane (make-box 40 40 200 200)))

  ;; Use po-paint to merge part of a dark-green block
  ;; with part of the red block.
  (with-paint-operation (pane po-paint)
        (pane (make-rgb :red 60 :green 130 :blue 40))
      (fill-box pane (make-box 100 100 240 240))))
  ;; Use po-erase to draw an upper line that erases redness.
  (with-line-width (pane 7)
    (with-foreground-color (pane red)
      (with-paint-operation (pane po-erase)
        (draw-line pane (make-position 0 0)
                   (make-position 300 300)))
      ;; And finally use po-and to draw a lower line that
      ;; erases all color EXCEPT redness.
      (with-paint-operation (pane po-and)
        (draw-line pane (make-position 0 0)
                   (make-position 300 400))))))

Copyright (c) 1998-2016, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.1 page.
Created 2010.1.21.

Allegro CL version 8.2
Unrevised from 8.1 to 8.2.
8.1 version