File: effect.rb

package info (click to toggle)
freej 0.10git20100110-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 32,080 kB
  • ctags: 22,705
  • sloc: cpp: 156,254; ansic: 25,531; sh: 13,538; perl: 4,624; makefile: 3,278; python: 2,889; objc: 1,284; asm: 1,125; ruby: 126
file content (46 lines) | stat: -rwxr-xr-x 997 bytes parent folder | download
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/ruby
#for now update the load path to include the location of 
#the freej module and freej_extensions [as we haven't installed it yet]
$: << '../../bindings/ruby/.libs'
$: << '../../bindings/ruby/'
##import the Freej module
require 'Freej'

# check that we have an argument
if ARGV.length < 1
  puts "[!] this script needs an argument: file to play"
  exit
end

#initializes Freej creating a Contex
cx = Freej::Context.new

#creates a screen of given size
scr = Freej::SdlScreen.new(400, 300)

#adds the screen
cx.add_screen(scr)

#refreshes the list of available filter effects
cx.plugger.refresh(cx)

#opens the file given on commandline as a layer
lay = cx.open(ARGV[0])

#gets the vertigo filter effect
filt = cx.filters["vertigo"]

#adds the filter to the layer if the filter was found
lay.add_filter( filt ) if filt

#start the layer thread
lay.start

#adds the layer to the Freej context
cx.add_layer(lay)

#fit the video layer to the screen
lay.fit

#start the context
cx.start