home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / windows / x / 20178 < prev    next >
Encoding:
Text File  |  1992-12-14  |  1.4 KB  |  54 lines

  1. Newsgroups: comp.windows.x
  2. Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!jvnc.net!news.edu.tw!sparc4.ncu.edu.tw!imux120!u438813
  3. From: u438813@imux120.ncu.edu.tw (Lin Wei-Ting)
  4. Subject: Why the program cannot work?
  5. Message-ID: <1992Dec14.112849.21727@sparc4.ncu.edu.tw>
  6. Sender: news@sparc4.ncu.edu.tw
  7. Reply-To: u438813@imux120.ncu.edu.tw
  8. Organization: Sun Microsystems, Inc.
  9. Date: Mon, 14 Dec 1992 11:28:49 GMT
  10. Lines: 42
  11.  
  12.  
  13. /*******************/
  14.  
  15. void
  16. inverse(item, event)
  17.     Panel_item    item;
  18.     Event        *event;
  19. {
  20.     t_window1_objects    *ip = (t_window1_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
  21.     unsigned long p1,p2;
  22.     int    y;
  23.     int    lx,rx;
  24.     int    i,j;
  25.     unsigned int k;
  26.     width=xv_get(obj,CANVAS_WIDTH);
  27.     height=xv_get(obj,CANVAS_HEIGHT);
  28.     ximage=XCreateImage(theDisplay,theVisual,theDepth,ZPixmap,
  29.                         0,0,width,height,8,0);
  30.     ximage->data=(char *)malloc(sizeof(char)*width*height);
  31.     ximage=XGetImage(theDisplay,xwin,0,0,width,height,AllPlanes,ZPixmap);
  32.     for(i=0;i<height;i++)
  33.         {
  34.         data1=(char *)(ximage->data)+i*width;
  35.         for(j=0;j<width/2;j++)
  36.             {
  37.             k=*(data1+j);
  38.             *(data1+j)=*(data1+width-1-j);
  39.             *(data1+width-1-j)=k;
  40.             }
  41.         }
  42.     XPutImage(theDisplay,xwin,theGC,ximage,0,0,0,0,width,height);
  43.     XFlush(theDisplay);
  44.     free(data);
  45.     XDestroyImage(ximage);
  46.     XFlush(theDisplay);
  47. }
  48.  
  49. /*******************/
  50.  
  51. I want to flip an image horizontally.But the program cannot work.Why?
  52. Thanks a lot.
  53.  
  54.