[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ccl:grafport-write-string & :patxor



At  1:20 PM 3/9/94 -0500, Christopher Fry wrote:
>I want to draw a string in a window, then erase it,
>leaving the window looking like it did before the draw.
>The below code attempts to do that and suceeds in
>drawing the string "text", but it is not erased.
>What am I doing wrong?
>
>
>(defparameter *win* (make-instance 'window))
>(with-focused-view *win*
>           (ccl::set-pen-mode *win* :patxor)
>           (move-to *win* 50 50)
>           (ccl:grafport-write-string  "test" 0 4)
>           (sleep 2)
>           (move-to *win* 50 50)
>           (ccl:grafport-write-string  "test" 0 4)
>           )
>
>
>CFry

The text drawing routines do not use the pen mode. They use the
mode that is encoded in the window's font information. The following
works for me:

(defparameter *win* (make-instance 'window))
(with-focused-view *win*
  (multiple-value-bind (ff ms) (view-font-codes *win*)
    (multiple-value-setq (ff ms) (font-codes :srcxor ff ms))
    (with-font-codes ff ms
      (move-to *win* 50 50)
      (ccl:grafport-write-string  "test" 0 4)
      (sleep 2)
      (move-to *win* 50 50)
      (ccl:grafport-write-string  "test" 0 4)
      )))

IM 1-171 claims that the pen mode for drawing text should be srcOr,
srcXor, or srcBic. I've noticed that some other modes work sometimes
(e.g. SrcCopy erases in Roman scripts), but graphics devices are only
required to support those three.