From: Ryan Blazecka Newsgroups: comp.os.msdos.djgpp Subject: Re: Problem with XOR (Allegro) Date: Mon, 27 Oct 1997 17:24:22 -0800 Organization: BCTEL Advanced Communications Lines: 48 Message-ID: <34553EC6.EA9@bc.sympatico.ca> References: <632dgn$o5m$2 AT news DOT interlog DOT com> Reply-To: eblazecka AT bc DOT sympatico DOT ca NNTP-Posting-Host: srry01m03-175.bctel.ca Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Gautam N. Lad wrote: > > Hi, > Ok, I've a palette in a Datafile, which I load up when my program runs. > The colours are defined so I don't have to use numbers. Like so: > > #define YELLOW 5 > #define WHITE 4 > #define XOR_ON xor_mode(-1); > #define XOR_OFF xor_mode(0); > > circle(screen, 100, 200, 5, YELLOW); > > Now, I have a problem. It seems that when I turn XOR enabled, the > colours value seem a bit differnet. What I mean is, if I draw using > YELLOW, the colour WHITE (index in palette of 4 in my case) get's used. > Is this how XOR works? Yes, this is exactly how it works. If xor mode is on, Allegro takes the destination pixel and the source pixel and combines them with an XOR operation, and puts that on the bitmap. In your case (XORing 5 with 0) should return 5, so perhaps color #5 isn't actually yellow. > I'm pretty sure, but I don't think it should change the colour I'm > drawing with. Now, this is on a background colour (index value of 0 in > palette), with nothing on it. Yes, it should. Except when you are drawing on color 0. > It seems the colour being used is one less then what I want. Maybe the indexes you are using are off by 1. What happens when you try to draw with color 6? > I do something like this: > > XOR_ON; > circle(screen, 100, 200, 5, YELLOW); > XOR_OFF; If what you really want is just a yellow circle, then leave xor_mode alone. In it's off state (the default), the color drawn it the one you pass to the drawing functions (not to mention it's much faster when drawing to the screen). -- [ Ryan Blazecka -- http://www.deninc.com/~corrosion/ ] [ _corrosion_ AT geocities DOT com OR eblazecka AT bc DOT sympatico DOT ca ]