From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: [Allegro3.0]Graphic question? Date: Tue, 9 Jun 1998 21:04:51 +0100 Organization: None Message-ID: References: <6ljdtv$en7 AT netnews DOT hinet DOT net> NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 50 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk (noname) writes: > 1. I set up graphic mode by using > set_gfx_mode(GFX_AUTODETECT, 640,480,640,960); > I use (0,0) to (639,479) is display page. > And (0,480) to (639,959) is active page. > But after I use VIRTUAL_H to check the virtual screen. > The value of VIRTUAL_H is 1638, which is not equal 960. But where is the problem? You got everything that you requested, and some more as well... From allegro.txt: When you call set_gfx_mode(), the v_w and v_h parameters represent the minimum size of virtual screen that is acceptable for your program. The range of possible sizes is usually very restricted, and Allegro is likely to end up creating a virtual screen much larger than the one you request. On an SVGA card with one megabyte of vram you can count on getting a 1024x1024 virtual screen (256 colors) or 1024x512 (15 or 16 bpp), and with 512k vram you can get 1024x512 (256 color). Other sizes may or may not be possible: don't assume that they will work. > 2. I have somewhere need use dash line, but I don't know > how to draw it by use Allegro 3.0 ? Allegro doesn't support dashed lines directly. You could fake a similar effect by using a pattered drawing mode with a suitable pattern bitmap, but that won't scale the dots properly along diagonal lines. Or you could use the do_line() function, and write your own callback routine (which has the same parameters as putpixel()) that will only actually drawn anything on every alternate call, or every third call, or whatever you need to make the pattern. > 3. I want reverse some display area, eg: > original: foreground-yellow, background-black > after reversing: > foreground-yellow, background-lightred color You could perhaps do this using an XOR drawing mode if you set up the palette in a suitable way, but the easiest approach would probably be to make a custom color mapping table, set draw_mode_trans(), and then draw a rectangle over the area that you want to invert. The color mapping table just lists the new values for each possible input color, so you can do whatever remapping you like with this. -- Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/ "Miracles are nothing if you've got the wrong intentions" - Mike Keneally