added stock bitmap handling and support for it in the demo script

This commit is contained in:
Amy Bowersox
2019-12-11 14:03:11 -07:00
parent 51fda759cc
commit ed9fd9320c
5 changed files with 78 additions and 7 deletions

View File

@@ -6,7 +6,14 @@ WHITE = upiwin.rgb(255, 255, 255)
LTGRAY = upiwin.rgb(204, 204, 204)
YELLOW = upiwin.rgb(255, 255, 0)
# Get the stock bitmaps.
bmp_freehand = upiwin.Bitmap(stock='freehand')
bmp_line = upiwin.Bitmap(stock='line')
bmp_rect = upiwin.Bitmap(stock='rect')
bmp_fillrect = upiwin.Bitmap(stock='fillrect')
hdc = upiwin.DevCtxt(type='screen')
hdc_bits = upiwin.DevCtxt(type='memory')
# divide the screen into "drawing" and "command" areas
screen_rect = hdc.get_clip_rect()
@@ -100,6 +107,9 @@ hdc.rectangle(cmd2_rect[0], cmd2_rect[1], cmd2_rect[2], cmd2_rect[3])
hdc.rectangle(cmd3_rect[0], cmd3_rect[1], cmd3_rect[2], cmd3_rect[3])
hdc.rectangle(cmd4_rect[0], cmd4_rect[1], cmd4_rect[2], cmd4_rect[3])
hdc_bits.select_object(bmp_freehand)
hdc.bitblt(cmd1_rect[0] + 6, cmd1_rect[1] + 6, cmd1_rect[0] + 54, cmd1_rect[1] + 54, hdc_bits, 0, 0, 0)
# Main message loop
msg = {}
while upiwin.get_message(msg):