From: hellbaron Subject: Help with graphix negative image fractal function Newsgroups: comp.os.msdos.djgpp Message-ID: <1e9b4e00.99c1804f@usw-ex0101-006.remarq.com> Lines: 36 Bytes: 1422 X-Originating-Host: 132.248.134.42 Organization: http://www.remarq.com: The World's Usenet/Discussions Start Here X-Wren-Trace: eEBlTUxVElgTCFFESQtPQFVbRGVNSxRUSlgBQEZZGVEcFE4TGlgbHx8VChEc Date: Thu, 30 Dec 1999 22:33:49 -0800 NNTP-Posting-Host: 10.0.2.6 X-Complaints-To: wrenabuse AT remarq DOT com X-Trace: WReNphoon3 946622930 10.0.2.6 (Thu, 30 Dec 1999 22:48:50 PST) NNTP-Posting-Date: Thu, 30 Dec 1999 22:48:50 PST To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I am in the process of learning how to use c properly, and i am working on a fractal project but i am having trouble developing a function that displays a negative rectangle over a specified area. I am working on a 640x480x8bit graphic environment for the fractal, and the idea was to create a negative rectangle over the fractal that could then be erased simply by placing another one over it.. I hope you understand the concept, its quite simple actualy, well anywayz, here is the function, I await impaciently for your helpful feedback, thanx in advance to anyone who reads this... void xrectf(int x1, int y1, int x2, int y2) { int x, y, px, py, c1, swap; int xrectf[ABS(x2-x1)][ABS(y2-y1)]; if (x1>x2) {swap=x1;x1=x2;x2=swap;} if (y1>y2) {swap=y1;y1=y2;y2=swap;} for (x=x1, px=0; x<(x2+1); x++, px++) for (y=y1, py=0; y<(y2+1); y++, py++) xrectf[px][py]=getpixel(x, y); for (x=x1, px=0; x<(x2+1); x++, px++) for (y=y1, py=0; y<(y2+1); y++, py++) { c1=xrectf[px][py]+128; if (c1 > 255 ) c1 -= 256; putpixel(x, y, c1); } } * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network * The fastest and easiest way to search and participate in Usenet - Free!