Path: utzoo!attcan!uunet!husc6!bloom-beacon!NRL-AIC.ARPA!schultz From: schultz@NRL-AIC.ARPA (Alan Schultz) Newsgroups: comp.windows.x Subject: Question on creation on gc's Message-ID: <8805252012.AA20876@nrl-aic.arpa> Date: 25 May 88 20:12:17 GMT Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 35 I am using CLX and have the following question. I have a lot of graphics functions that get called often. In each function, I create a graphics context as needed, and assign it to a temporary variable. Example: (defun some-simple-graphics-primitive (x y color) (let ((gc (create-gcontext :drawable *window* :foreground color))) (draw-rectangle *window* gc x y *width* *height*)) ) This is oversimplified, but the basic creation of gc's is demonstrated. I read in the Xlib manual that gc's are valuable resources, and I also see that primitives exist in CLX for manipulating gc's that already exist. QUESTION: Is the above expensive? Or since the gc is assigned to a temporary variable, is it freed up after the function returns? I have MANY such functions that get called OFTEN. Is it better to create one gc at the top level, and then modify it as necessary, or is the above ok? Also, is one approach better for time efficiency? Thanks, Alan C. Schultz Code 5510 Navy Center for Applied Research in Artificial Intelligence (NCAR A I) Naval Research Laboratory Washington, D.C. 20375-5000 ARPA: schultz@nrl-aic.arpa (202) 767-2877