Text at arbitrary angles
Hi all,I find that under some conditions the text is prevented from being displayed as a result of prior drawing commands and clipping regions that somehow get established. If I open up the clipping region in the C code, then it disrupts the behavior of subsequent Capi drawing commands, even if I attempt to save and restore the prior bounds.
It appears that any modifications made in Lisp with GP graphics state commands are lazy. They don't actually have any effect until or unless some subsequent GP drawing command needs these state changes. The GP appears to memoize the current graphics state, and so any changes to the *same* state value also seem to have no effect. (Am I wrong about this?)
So the fix seems to be:
1. Use GP:WITH-GRAPHICS-STATE on the pane, before calling the ADD-LABEL C-interface function that I provided. In that graphics state command, be sure to use a :MASK argument to create a clipping region appropriate for your requirements.
2. Immediately after the call to WITH-GRAPHICS-STATE, issue a dummy graphics operation, like (GP:DRAW-LINE -1 -1 -2 -2), which won't show up anywhere on the screen. This is needed because, it appears, the WITH-GRAPHICS-STATE alteration of the clipping region is a lazy operation that won't be performed unless some GP operation actually needs to use it.
3. Now you can call my ADD-LABEL routine and text output will work just fine.
Example:
(gp:with-graphics-state (pane
:mask (list 0 0 (gp:port-width pane) (gp:port-height pane)))
(gp:draw-line -1 -1 -2 -2) ;; force the clipping region
(add-label "Hello World!" 10 10 :angle 45))
This example opens up the clipping region to the entire pane. Use other masks to clip to subregions of the pane.
David McClain
Chief Technical Officer
Refined Audiometrics Laboratory
4391 N. Camino Ferreo
Tucson, AZ 85750
email: dbm@refined-audiometrics.com
phone: 1.520.390.3995
Skype: dbmcclain