import os,time,string import korg_draw ###################################################### # test ###################################################### def test(im): #im.offset( (50,10) ) im.line( (105,105,105), (10,30,190,30 ) ) im.line( (105,105,105), (10,40,190,40 ) ) # xy,wh rects im.rect_xywh( (255,255,255), None , (10,10,30,30 ) ) im.rect_xywh( (255,255,255), None , (15,15,30,30 ) ) im.rect_xywh( (255,255,255), None , (20,20,30,30 ) ) im.rect_xywh( (255,255,255), None , (25,25,30,30 ) ) im.rect_xywh( (255,255,255), None , (30,30,30,30 ) ) # xy,xy rectangles im.rect( (255,255,255), None , (60,10,80,30 ) ) im.rect( (255,255,255), None , (65,15,80,30 ) ) im.rect( (255,255,255), None , (70,20,80,30 ) ) im.rect( (255,255,255), None , (75,25,80,30 ) ) # 1 wide rectangles im.rect_xywh( (255,205,255), None , (100,10,0,30 ) ) im.rect_xywh( (255,205,255), None , (105,10,1,30 ) ) im.rect_xywh( (255,205,255), None , (110,10,2,30 ) ) im.rect( (255,255,255), None , (115,10,115+0,30 ) ) im.rect( (255,255,255), None , (120,10,120+1,30 ) ) im.rect( (255,255,255), None , (125,10,125+2,30 ) ) im.rect( (105,105,105), None , (10,70,150,70+60 ) ) for i in range(0, 60, 20 ): im.line( (0,0,200), [10, 70, 150 - i, 70 + 60/2, 10, 70 + 60 ] ) Y=80 im.line( (200,0,0), [10,0+Y, 190,10+Y, 10,20+Y, 190,30+Y ] ) f=('Vera',12) im.text( (0,200,0), (0,40,30), (150,10), 'c', f, 'center' ) im.text( (0,200,0), (0,40,30), (150,20), 'lc',f, 'left' ) im.text( (0,200,0), (0,40,30), (150,30), 'rc',f, 'right' ) for a in [ 'lt','rt','lb','rb' ]: im.text( (200,200,0), (0,40,30), (50,150), a ,f, a ) im.text( (200,200,0), (0,40,30), (150,150), None ,f, 'many\nlines\nin\none' ) im.text( (200,200,0), (0,40,30), (100,150), None ,f, ['many','lines','in','one'] ) im.line( (105,105,105), (250,10,250,190 ) ) im.line( (105,105,105), (350,10,350,190 ) ) im.line( (105,105,105), (300,10,300,190 ) ) im.line( (105,105,105), (200, 10,299, 10 ) ) im.line( (105,105,105), (200, 80,299, 80 ) ) im.line( (105,105,105), (200,150,299,150 ) ) im.line( (105,105,105), (300, 10,399, 10 ) ) im.line( (105,105,105), (300,100,399, 100 ) ) im.line( (105,105,105), (300,190,399,190 ) ) m='\n2\n33' im.text( (200,0,0), (0,40,30), (200,10), 'lt', f, 'lt'+m ) im.text( (0,200,0), (0,40,30), (250,10), 'ct', f, 'ct'+m ) im.text( (0,0,200), (0,40,30), (300,10), 'rt', f, 'rt'+m ) im.text( (200,0,0), (0,40,30), (200,80), 'lc', f, 'lc'+m ) im.text( (0,200,0), (0,40,30), (250,80), 'cc', f, 'cc'+m ) im.text( (0,0,200), (0,40,30), (300,80), 'rc', f, 'rc'+m ) im.text( (200,0,0), (0,40,30), (200,150), 'lb', f, 'lb'+m ) im.text( (0,200,0), (0,40,30), (250,150), 'cb', f, 'cb'+m ) im.text( (0,0,200), (0,40,30), (300,150), 'rb', f, 'rb'+m ) im.text( (200,0,0), (0,40,30), (300,10), 'LT', f, 'LT'+m ) im.text( (0,200,0), (0,40,30), (350,10), 'CT', f, 'CT'+m ) im.text( (0,0,200), (0,40,30), (400,10), 'RT', f, 'RT'+m ) im.text( (200,0,0), (0,40,30), (300,100), 'LC', f, 'LC'+m ) im.text( (0,200,0), (0,40,30), (350,100), 'CC', f, 'CC'+m ) im.text( (0,0,200), (0,40,30), (400,100), 'RC', f, 'RC'+m ) im.text( (200,0,0), (0,40,30), (300,190), 'LB', f, 'LB'+m ) im.text( (0,200,0), (0,40,30), (350,190), 'CB', f, 'CB'+m ) im.text( (0,0,200), (0,40,30), (400,190), 'RB', f, 'RB'+m ) # im.text( (0,200,0), (0,40,0), (90,10), f, '90,10' ) # im.text( (0,200,0), (0,40,0), (10,90), None, '10,90' ) # im.text( (200,200,100), (40,40,140), (40,110), None, 'Checkin' ) im.rect( (105,105,105), None , (0,150,199,199) ) im.line( (105,105,105), (100,150,100,199) ) for i in [1,-1]: im.poly( (0,0,200), (200,40,0), (100+i,150, 100+20*i,170, 100+80*i,190, 100+20*i,199) ) im.tile( (150,100), 'plain' ) if __name__=="__main__": dr=korg_draw.Graphics() im=dr.IMAGE_new( (400,200), (100,0,200) ) test(im) im.show() im=dr.PYGAME_new( (400,200), (100,0,200) ) test(im) im.show()