C/C++
putimage()

#include <graphics.h>

void farputimage()


int left
int top
const void far *bitmap
int op



. getimage() . bitmap , . , .

op . graphics.h .

enum putimage_ops {
    COPY_PUT,    //MOV
    XOR_PUT,    //XOR
    OR_PUT,        //OR
    AND_PUT,    //AND
    NOT_PUT        //NOT
};

.

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <alloc.h>

void save_screen(void far *buf[4]);
void restore_screen(void far *buf[4]);
int maxx,maxy;

int main(void)
{
    int graphdriver = DETECT, gmode, errorcode;
    void far *ptr[4];

    /*  */
    initgraph(&graphdriver,&gmode,"");
    errorcode = graphresult();
    if(errorcode != grOk)  /*   */
    {
        printf(" :%s\n",grapherrormsg(errorcode));
        printf("    \n");
        getch();
        exit(1);  /*     */
    }
    
    maxx = getmaxx();
    maxy = getmaxy();

    /*     */
    rectangle(0,0,maxx,maxy);
    line(0,0,maxx,maxy);
    line(0,maxx,maxy,0)
    
    save_screen(ptr);    // 
    getch();
    cleardevice();        // 
    restore_screen(ptr);    // 
    getch();

    closegraph();
    return 0;
}

void save_screen(void far *buf[4])
{
    unsigned size;
    int ystart=0,yend,yincr,block;
    yincr = (maxy+1)/4;
    yend = yincr;
    size = imagesize(0,ystart,maxx,yend);    //   
    for(block = 0; block<=3; block++)
    {
        if(buf[block] = farmalloc(size))== NULL)
        {
            closegraph();
            printf("!      \n");
            exit(1);
        }
        getimage(0,ystart,maxx,yend,buf[block]);
        ystart = yend+1;
        yend += yincr+1;
    }
}
void restore_screen(void far *buf[4]);
{
    int ystart=0,yend,yincr,block;
    yincr = (maxx+1)/4;
    yend = yincr;
    for(block=0;block<=3;block++)
    {
        putimage(0,ystart,buf[block],COPY_PUT);
        farfree(buf[block]);
        ystart = yend+1;
        yend += yincr+1;
    }
}








Нет комментариев.



Оставить комментарий:
Ваше Имя:
Email:
Антибот: *  
Ваш комментарий: