From eef55f71b3f6f76eefef6c9ae4bdea9644dfca59 Mon Sep 17 00:00:00 2001 From: Amy Bowersox Date: Tue, 10 Dec 2019 13:04:24 -0700 Subject: [PATCH] added a script to test clipping of drawn lines --- scripts/test_clipping.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 scripts/test_clipping.py diff --git a/scripts/test_clipping.py b/scripts/test_clipping.py new file mode 100755 index 0000000..bdbba35 --- /dev/null +++ b/scripts/test_clipping.py @@ -0,0 +1,23 @@ +# Test of line clipping +import upiwin + +hdc = upiwin.DevCtxt(type='screen') +hdc.text_color = 0xFFFFFF # white +hdc.rectangle(100, 100, 199, 199) + +clip = hdc.get_clip_rect() +hdc.set_clip_rect(100, 100, 200, 200) + +hdc.text_color = 0xFF0000 # red +hdc.move_to(0, 200) +hdc.line_to(200, 0) + +hdc.set_clip_rect(clip[0], clip[1], clip[2], clip[3]) + +msg = {} +while upiwin.get_message(msg): + if msg['message'] == upiwin.WM_HWBUTTONUP: + bn = msg['attrs'][0] + if bn == 4: + print("Quitting the application.") + upiwin.post_quit_message(0)