home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sys / next / misc / 19302 < prev    next >
Encoding:
Internet Message Format  |  1992-09-07  |  2.4 KB

  1. Xref: sparky comp.sys.next.misc:19302 comp.sys.next.programmer:5988
  2. Path: sparky!uunet!olivea!decwrl!rosie!aozer
  3. From: aozer@next.com (Ali Ozer)
  4. Newsgroups: comp.sys.next.misc,comp.sys.next.programmer
  5. Subject: Re: looking at the bits in video frames (3.0 NeXT Dimension)
  6. Message-ID: <4917@rosie.NeXT.COM>
  7. Date: 1 Sep 92 15:22:00 GMT
  8. References: <1992Sep1.033025.7164@news.media.mit.edu>
  9. Sender: news@NeXT.COM
  10. Followup-To: comp.sys.next.misc
  11. Organization: Next Computer, Inc.
  12. Lines: 39
  13.  
  14. In article <1992Sep1.033025.7164@news.media.mit.edu> mike@media-lab.mit.edu writes:
  15. >The problem is this: when you grab the frame, you get an
  16. >image with representation NXCachedImageRep, which presumably
  17. >somewhere has a pointer to the raw image in NeXTDimension memory.
  18. >There are no methods to directly read this data, although you
  19. >can draw it out to another view.  I tried compositing the
  20. >NXCachedImageRep image into a newly allocated image with
  21. >an NXBitmapImageRep (a TIFF), but the latter was converted
  22. >to an NXCachedImageRep! ...
  23. >What I would like to do is simply get my hands on the pixel array
  24. >that underlies the NXCachedImageRep of a grabbed frame,
  25. >without copying and converting the whole frame.
  26.  
  27. First or all, there's no way to get a pointer to the bits in the
  28. frame buffer.
  29.  
  30. However, under 3.0 the process of reading images back from the
  31. window server is efficient enough such that if you use NXBitmapImageRep's
  32. initData:fromRect: method, you might get back what is essentially
  33. a vm_copy() of the window's backing store. To process the data you need
  34. to pay attention to the bitsPerPixel and bytesPerRow parameters of the
  35. NXBitmapImageRep.
  36.  
  37. Clients of NXReadBitmap() and 2.0 apps do not get back unpacked data;
  38. so for them the data might have to be packed after it's brought over
  39. from the window server. However, even in that case the process of reading
  40. images back is faster as the data is brought back out of line.
  41.  
  42. Now, on the NeXTdimension, the out of line data transfer always requires
  43. a copy over the bus, so the gain isn't as great, and it's not as if
  44. you are simply getting a pointer to the image data.
  45.  
  46. Going back to your question... One easy way to get a NXBitmapImageRep 
  47. from an NXImage is to lockFocus on the NXImage, and create a bitmap 
  48. image rep with initData:fromRect:. This is not the ideal in all cases, 
  49. but when the NXImage is basically a cached image, it works fine. And if
  50. the situation is right, the initData:fromRect: will be very fast.
  51.  
  52. Ali, Ali_Ozer@NeXT.com
  53.