[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

2376.0. "XOR and foreground color" by KAOU35::DLEROUX () Wed Feb 28 1990 11:55

    
    I have run into a small problem which I don't understand.
    
    I am trying to define an xor graphics context with the default
    foreground and background colors of the user but I don't get the
    results I anticipate.
    
    Here's what my code looks like:
    
    gcmask = GCFunction|GCLineWidth|GCBackground|GCForeground;
    gcvalues.line_width = 2;
    gcvalues.function = GXxor;
    get_something( draw_widget, DwtNforeground, value );
    				/* Does a XtGetValue */
    gcvalues.foreground = *value;
    get_something( draw_widget, DwtNbackground, value );
    gcvalues.background = *value;
    gcxor = XCreateGC( display, XtWindow( draw_widget ),
    			gcmask, &gcvalues );
    
    Then when I do my draw line routine of my small paint program it
    doesn't come out with the correct foreground color for the line.
    
    Thanks,
    		Dan
    
    
T.RTitleUserPersonal
Name
DateLines
2376.1draw_widget?LEOVAX::TREGGIARIWed Feb 28 1990 12:053
What type of widget is "draw_widget"?

Leo
2376.2Window widgetKAOU35::DLEROUXWed Feb 28 1990 13:226
    
    Sorry, draw_widget is a window widget.  Isn't that the only one which
    can do graphics?
    
    Dan
    
2376.3XorLEOVAX::TREGGIARIWed Feb 28 1990 16:2813
    
>    Sorry, draw_widget is a window widget.  Isn't that the only one which
>    can do graphics?
 
It's the only one built into the widget set that can do graphics.  I just
wanted to determine if it was a "custom" widget.

Is this on a monochrome system or multi-plane?  I'm not a Xor expert, but
I don't think you would get the exact same foreground color, unless the
pixels you are drawing over have a value of 0 (or foreground does),
since it "xor"s the pixel values.

Leo
2376.4How about black on background?KAOU35::DLEROUXThu Mar 01 1990 08:2912
    
    > ... I don't think you would get the exact same foreground color ...
    
    That's what I was beginning to suspect. 
    How do I define a XOR GC with the user's background color and a black
    foreground?  I tried BlackPixel as the foreground color but the
    resultant color on the screen was not always black depending on the
    user's background color.
    
    
    Dan
    
2376.5Paint does it.KAOU35::DLEROUXThu Mar 01 1990 09:2812
    
    rep 3.
    
    You were right when you said that I would only get the correct
    foreground color if the background color was 0 since "xoring" the pixel
    values affects the resultant color.
    
    But ... Paint does obtain the correct user background and foreground
    color.  Can anyone tell me how it does that?
    
    Dan
    
2376.6Solution!!KAOU35::DLEROUXThu Mar 01 1990 09:586
    
    For a solution to this problem check out note 706.1 in
    SHPLOG::DECWINDOWS_PROGRAMMING.
    
    Dan
    
2376.7Look at DECW$EXAMPLES:PLAIDDECWIN::ROSENBLUMFri Mar 02 1990 16:244
Also DECW$EXAMPLES:PLAID has the right sequence of events, it involves setting
the plane mask to the xor of the forground and background pixel values.

Mike