www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/01/09:21:39

From: Alex Lowe <ayin AT immediate DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: newbie bitmap question
Date: Thu, 31 Dec 1998 18:16:11 -0800
Organization: TempleCRC
Lines: 44
Message-ID: <368C2FEB.C9086137@immediate.net>
References: <368C4211 DOT 368399EE AT infoave DOT net> <368C2F07 DOT 502C5F06 AT immediate DOT net>
NNTP-Posting-Host: p111.stk1.2xtreme.net
Mime-Version: 1.0
X-Mailer: Mozilla 4.5 [en] (Win98; U)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

SORRY SORRY SORRY... oops... made a mistake in the for loops... the
correction is below...


Alex Lowe wrote:
> 
> To plot the bitmap you need to load it...  Example:
>     BITMAP *mytest=load_bitmap("mytest.bmp",0);
> 
> then blit it to the screen with the blit() function... look it up in the
> allegro docs for syntax... Example:
> 
>     blit(mytest,screen,0,0,0,0,BitmapWidth,BitmapHeight);
> 
> For tiling just use some 'for' loops... Example:
> 
>     for(x=0;x<ScreenWidth/BitmapWidth;x+=BitmapWidth)
>         for(y=0;y<ScreenHeight/BitmapHeight;y+=BitmapHeight)
>             blit(mytest,screen,0,0,x,y,BitmapWidth,BitmapHeight);
THE ERROR IS WITH THESE ABOVE FOR LOOPS... the correction is here:

     for(x=0;x<ScreenWidth;x+=BitmapWidth)
         for(y=0;y<ScreenHeight;y+=BitmapHeight)
             blit(mytest,screen,0,0,x,y,BitmapWidth,BitmapHeight);

Sorry about that.

> If your bitmap does not fit perfectly then you will end up with a gap on
> the right side of your screen... so you may need to have to loops blit
> one more extra to fill it in... by showing part of the bitmap...
> 
> That should take care of it... hope it helps..
> 
> -- Alex
> ayin AT immediate DOT net
> 
> James5 wrote:
> >
> > Hi all. Im new to C as well as DJGPP and need a bit of help with using
> > bitmap files. I'm writing small example progams to help me out as I go
> > along and was wondering, if I have a file called mytest.bmp.. how can I
> > plot the bmp on the screen (anywhere will do), and make another program
> > to tile it on the screen (both using Allegro). Any help will be greatly
> > appreciated. :)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019