doug@zaphod.prime.com (01/06/89)
This is really a question about CLX and not Xlib. In CLX I cannot find a way to operate on a section of pixmap without uploading the bits, operating on them and then downloading the bits: (defmethod invert-area ((self drawable) x y width height &aux image-bits image) (setq image (get-image self :x x :y y :height height :width width)) (setq image-bits (xlib::image-x-data image)) (dotimes (i (length image-bits)) (setf (svref image-bits i) (logxor #xFF (svref image-bits i)))) (put-image self *gc* image :x x :y y)) Now this is clearly a braindamaged way to do this kind of thing which is pervasively needed to implement popup-menus, buttons, highlighting text, etc. Is there a better way? Does CLX provide it? Can an extension to CLX be easily done which handles this? Douglas Rand Internet: doug@zaphod.prime.com Usenet: primerd!zaphod!doug Phone: (508) - 879 - 2960 Mail: Prime Computer, 500 Old Conn Path, MS10C-17, Framingham, Ma 01701 -> The above opinions are mine alone. (well maybe *someone* agrees)
rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (01/06/89)
CLX is currently kinda hard to understand (due to lack of documentation) unless you are already familiar with X via some other path (the protocol spec or the Xlib manual). You need to look at the gcontext-function; setting it to boole-c2 and going normal graphics (e.g. a fill rectangle) will cause inversion. For more complex examples (cast in the context of C), check out the color tutorial in R3 in doc/tutorials/color.tbl.ms, also found as Chapter 7 in the O'Reilly Xlib book Volume 1.
janssen@titan.sw.mcc.com (Bill Janssen) (01/08/89)
In article <34700004@zaphod>, doug@zaphod writes: >This is really a question about CLX and not Xlib. In CLX I cannot find >a way to operate on a section of pixmap without uploading the bits, >operating on them and then downloading the bits: How about `copy-area'? (defun invert-area (SELF X Y WIDTH HEIGHT) (let ((Gc (xlib:create-gcontext :drawable SELF :function boole-c1)) ) (xlib:copy-area SELF Gc X Y WIDTH HEIGHT SELF X Y) (xlib:free-context Gc) )) Bill