Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!brutus.cs.uiuc.edu!ux1.cso.uiuc.edu!tank!cps3xx!flynn From: flynn@pixel.cps.msu.edu (Patrick J. Flynn) Newsgroups: comp.sys.next Subject: Direct access to screen pixels Message-ID: <5963@cps3xx.UUCP> Date: 9 Jan 90 19:32:05 GMT Sender: usenet@cps3xx.UUCP Reply-To: flynn@pixel.cps.msu.edu (Patrick J. Flynn) Organization: Pixels from Hell Lines: 47 WARNING: fooling around with the system can cause serious problems. Now that the faint-hearted are scared away... Here's some code which allows one to abuse the screen pixels directly. As written, it saves the screen in a buffer, fills it with random texture, and then restores the contents of the screen from the buffer. See for the ioctl codes and cAPitAliZeD constants. Note that the NeXT screen is advertised as 1120x832, but seems to be laid out in memory as 1152x910. Hmm, I wonder where the 1152 came from... :-). Disclaimer: this was a ten-minute hack. Any or all of the info in the preceding paragraph could be wrong. Don't blame me if your cube's magnesium case catches on fire when you try this. Also, don't laugh too hard at my C coding style. -------------------------------------------------- #include #include #include #define NPIX VIDEO_MW*VIDEO_H main() { char *addr; /* base addr of video RAM */ char buf[NPIX/4]; int fd,i; fd=open("/dev/vid0",O_RDWR,0); /* get video ram base addr. */ if (ioctl(fd, DKIOCGADDR, &addr) == -1) perror("ioctl:DKIOCGADDR"); /* save the screen */ bcopy(addr,buf,NPIX/4); /* stomp all over the screen */ for(i=0;i