Drawing rule not initialized in segment

From Liberty BASIC Family
Jump to navigation Jump to search

Description

When graphics are redrawn from a stored segment, the drawing rule may be different from what it was when they were originally drawn.

Example code to demonstrate the bug.

Run this program and either minimize/maximize the window or cover it with another window and uncover it again. The circle should remain white but changes to blue when redrawn from the flushed segment:

    nomainwin
    open "Rule bug" for graphics_nsb as #w
    #w "trapclose [quit]"
    #w "fill blue; down; home"
    #w "circlefilled 100 100"
    #w "flush"
    #w "rule xor"
    wait

[quit]
    close #w
    end

Example code to work around the bug.

Add an explicit rule over which will be stored in the segment. This has no effect on the graphics when originally drawn but causes them to be redrawn correctly, even if the rule has subsequently been changed:

    nomainwin
    open "Rule bug" for graphics_nsb as #w
    #w "trapclose [quit]"
    #w "fill blue; down; home; rule over"
    #w "circlefilled 100 100"
    #w "flush"
    #w "rule xor"
    wait

[quit]
    close #w
    end