home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / windows / x / 16445 < prev    next >
Encoding:
Text File  |  1992-09-09  |  2.0 KB  |  56 lines

  1. Newsgroups: comp.windows.x
  2. Path: sparky!uunet!munnari.oz.au!metro!sunb!macnab!s8923098
  3. From: s8923098@macnab.mqcs.mq.oz.au (Josef WIDJAJA)
  4. Subject: Re: XPutPixel and and XGetPixel and image layout
  5. Message-ID: <1992Sep10.023821.12479@mailhost.ocs.mq.edu.au>
  6. Sender: news@mailhost.ocs.mq.edu.au (Macquarie University News)
  7. Nntp-Posting-Host: macnab.mpce.mq.edu.au
  8. Organization: Macquarie University, School of Mathematics, Physics, Computing and Electronics
  9. References: <VICTOR.92Aug31135453@terse4.watson.ibm.com> <1992Sep4.085202.17533@thunder.mcrcim.mcgill.edu> <1992Sep9.130723.9938@city.cs>
  10. Date: Thu, 10 Sep 1992 02:38:21 GMT
  11. Lines: 43
  12.  
  13. In article <1992Sep9.130723.9938@city.cs> lionel@cs.city.ac.uk (Lionel Tun) writes:
  14. |Re: The discussion about using images directly rather than going
  15. |    through XPutPixel.
  16. |
  17. |I also would like to simply load the raw data into an array and
  18. |display it in a window - simple no?
  19. |
  20. |I tried the following but got structured garbage instead of my
  21. |graphic:
  22. |
  23. |    xi = XCreateImage(display, DefaultVisual(display, screen_num),
  24. |        1, XYBitmap, 0, image, width, height, 8, 0);
  25.                                 ^^^^^
  26. Make sure image is a pointer to or an array of char. I personally
  27. think that it can be easily confused with a pointer to XImage.
  28.  
  29.  
  30. |
  31. |    XPutImage(display, win, gc, xi, 0,0, 0,0, width, height);
  32.                                    ^^^^
  33.  
  34. Before you do XPutImage you will want to assign xi->data to point 
  35. to image. You should have:
  36.  
  37.        xi->data = image;
  38.        XPutImage(....etc...);
  39.  
  40. Other than that, I can't see anything wrong with your code. The fact
  41. that you got 'structured' garbage probably indicates that there is nothing
  42. wrong with your code above, you probably did not manipulate the image data
  43. correctly. 
  44.  
  45.  
  46. |
  47. |image is an array holding the data
  48. |the platform is a b+w Sun 4 running OpenWindows
  49. |
  50.  
  51. --
  52.  _________Josef Widjaja____________  
  53. |  s8923098@mackay.mpce.mq.edu.au  |
  54. |  Macquarie University, Australia | 
  55. |__________________________________| 
  56.