Path: chuka.playstation.co.uk!news From: Alex Herbert Newsgroups: scee.yaroze.programming.2d_graphics Subject: Re: How do I manipulate Pixels? Date: Mon, 10 Aug 1998 17:11:18 +0000 Organization: PlayStation Net Yaroze (SCEE) Lines: 45 Message-ID: <35CF1BA6.F9EAFFD4@ndirect.co.uk> References: <6qfcml$ldg12@chuka.playstation.co.uk> <35CB6109.CA39FA19@scee.sony.co.uk> <35cb9524.1641258@news.playstation.co.uk> Reply-To: aherbert@ndirect.co.uk NNTP-Posting-Host: dialin2-56.ndirect.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.04 [en] (Win95; I) > I was playing with this sort of thing myself recently. The way I found > to muck about at the pixel level was something like the following ( > and no it's not optimised .... ). This is for a 320 * 256 screen and > doesn't take double buffering into account.... > > // Code starts > > unsigned long screen[320*256]; > > RECT scr; > > register int i; > > scr.x = 0; > scr.y = 0; > scr.w = 320; > scr.h = 256; > > for( i = 0; i < 320 * 256; i++ ) > { > screen[i] = rand()%2; > } > > LoadImage( &scr, screen ); > > // Code ends > > Obviously it can be a lot more efficient.........But you should get > the idea....... > > Richard. > http://www.netyaroze-europe.com/~rcutting Sounds like a nice way to do it. I think screen[] should be unsigned short as a pixel is 16-bits wide, not 32. And the rand()%2 would actually create very dark coloured static (can't remember whether R,G or B is in the lower 5 bits). rand()&0x7fff would produce multi-coloured static, but you'd have to match the RGB components for black/white static. But yeah, I get the idea... You've given me an idea... gotta go. :) Herbs