home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.x
- Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!jvnc.net!news.edu.tw!sparc4.ncu.edu.tw!imux120!u438813
- From: u438813@imux120.ncu.edu.tw (Lin Wei-Ting)
- Subject: Why the program cannot work?
- Message-ID: <1992Dec14.112849.21727@sparc4.ncu.edu.tw>
- Sender: news@sparc4.ncu.edu.tw
- Reply-To: u438813@imux120.ncu.edu.tw
- Organization: Sun Microsystems, Inc.
- Date: Mon, 14 Dec 1992 11:28:49 GMT
- Lines: 42
-
-
- /*******************/
-
- void
- inverse(item, event)
- Panel_item item;
- Event *event;
- {
- t_window1_objects *ip = (t_window1_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
- unsigned long p1,p2;
- int y;
- int lx,rx;
- int i,j;
- unsigned int k;
- width=xv_get(obj,CANVAS_WIDTH);
- height=xv_get(obj,CANVAS_HEIGHT);
- ximage=XCreateImage(theDisplay,theVisual,theDepth,ZPixmap,
- 0,0,width,height,8,0);
- ximage->data=(char *)malloc(sizeof(char)*width*height);
- ximage=XGetImage(theDisplay,xwin,0,0,width,height,AllPlanes,ZPixmap);
- for(i=0;i<height;i++)
- {
- data1=(char *)(ximage->data)+i*width;
- for(j=0;j<width/2;j++)
- {
- k=*(data1+j);
- *(data1+j)=*(data1+width-1-j);
- *(data1+width-1-j)=k;
- }
- }
- XPutImage(theDisplay,xwin,theGC,ximage,0,0,0,0,width,height);
- XFlush(theDisplay);
- free(data);
- XDestroyImage(ximage);
- XFlush(theDisplay);
- }
-
- /*******************/
-
- I want to flip an image horizontally.But the program cannot work.Why?
- Thanks a lot.
-
-