home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / windows / x / 19282 < prev    next >
Encoding:
Internet Message Format  |  1992-11-18  |  1.9 KB

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