home *** CD-ROM | disk | FTP | other *** search
- 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
- From: idf@cs.bham.ac.uk (Ian Fitchet)
- Newsgroups: comp.windows.x
- Subject: The GC in XCopyPlane
- Message-ID: <IDF.92Nov13023005@fat-controller.cs.bham.ac.uk>
- Date: 13 Nov 92 02:30:05 GMT
- Sender: news@cs.bham.ac.uk
- Distribution: comp
- Organization: School of Computer Science, University of Birmingham
- Lines: 45
- Nntp-Posting-Host: fattie
-
- Hi,
-
- Being a pseudo-ignoramous I merrily copied the code from
- O'Reilly Vol4 involving XCopyPlane. All was well until I actually
- tried the code out on a colour monitor (worked fine on a monochrome -
- the XCopyArea bit). Well, after I realised I had changed the code so
- that it used a "copy_gc" instead of DefaultGCOfScreen() I took a
- further look. My "copy_gc" generated by:
-
- XGCValues values;
- GC copy_gc;
-
- values.dashes = 1;
- values.dash_offset = 0;
- values.line_style = LineOnOffDash;
- values.foreground = BLACK;
- values.background = WHITE;
-
- copy_gc = XCreateGC(display,
- pixmap,
- GCForeground | GCBackground,
- &values);
-
- differed in only two respects from the GC returned by
- DefaultGCOfScreen(). Firstly, it had a different gid (== GC id??) and
- secondly the values of foreground and background were reversed.
-
- When I invoked XCopyPlane with my GC I had a BadMatch error. When I
- used the default everything was OK (but in reverse video :-(). What
- was worse was that I used XChangeGC to set them to my preferred way
- and the code then worked without error.
-
- I find this behaviour very bizarre and I am at a loss to explain the
- reason for the error. Is the error strikingly obvious or am I just
- unlucky?
-
- --
- Cheers,
-
- Ian
-
- -------------------------------------------------------------------------------
- Ian Fitchet I.D.Fitchet@cs.bham.ac.uk
- School of Computer Science
- Univ. of Birmingham, UK, B15 2TT
-