Mercurial > MadButterfly
diff nodejs/testcase.js @ 778:61c217f8cec8
Fix bug of transformation from user space to image space.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Mon, 30 Aug 2010 13:07:49 +0800 |
parents | cceac4ba259e |
children | 9367508842b2 |
line wrap: on
line diff
--- a/nodejs/testcase.js Mon Aug 30 08:57:31 2010 +0800 +++ b/nodejs/testcase.js Mon Aug 30 13:07:49 2010 +0800 @@ -22,8 +22,9 @@ var ldr = mbfly.img_ldr_new("."); var img_data = ldr.load("sample.png"); var paint = mb_rt.paint_image_new(img_data); +var img_coord = mb_rt.coord_new(root); paint.fill(img); -root.add_shape(img); +img_coord.add_shape(img); /* test linear paint and rectangle */ var rect = mb_rt.rect_new(100, 100, 50, 50, 10, 10); @@ -143,6 +144,23 @@ mb_rt.flush(); }); +var resize_sw = 0; +setInterval(function() { + var sz; + + resize_sw++; + + sz = (resize_sw % 20) - 10; + if(sz < 0) + sz = -sz; + sz = 2 - sz / 10; + + img_coord[0] = sz; + img_coord[4] = sz; + mb_rt.redraw_changed(); + mb_rt.flush(); + }, 50); + var kbobserver; /* Keyboard event */ kbobserver = mb_rt.kbevents.add_event_observer(6, function(evt) {