From: ··········@questions.com
Subject: Off-screen graphics port in Lispworks/Capi?
Date: 
Message-ID: <qvutht0i0p8qvtblcth5dc1ekkn5r5uvm1@4ax.com>
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?

From: Clive Tong
Subject: Re: Off-screen graphics port in Lispworks/Capi?
Date: 
Message-ID: <ur8wwu4ao.fsf@scientia.com>
··········@questions.com writes:

> 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?

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*)
From: ··········@questions.com
Subject: Re: Off-screen graphics port in Lispworks/Capi?
Date: 
Message-ID: <t4n8itsf3p4ri00vqoltvleme3399r434q@4ax.com>
On 07 Jun 2001 08:39:43 +0100, Clive Tong <··········@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?
From: Wade Humeniuk
Subject: Re: Off-screen graphics port in Lispworks/Capi?
Date: 
Message-ID: <9g2k9t$coj$1@news3.cadvision.com>
<··········@questions.com> wrote in message
·······································@4ax.com...
> On 07 Jun 2001 08:39:43 +0100, Clive Tong <··········@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?
>

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
From: Wade Humeniuk
Subject: Re: Off-screen graphics port in Lispworks/Capi?
Date: 
Message-ID: <9g2ksp$cv1$1@news3.cadvision.com>
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
From: Janis Dzerins
Subject: Re: Off-screen graphics port in Lispworks/Capi?
Date: 
Message-ID: <87hexsvl3j.fsf@asaka.latnet.lv>
··········@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.