Re: Can't invoke gp functions on output panes
"David McClain (as dbm at refined-audiometrics dot com)" <[email protected]>
| Newsgroups | gmane.lisp.lispworks.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Yuri, Yes, these work, but only from the CAPI thread. You must never draw directly on the output port unless you are CAPI. They must be called from redraw routines that execute from within the CAPI thread. > On Feb 2, 2025, at 07:31, Yuri Davidovsky (as work at disclosure dot ie) <[email protected]> wrote: > > I may be doing something wrong, but not sure what it could be. For some reason calling functions from the graphics-ports package does not seem to work on output panes on my machine. This is the boilerplate functionality that I have used many times before (although it has been a while since and it was on windows), but suddenly it is not working on macos. Have a look at a quick screencast I made (it may be difficult to believe otherwise): > > https://www.disclosure.ie/public/draw-line.mp4 > > Basically, what happens is that I am trying to create an empty output pane in a fresh instance of LW, store it in a variable and then try to do something with it, like drawing a line. > > > CL-USER 5 > (setf a (capi:contain (make-instance 'capi:output-pane))) > #<CAPI:OUTPUT-PANE 80101A14DB> > > CL-USER 6 > (gp:draw-line a 0 0 100 100) > > > At that stage it bales out with an error similar to > > > Error: Invoking a method "graphicsPort" on a null pointer. > 1 (abort) Return to top loop level 0. > > Type :b for backtrace or :c <option number> to proceed. > Type :bug-form "<subject>" for a bug report template or :? for other options. > > CL-USER 7 : 1 > :b > Call to INVOKE-DEBUGGER > Call to ERROR > Call to OBJC::INVOKE-INTO* > Call to GRAPHICS-PORTS::SET-GP-COCOA-NSCONTEXT > Call to GRAPHICS-PORTS::ENSURE-GP-REPRESENTATION-CGCONTEXT > Call to (METHOD GRAPHICS-PORTS::%LOAD-GRAPHICS-STATE-WITH-ARGS (GRAPHICS-PORTS::GP-COCOA-MIXIN T T T T)) > Call to GRAPHICS-PORTS:DRAW-LINE > Call to EVAL > Call to CAPI::CAPI-TOP-LEVEL-FUNCTION > Call to CAPI::INTERACTIVE-PANE-TOP-LOOP > Call to MP::PROCESS-SG-FUNCTION > > > What could the problem be? It appears to happen with other gp functions too, like draw-text. Seems like it could be an issue with calling into the OS graphic shell library? The OS used is Sequoia 15.1.1 (24B91) > > A strange part is that I also tried to load one of the capi examples > > (cached-display.lisp in "/Applications/LispWorks 8.0 (64-bit)/Library/lib/8-0-0-0/examples/capi/output-panes/cached-display.lisp”) > > and it worked fine, meaning it displayed a pane with a grid in the background and the arrow could be drawn in it when dragging the mouse, however when I tried to do the same with the pane that was created by this example code (meaning, drawing a line from the listener), it produced the same outcome as above. Very puzzling. > > Any ideas? >