com.zavoo.labs


Flex SVG Viewer - Gaussian Blur and Animation

This movie requires Flash Player 9

[Subversion Repo]
svn co https://iciifs.com/svn/SvgViewer SvgViewer

    Added limited support for Gaussian blur and animation tags

  • A blur filter can only be applied to an object not an area of the screen
  • Animation tags assume time values are in seconds and only supports numeric ranges
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<defs>
	<filter id="Gaussian_Blur">
		<feGaussianBlur in="SourceGraphic" stdDeviation="10" />
	</filter>
</defs>
 
<ellipse cx="100" cy="50" rx="70" ry="40" style="fill:#ff0000;stroke:#000000;stroke-width:2">
	<animate attributeName="cx" attributeType="XML" begin="1s" dur="2s" end="10s" by="300" repeatCount="indefinite" />
	<animate attributeName="cy" attributeType="XML" begin="3s" dur="2s" end="10s" by="100" repeatCount="indefinite" />    
	<animate attributeName="cx" attributeType="XML" begin="5s" dur="2s" end="10s" by="-300" repeatCount="indefinite" />
	<animate attributeName="cy" attributeType="XML" begin="7s" dur="2s" end="10s" by="-100" repeatCount="indefinite" />
 
	<animate attributeName="ry" attributeType="XML" begin="1s" dur="4s" end="10s" by="-20" repeatCount="indefinite" />
	<animate attributeName="ry" attributeType="XML" begin="5s" dur="4s" end="10s" by="20" repeatCount="indefinite" />     
 
	<animate attributeName="rx" attributeType="XML" begin="1s" dur="4s" end="10s" by="-35" repeatCount="indefinite" />
	<animate attributeName="rx" attributeType="XML" begin="5s" dur="4s" end="10s" by="35" repeatCount="indefinite" />
</ellipse>          
<ellipse cx="400" cy="150" rx="70" ry="40" style="fill:#ff0000;stroke:#000000;stroke-width:2;filter:url(#Gaussian_Blur)">
	<animate attributeName="cx" attributeType="XML" begin="1s" dur="2s" end="10s" by="-300" repeatCount="indefinite" />
	<animate attributeName="cy" attributeType="XML" begin="3s" dur="2s" end="10s" by="-100" repeatCount="indefinite" />    
	<animate attributeName="cx" attributeType="XML" begin="5s" dur="2s" end="10s" by="300" repeatCount="indefinite" />
	<animate attributeName="cy" attributeType="XML" begin="7s" dur="2s" end="10s" by="100" repeatCount="indefinite" />     
 
	<animate attributeName="ry" attributeType="XML" begin="1s" dur="4s" end="10s" by="-20" repeatCount="indefinite" />
	<animate attributeName="ry" attributeType="XML" begin="5s" dur="4s" end="10s" by="20" repeatCount="indefinite" />  
 
	<animate attributeName="rx" attributeType="XML" begin="1s" dur="4s" end="10s" by="-35" repeatCount="indefinite" />
	<animate attributeName="rx" attributeType="XML" begin="5s" dur="4s" end="10s" by="35" repeatCount="indefinite" />                 
</ellipse>
August 4th, 2008 by james

Gumstix / OpenEmbedded Webcam Support

Getting v4l2 webcam support is fairly straight forward once you have the toolchain in place.

First, you need to install the v4l2 modules. You can either follow the build instructions located here or download the binary version below.

The modules should be installed at /lib/modules/2.6.21/kernel/drivers/media/video.

Here is a set of video modules compiled for the 2.6.21 kernel.

    Included Kernel Modules

  • uvcvideo.ko
  • compat_ioctl32.ko
  • v4l1-compat.ko
  • videodev.ko
  • v4l2-common.ko

Once you have the modules installed issue a “depmod -a” command so the system can find them.

To test your work, download a copy of uvccapture for OpenEmbeeded.

Before you can install the uvccapture package you will need to install a copy of libjpeg.

    ipkg install libjpeg62

Once you have libjpeg installed you can install uvccapture.

    ipkg install uvccapture_0.4-r5_armv5te.ipk

Here is a quick time lapse photography script

1
2
3
4
5
6
7
8
#!/bin/sh
for i in `seq 1 1000`;
do
        fname=`printf "%05d" "$i"`;
        uvccapture -o${fname}.jpg -x800 -y600;
        sync; #make sure image is stored in case of a power loss
        sleep 10;
done

You can create a movie from the images using jpeg2yuv. Under Ubuntu, jpeg2yuv is part of the mjpegtools package.

1
2
#!/bin/sh
jpeg2yuv -f 25 -b 1 -I p -j %05d.jpg | mpeg2enc -o time_lapse.m1v
July 26th, 2008 by james

Flex Brainfuck Interpreter

Flex Brainfuck Interpreter
[Full Source Code]

Brainfuck is a minimalist programming language having of only 8 commands.
Operations are performed using a single pointer and an array of bytes to store data.

    Command     Description
> Move the pointer to the right
< Move the pointer to the left
+ Increment the memory cell under the pointer
- Decrement the memory cell under the pointer
. Output the character signified by the cell at the pointer
, Input a character and store it in the cell at the pointer
[ Jump past the matching ] if the cell under the pointer is 0
] Jump back to the matching [
July 16th, 2008 by james

SVG Viewer - SVG Title Support and Text Node Fix

    Updates

  • You can now access the title of the SVG via SVGViewer.title
  • Text now computes proper x and y offset coordinates

[Subversion Repo]
svn co https://iciifs.com/svn/SvgViewer SvgViewer

July 11th, 2008 by james

SVG Viewer - Opacity and Rectangle Fix

    Updates

  • Node opacity (alpha) is now functional
  • Rounded rectangles are now supported
  • Rectangles are now properly placed on the x,y coordinate system
  • The transform argument “rotate” is now supported
  • Added line cap, joint, and miter limit support

[Subversion Repo]
svn co https://iciifs.com/svn/SvgViewer SvgViewer

July 10th, 2008 by james

SVG Viewer - Code Rewrite and Documentation

Over the last week I’ve completely rewritten the SVG Viewer.
I got rid of a lot of hacks such as the XML preprocessor which was creating multiple copies of the SVG XML.

[Subversion Repo]
svn co https://iciifs.com/svn/SvgViewer SvgViewer

    Changes

  • Use nodes now pull XML from symbol and def nodes. The preprocessor no longer copies XML into the use nodes.
  • Symbols, Defs, and Clip-Paths now have revision support. When a change is made to any of these nodes other nodes will update their display to reflect the changes.
  • The text and tspan nodes are included in this update.
  • All nodes with ids now register with the root node.

Also, there is now documentation for the SVG Viewer library.

July 9th, 2008 by james

Flex SVG Viewer - Text and TSpan Support

This movie requires Flash Player 9

[SVG File] text along a path

I’ve added basic support for Text and TSpan SVG elements to a branch of the SVG Viewer. In the next few days I will add text support to the main library.

In order to support text rotation I am creating a bitmap of the text.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
var myText:String = "This is a test...";
 
//Create TextField
var textField:TextField = new TextField();
textField.autoSize = TextFieldAutoSize.LEFT;
textField.text = myText;
 
/**
 * Load font styling: textField.setTextFormat(textFormat);
 * Load any transformations: handled in transformNode()
 **/
 
//Convert TextField to a bitmap so we can rotate the text
var bitmapData:BitmapData = new BitmapData(textField.width, textField.height, true, 0x000000);
bitmapData.draw(textField);
 
var textBitmap:Bitmap = new Bitmap(bitmapData);
textBitmap.smoothing = true;
 
this.addChild(textBitmap);
July 5th, 2008 by james

Flex SVG Viewer - Elliptical Arc Support


[Full Source Code]

Path elements now support elliptical arcs.
The conversion code comes from com.degrafa.geometry.utilities.ArcUtils.

Example SVG from w3.org SVG docs.

July 4th, 2008 by james