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


--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
[]) 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
	id AA10534; Wed, 18 May 94 18:52:35 -0400
Received: from news.cambridge.apple.com by brazil.cambridge.apple.com with SMTP
	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
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