[A89] Re: filling ellipses
[Prev][Next][Index][Thread]
[A89] Re: filling ellipses
This is kinda what I was thinking about. A question, though: how do you XOR the VS onto the
LCD_MEM? (I've never tried anything with a VS before)
jeffrey
> First, use HeapAlloc() to reserve a chunk of memory the same size as the LCD
> memory (240/8*128 bytes, IIRC). Then use PortSet() to redirect the TIOS
> routines to draw to this new "virtual screen" (VS for short). Clear the VS.
> The use the TIOS ellipse routine to draw your ellipse on the VS, using solid
> black (not XOR).
>
> Then you can use a very simple routine to fill the ellipse. Start at the
> top row, and repeat for each row through the bottom row. Scan from
> left-to-right to find the leftmost set pixel, then scan from right-to-left
> to find the rightmost set pixel. Draw a solid black line (again, black, not
> XOR) connecting these two pixels, then move on to the next row. (Make sure
> that it doesn't screw up on blank rows, though.)
>
> When this is done, the VS will should your filled ellipse, in solid black,
> on an otherwise clear white screen. Now simply XOR the VS with normal LCD
> memory, and your filled ellipse will have been XOR'd onto the screen!
> Afterwards, be sure to use HeapFree() and PortRestore().
>
> If you want to draw a solid black ellipse to the screen, simply repeat this
> procedure but OR it onto the screen instead of XOR'ing. If you want a solid
> white ellipse, get the filled ellipse in the VS, then invert it (by XOR'ing
> every byte of the VS with 0xFF), and then AND it onto the screen.
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/
References: