home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / windows / x / 20490 < prev    next >
Encoding:
Internet Message Format  |  1992-12-22  |  3.4 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!ames!sun-barr!news2me.EBay.Sun.COM!seven-up.East.Sun.COM!marley.Eng.Sun.COM!ama
  2. From: ama@marley.Eng.Sun.COM (Al Amaral - SunSelect)
  3. Newsgroups: comp.windows.x
  4. Subject: Re: An Open Challenge (it can't be done!)
  5. Date: 22 Dec 1992 19:21:55 GMT
  6. Organization: Sun Microsystems Inc. - BDC
  7. Lines: 57
  8. Message-ID: <1h7psjINN192@seven-up.East.Sun.COM>
  9. References: <78716@hydra.gatech.EDU>
  10. NNTP-Posting-Host: marley.east.sun.com
  11. Keywords: xor cursors images biscuits
  12.  
  13. In article <78716@hydra.gatech.EDU> gt4417a@prism.gatech.EDU (SKELTON,JOEL PHILLIP) writes:
  14. >
  15. >Here's the short form:
  16. > - 8 bit image in backing pixmap used to update window
  17. > - Image drawn in 8 bit X window
  18. > - Want to draw diagonal lines on top of image that can
  19. >   be removed quickly (i.e. replace them with the data they so
  20. >   recently covered)
  21. > - Can't do server extensions (too many platforms to support)
  22. >Betcha can't do it!
  23. >Joel Skelton   --    North Avenue Trade School, Dept. of Round Things
  24.  
  25.  
  26. Hmmm, I used to work on a window system/machine which actually had such a
  27. mechanism in hardware.  We used it to draw our cursors.  It would draw a 
  28. stroked area, saving the pixels which were touched in offscreen memory.
  29. We could then redraw the stroked area, and replace the pixels which were 
  30. originally under the cursor.  Too bad it's not in X.
  31.  
  32. Anyway, I'll take a whack at this one.  I have no idea how fast this will be,
  33. it'll probably be terribly slow, but I think it can be done...  I know you
  34. said "Can't do server extensions", but I assume you mean new, custom, server
  35. extensions, not ones that probably already are supported on your servers.
  36.  
  37. What about using a shaped window as your stroked polygon, rather than lines.
  38. You would draw the lines into a bitmap, which would then be used as as a 
  39. ShapeMask for the Shape extension.  You could overlay the window with the
  40. shaped window, then copy the whole shaped source window into a pixmap.
  41. This should only copy the stroked areas.  You can then unmap the shaped
  42. window and draw the lines into the original window, or just clear the
  43. shaped window to a single color (whichever is faster).  To restore the
  44. graphics you just do another copy from the pixmap onto the shaped window.
  45.  
  46. Of course, with this method you'll havt to deselect expose events while
  47. you are doing this else you'll get tons of expose events when you reshape
  48. the shaped window.  You'll also probably be severly speed constrained by 
  49. how fast the server can turn the bitmap into clip regions as the shape
  50. of the polygon changes.
  51.  
  52. You should be able to do the same thing without the shape extension altogether
  53. as you have the pixels in a server pixmap already.  To restore you could just 
  54. draw the lines into a bitmap and use it for a clipmask in a GC and do a 
  55. copyarea.  This might actually be much faster, but again, you'll be 
  56. severely speed constrained by how fast the server can turn the clipmask 
  57. into a cliplist...  If only the clip mask were used directly, instead of 
  58. having to be turned into a bazillion little rectangles.
  59.  
  60. Given the amount of time each redraw will take using either of these methods
  61. you'll undoubtedly need to do some kind of motion event compression, as trying
  62. to draw with each new mouse position (assuming you're dragging the lines)
  63. will back up most servers quite badly...
  64.  
  65. Hope this helps.
  66.  
  67. --
  68. --------------------------------------------------------------
  69. Al Amaral                Al.Amaral@East.Sun.COM
  70.