From: gautam AT interlog DOT com (Gautam N. Lad) Newsgroups: comp.os.msdos.djgpp Subject: Help with blitting/getimage/putimage! Date: Sun, 04 May 97 19:36:53 GMT Organization: InterLog Internet Services Lines: 66 Message-ID: <5kio86$gt7@news.interlog.com> NNTP-Posting-Host: ip220-118.cc.interlog.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Hi, Ok, I've finally gotten Mode 13 to initialize, and I now have the following functions/features: void PutPixel(int x, int y, int Colour); int GetPixel(int x, int y); // Returns colour that is at location x,y and SetPalette(int index, int r, int g, int b); I am also able to load and display 256-colour PCX image, so that's good. ;) What I want do now, is get a fragment of an image from a PCX image. The PCX image is an image that has all the Sprites I will need for my game, and what I want do now, is grab an image from the PCX. So, what I will do is display the image, grab a fragment (using x,y,width,height), and put it in a buffer. Then, later, I will blit the pointer to screen, at location X,Y. How do I do this?!? BTW, I'm using pure C for mode 13, and I would appreciate if you all don't tell me to use ASM. Why? Simple, my school's compiler doesn't have ASM, so there (and also 'cause I don't know ASM)! ;) BTW, Here are my functions: //------------------- Gautam N. Lad's Mode 13 snippet ------------------------ char *Screen; void PutPixel(int x, int y, int c) { Screen = (char *)MK_FP(0xA000,0x0000); Screen[x + (y<<8) + (y<<6)] = c; } int GetPixel(int x, int y) { Screen = (char *)MK_FP(0xA000,0x0000); return Screen[x + (y<<8) + (y<<6)]; } void SetColor(int index, int r, int g, int b) { outp(0x3c8,index); outp(0x3c9,r); outp(0x3c9,g); outp(0x3c9,b); } //------------------- Gautam N. Lad's Mode 13 snippet ------------------------ Another thing, here's what I want my blitting function to look like: GetImage(int x1, int y1, int x2, int y2, void *ImageBuffer); PutImage(int x, int y, void *ImageBuffer); Thanks! Bye! **************************************************** * Gautam N. Lad * *--------------------------------------------------* * * * E-Mail : gautam AT interlog DOT com * * Website : http://www.interlog.com/~gautam * * * * OS/2, DOS/Windows, Graphics Gallery, Software, * * Links, Rayzor Editor/2, POV-Ray, TexturEyes, * * POV-PAK and lots lots lots more!!!!!!! * ****************************************************