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

Re: Accessing individual pix



        Reply to:   RE>Accessing individual pixels
> Is there a better way to set individual pixels?

You can get the pixmap, access the baseAddr and rowBytes fields, and figure the
index of the pixel you're trying to access from that.  Then go in and do a
(put-long-word @ value).

OR ....

If it suits your application, it is TRIVIAL (but slower) to manipulate the
image as it appears in a window (and then save the image).  This is done using
the handy toolbox procedures:

  (#_GetCPixel i j rgb)
  (#_SetCPixel i j rgb)

-- Steve Casner



--------------------------------------
Date: 5/18/1994 3:58 PM
To: Steve Casner
From: Andrew Newell Mickish

I'm using Gworlds to render pixmap images in MCL (that is, pixmaps in the
sense of XPM files generated from X windows that describe all the pixels in
a given rectangle).  After I've set all the individual pixels in my offscreen
Gworld, I use CopyBits to copy them into a window.

I can't find any documentation about direct access to individual pixels in
my Gworld (or its "pixmap").  Currently, I am using the following kluge which
sets all the right pixels, but is probably quite wasteful because of its
repeated calls to PaintRectangle, when all I want to do is set one pixel:

    (ccl:without-interrupts
     (ccl::with-focused-gworld (new-image)
       (dotimes (h height)
         (dotimes (w width)
           (ccl:with-fore-color (aref pixarray h w)
             (ccl::with-rectangle-arg (r w h (1+ w) (1+ h))
               (#_PaintRect r)))))))

Is there a better way to set individual pixels?

Thanks,

--Andrew Mickish




------------------ RFC822 Header Follows ------------------
Received: by qmgate.arc.nasa.gov with SMTP;18 May 1994 15:58:17 U
Received: from brazil.cambridge.apple.com (brazil.cambridge.apple.com
[198.112.73.3]) by eos.arc.nasa.gov (8.6.4/8.6.4) with SMTP id PAA05689 for
<casner@eos.arc.nasa.gov>; Wed, 18 May 1994 15:56:36 -0700
Received: from ministry.cambridge.apple.com by brazil.cambridge.apple.com with
SMTP (5.64/25-eef)
	id AA19079; Wed, 18 May 94 18:56:05 -0400
	for casner@eos.arc.nasa.gov
Received: by cambridge.apple.com (5.64/25-eef)
	id AA10561; Wed, 18 May 94 18:52:43 -0400
Received: from brazil.cambridge.apple.com by cambridge.apple.com with SMTP
(5.64/25-eef)
	id AA10534; Wed, 18 May 94 18:52:35 -0400
Received: from news.cambridge.apple.com by brazil.cambridge.apple.com with SMTP
(5.64/25-eef)
	id AA19050; Wed, 18 May 94 18:52:13 -0400
	for info-mcl@ministry.cambridge.apple.com
Received: by news.cambridge.apple.com (5.64/A/UX-3.00)
	id AA09484; Wed, 18 May 94 18:51:02 PDT
To: info-mcl@ministry.cambridge.apple.com
Path:
news.cambridge.apple.com!news.media.mit.edu!grapevine.lcs.mit.edu!uhog.mit.edu!MathWorks.Com!news.duke.edu!news-feed-1.peachnet.edu!emory!swrinde!cs.utexas.edu!math.ohio-state.edu!cis.ohio-state.edu!news.sei.cmu.edu!bb3.andrew.cmu.edu!andrew.cmu.edu!am2q+
From: Andrew Newell Mickish <am2q+@andrew.cmu.edu>
Newsgroups: comp.lang.lisp.mcl
Subject: Accessing individual pixels
Date: Wed, 18 May 1994 15:31:45 -0400
Organization: Computer Science Department, Carnegie Mellon, Pittsburgh, PA
Lines: 27
Message-Id: <YhqaoVu00WB70DQEoW@andrew.cmu.edu>
Nntp-Posting-Host: andrew.cmu.edu