From: yorka AT dlc DOT fi (aYk) Newsgroups: comp.os.msdos.djgpp Subject: Re: Scanlines... any procedure or libraries out there(like allegro) Date: Fri, 26 Jun 1998 19:27:16 GMT Organization: Majik Lines: 80 Message-ID: <3593e9c4.10562618@news.dlc.fi> References: <3595b460 DOT 865825 AT news DOT dlc DOT fi> <1998062617263500 DOT NAA10188 AT ladder03 DOT news DOT aol DOT com> NNTP-Posting-Host: ccclxxxiv.kdyn.saunalahti.fi 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 On 26 Jun 1998 17:26:35 GMT, xsyphinex AT aol DOT com (XSyphineX) wrote: >>>Usually scanlines are referred to as rows of virtual pixels. What >>>exactly do you want to do? >> > >What i wanted to do was create a bitmap that displayed one line of another >bitmap, then blank line, the next line of a bitmape, then another blank line so >it would give the effect of a television. One line of bitmap then another of a >blank line. Well you answered your own question in that posting, it shouldn't be too hard to implement that kind of system. I can think of several different implementations, of which I will only cover two schemes as you will probably get the idea... 1) Just blit one line of the doublebuffer, then skip one line and blit the next one, then skip one line and blit the next one etc. You would of course need to increment the blitting target correspondingly. Here's a non-tested quick-hack C implementation (I am assuming you're using mode 13h, ie. 320x200 with 256 colors): #include #include void Blit(char *doublebuffer) { int i, j, address=0; for(j=0;j<100;j++) { for(i=0;i<320;i++)_farpokeb(_dos_ds,0xA0000+address+i,doublebuffer[address+i]); address += 640; } } I can't see why this wouldn't work... The only problem with this one is that if there is already image data on the screen, it will be preserved (where the black lines are), so it is recommended that you clear the screen before blitting. Of course you won't have to do it before each frame because the image data will be drawn on the same place for each frame. OR 2) You can fill every two lines of the doublebuffer with black horizontal lines and then blit it the way you would do it normally. Here's another non-tested quick-hack C-implementation: #include #include void Blit(char *doublebuffer) { int i; for(i=0;i<200;i+=2) { HLine(0,319,i,0,doublebuffer); // syntax is x1, x2, y, color, target } for(i=0;i<64000;i++) _farpokeb(_dos_ds,0xA0000+i,doublebuffer[i]); } The horizontal lines will make sure that no image data will be left on the screen. However, they are a major speed hit and they destroy the data in your doublebuffer. The first one is undoubtedly faster even though both routines are slooooooooowww (I'm using byte-sized transfers and passing the selector with each pixel). You should be able to derive a faster routine yourself. Personally I would use asm. - aYk - | Atte "Yorkaturr" Koivula - aYk - | | -------------------------------------- | | God of Evil | yorka AT dlc DOT fi | | Programmer | yorka AT newbies DOT net | | Graphician | yorkaturr AT majik DOT netti DOT fi | | -------------------------------------- | | Majik MURPE - http://majik.netti.fi |