Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Off-screen graphics port in Lispworks/Capi?

4 views
Skip to first unread message

lispn...@questions.com

unread,
Jun 6, 2001, 11:58:35 PM6/6/01
to
The Capi manuals mention off-screen graphics ports, but don't seem to give
any details of how to create them and how to use them. Can I put pixels in
one at high speed and then blit it to a real window, thereby speeding it up
by orders of magnitude over trying to put the individual pixels on the real
window? Does anyone know where to get the details, or can anyone post any
examples?

Janis Dzerins

unread,
Jun 7, 2001, 2:51:28 AM6/7/01
to
lispn...@questions.com writes:

> Can I put pixels in one at high speed and then blit it to a real
> window, thereby speeding it up by orders of magnitude over trying to
> put the individual pixels on the real window?

Drawing pixels one by one is slow anyway (but drawing them on
offscreen area should be faster than drawing directly to the
screen). Blitting will also give you less flicker (or no flicker at
all).

Offscreen areas are very useful if they don't change much and are good
for fast background redrawing or tiles.

Can't comment on other questions at the moment.

--
Janis Dzerins

If million people say a stupid thing it's still a stupid thing.

Clive Tong

unread,
Jun 7, 2001, 3:39:43 AM6/7/01
to
lispn...@questions.com writes:

You can certainly blit from the off-screen port to a window.

See gp:with-pixmap-graphics-port, create-pixmap-port, destroy-pixmap-port

(in-package :cl-user)
(defparameter *a* (capi:contain (make-instance 'capi:output-pane)))
(defparameter *b* (gp:create-pixmap-port *A* 100 100 :clear t :background :yellow))
(gp:draw-line *b* 0 0 100 100 :foreground :red)
(gp:draw-circle *b* 50 50 25 :foreground :blue)
(gp:copy-pixels *a* *b* 0 0 100 100 0 0)
(gp:copy-pixels *a* *b* 100 100 100 100 0 0)
(gp:destroy-pixmap-port *b*)

lispn...@questions.com

unread,
Jun 11, 2001, 2:08:12 AM6/11/01
to
On 07 Jun 2001 08:39:43 +0100, Clive Tong <Clive...@scientia.com> wrote:

>See gp:with-pixmap-graphics-port, create-pixmap-port, destroy-pixmap-port

Thanks. That was what I was looking for. It wasn't obvious to me that a
pixmap port was off screen, and I was confused by the fact that it wanted a
pane too.

I'm also wondering if there is some way to quickly change all the pixels of a
pixmap port. For example, suppose I have a vector of 8-bit bytes, with each
three bytes being the RGB components for one pixel. What is the fastest way
to convert/copy such a vector into a pixmap port? Do I have to set the
graphics state and use draw-point, for each pixel? That is very slow, even
off-screen. Is there some much faster way?

Wade Humeniuk

unread,
Jun 11, 2001, 10:24:33 AM6/11/01
to

<lispn...@questions.com> wrote in message
news:t4n8itsf3p4ri00vq...@4ax.com...

The vector you need about is a bitmap (.bmp). Use the gp:draw-image routines
like before. You are going to have to figure out how tp create a bitmap on
the fly (if that is what you need) with its associated color map. Read in
an external bitmap and use cl:descibe to start to figure out its structure.
Creating bitmaps on the fly might be counter-productive, usually I just use
MS Paint.

Wade


Wade Humeniuk

unread,
Jun 11, 2001, 10:34:35 AM6/11/01
to
Another way may be to use gp:make-image-from-port getting the current image
from the port and then using (setf (aref... to change the values of the
pixels. Then use gp:draw-image to put it back. This way you also get the
color map for the pane at the same time.

It just takes programming.

Good Luck, Wade


0 new messages