def save_cairo(fname, gbox, dpi): global wid, hgt wid = int(frm.get_pdom_wid() * dpi) hgt = int(frm.get_pdom_hgt() * dpi) dev_img = DeviceCairo(fname, gbox, dpi) dev_img.fill_black() dev_img.set_plot(frm) julia(dev_img) #dev_img.set_pixel(100,100, (255,0,0)) #dev_img.set_pixel(102,100, (0,255,0)) #dev_img.set_pixel(104,100, (0,0,255)) dev_img.close()
def save_cairo(fname, gbox, dpi): global dev_ani, movie movie = False dev_img = DeviceCairo(fname, gbox, dpi) dev_img.fill_black() dev_img.set_plot(frm_x2) run_rand_tree(dev_img) if movie: print(len(clips)) dev_ani = DeviceCairoAnimation("ftree2.mp4", dev_img, 0,0) video = concatenate_videoclips(clips, method='compose') #video.write_videofile("ftree01.mp4", fps=30) video.write_gif("ftree2.gif", fps=30) dev_img.close()
def main(): data = Data(-3, 3, -1, 10) fmm = FrameManager() frm_x2 = fmm.create(0.0, 0.0, 2, 4, data) gbbox = fmm.get_gbbox() dev_wmf = DeviceWindowsMetafile("patlin.wmf", gbbox) dev_wmf.set_device(frm_x2) test(dev_wmf) dev_wmf.close() dev_img = DeviceCairo("patlin.png", gbbox, dpi) dev_img.fill_white() dev_img.set_plot(frm_x2) test(dev_img) dev_img.close()
def main(): from vgl import color, BBox, Frame, FrameManager, Data from vgl import DeviceWindowsMetafile, DeviceCairo #from vgl import drawfrm, symbol, drawtick, drawaxis, drawlabel data = Data(-3, 3, -1, 10) fmm = FrameManager() frm_x2 = fmm.create(0.0, 0.0, 4, 4, data) gbbox = fmm.get_gbbox() dev_img = DeviceCairo("patlin.png", gbbox, 100) dev_img.fill_white() dev_img.set_plot(frm_x2) test(dev_img) dev_img.close() dev_wmf = DeviceWindowsMetafile("patlin.wmf", gbbox) dev_wmf.set_device(frm_x2) test(dev_wmf) dev_wmf.close()
def save_cairo(fname, frm, gbox, dpi): dev_img = DeviceCairo(fname, gbox, dpi) dev_img.fill_white() dev_img.set_plot(frm) plot_geom(dev_img) dev_img.close()
x2 = sint_trail_xpos y2 = y1 sine_trail = [y2]+sine_trail[:max_sine_points] for i,p in enumerate(sine_trail): x3 = sint_trail_xpos+i*sine_plot_xratio deg = int(i/max_sine_points*350.0) #sym.set_color_all(color.hsv(deg,1,1)) #dev.symbol(x3,p,sym,True) dev.circle(x3,p,r2,fcol=color.hsv(deg,1,1)) dev.circle(x2, y2, r2, fcol=color.BLACK) dev.line(x1, y1,x2, y2, color.BLUE, lthk=thk) theta += dtheta circle_npnt = 50 dtheta = 0.05 theta = 0 running = True choice = 1 dev = DeviceCairo("===.png", gbox, 100) dev.set_plot(frm) #dev.close() dev_ani = DeviceCairoAnimation('sinmov.mp4', dev, sine_wave, 10) dev_ani.save_video() dev_ani.save_gif("sinmov.gif")