Mail Archives: djgpp/1998/04/20/13:01:54
Message-ID: | <353B895B.BEDEE7A5@sprynet.com>
|
Date: | Mon, 20 Apr 1998 10:43:55 -0700
|
From: | Ishpeck <aTedjamulia AT sprynet DOT com>
|
Organization: | Lunaticnologies
|
MIME-Version: | 1.0
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | A cool thing...
|
NNTP-Posting-Host: | 192.41.92.81
|
Lines: | 24
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Some of you might remember me. I'm the guy who was trying to animate
a little man accross walking accross the "intricate backgroud"...
I figured it out. You see, I just made a function called getimage()
that is very similar to the getimage in Borland C++. Here it is, for
those of you who might need it in the future.
You just call it like this:
subbmp=getimage(screen, xlocation, ylocation, width , height)
xlocation and ylocation give the coordinates for the top-left
corner of the section you're going to copy. Width and height...
well, you get the idea. With this, you can copy a little rectangle
of the screen and store it into a bitmap. Great for animating things.
BITMAP *getimage(BITMAP *bmp2lookat, int x, int y, int w, int h) {
BITMAP *returnme;
int loopx, loopy;
for(loopy=0;loopy<=h;loopy++)
for(loopx=0;loopx<=w;loopx++)
putpixel(returnme, loopx, loopy, getpixel(bmp2lookat, loopx+x,
loopy+y));
return returnme;
} /* End getimage function */
- Raw text -