example8.rb
#!/usr/bin/env python #image rotation ## @example example8.py # @see example8.c # @see example8.rb from fulguro import * imin = flgr2d_load_pgm("../../images/gray/lena.pgm") imtmp1 = FLGR_Data2D(imin) imout = FLGR_Data2D(imin) imdisc = FLGR_Data2D(imin) w = imin.size_x h = imin.size_y radius = int((min(h,w)/2)/1.4143) flgr2d_draw_disc(imdisc,w/2,h/2,radius,255) scr0 = flgr2d_rtview_create(imin) for i in range(200): flgr2d_rtview_refresh(scr0,imin) for i in range(0,360): if i/180 == 1: k = (i%180)-179 else: k = i flgr2d_rotate_center(imout,imin,k) flgr2d_replace(imout,imdisc,"==",255,imout,0) flgr2d_rtview_refresh(scr0,imout) ## Create row link to imin and imout ehehe ;) ## you can also use flgr2d_create_pixmap_link imlinkin_1 = imin.create_link(2,0,0); imlinkin_2 = imin.create_link(2,1,0); imlinkout_1 = imout.create_link(2,0,0); imlinkout_2 = imout.create_link(2,1,0); for i in range(0,360): if i/180 == 1: k = (i%180)-179 else: k = i flgr2d_rotate_center(imlinkout_1,imlinkin_1,k) flgr2d_rotate_center(imlinkout_2,imlinkin_2,-1*k) flgr2d_rtview_refresh(scr0,imout) for i in range(200): flgr2d_rtview_refresh(scr0,imout)