home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / fj / maillis / xwindow / 17595 < prev    next >
Encoding:
Internet Message Format  |  1992-11-18  |  2.1 KB

  1. Path: sparky!uunet!stanford.edu!agate!netsys!pagesat!a2i!sgiblab!nec-gw!nec-tyo!wnoc-tyo-news!scslwide!wsgw!wsservra!daemon
  2. From: idf@cs.bham.ac.uk (Ian Fitchet)
  3. Newsgroups: fj.mail-lists.x-window
  4. Subject: The GC in XCopyPlane
  5. Message-ID: <1992Nov18.201738.6696@sm.sony.co.jp>
  6. Date: 18 Nov 92 20:17:38 GMT
  7. Sender: daemon@sm.sony.co.jp (The devil himself)
  8. Distribution: fj
  9. Organization: School of Computer Science, University of Birmingham
  10. Lines: 50
  11. Approved: michael@sm.sony.co.jp
  12.  
  13. Date: 13 Nov 92 02:30:05 GMT
  14. Message-Id: <IDF.92Nov13023005@fat-controller.cs.bham.ac.uk>
  15. Newsgroups: comp.windows.x
  16. Sender: xpert-request@expo.lcs.mit.edu
  17.  
  18. Hi,
  19.  
  20.     Being a pseudo-ignoramous I merrily copied the code from
  21. O'Reilly Vol4 involving XCopyPlane.  All was well until I actually
  22. tried the code out on a colour monitor (worked fine on a monochrome -
  23. the XCopyArea bit).  Well, after I realised I had changed the code so
  24. that it used a "copy_gc" instead of DefaultGCOfScreen() I took a
  25. further look.  My "copy_gc"  generated by:
  26.  
  27.   XGCValues values;
  28.   GC copy_gc;
  29.  
  30.   values.dashes = 1;
  31.   values.dash_offset = 0;
  32.   values.line_style = LineOnOffDash;
  33.   values.foreground = BLACK;
  34.   values.background = WHITE;
  35.  
  36.   copy_gc = XCreateGC(display,
  37.               pixmap,
  38.               GCForeground | GCBackground,
  39.               &values);
  40.   
  41.   differed in only two respects from the GC returned by
  42. DefaultGCOfScreen().  Firstly, it had a different gid (== GC id??) and
  43. secondly the values of foreground and background were reversed.
  44.  
  45.   When I invoked XCopyPlane with my GC I had a BadMatch error.  When I
  46. used the default everything was OK (but in reverse video :-().  What
  47. was worse was that I used XChangeGC to set them to my preferred way
  48. and the code then worked without error.
  49.  
  50.  I find this behaviour very bizarre and I am at a loss to explain the
  51. reason for the error.  Is the error strikingly obvious or am I just
  52. unlucky?
  53.  
  54. --
  55. Cheers,
  56.  
  57.     Ian
  58.  
  59. -------------------------------------------------------------------------------
  60. Ian Fitchet                           I.D.Fitchet@cs.bham.ac.uk
  61. School of Computer Science
  62. Univ. of Birmingham, UK, B15 2TT
  63.