hornetseye-xorg 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/Rakefile +4 -2
- data/ext/frame.cc +10 -3
- data/ext/frame.hh +1 -0
- data/lib/hornetseye-xorg/x11display.rb +3 -3
- data/lib/hornetseye-xorg/x11output.rb +33 -0
- data/lib/hornetseye_xorg_ext.rb +1 -0
- metadata +4 -3
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -7,7 +7,7 @@ require 'rake/loaders/makefile'
|
|
7
7
|
require 'rbconfig'
|
8
8
|
|
9
9
|
PKG_NAME = 'hornetseye-xorg'
|
10
|
-
PKG_VERSION = '0.2.
|
10
|
+
PKG_VERSION = '0.2.1'
|
11
11
|
CXX = ENV[ 'CXX' ] || 'g++'
|
12
12
|
STRIP = ENV[ 'STRIP' ] || 'strip'
|
13
13
|
RB_FILES = FileList[ 'lib/**/*.rb' ]
|
@@ -171,7 +171,9 @@ rule '.o' => '.cc' do |t|
|
|
171
171
|
end
|
172
172
|
|
173
173
|
file ".depends.mf" do |t|
|
174
|
-
sh "
|
174
|
+
sh "g++ -MM #{$CXXFLAGS} #{CC_FILES.join ' '} | " +
|
175
|
+
"sed -e :a -e N -e 's/\\n/\\$/g' -e ta | " +
|
176
|
+
"sed -e 's/ *\\\\\\$ */ /g' -e 's/\\$/\\n/g' | sed -e 's/^/ext\\//' > #{t.name}"
|
175
177
|
end
|
176
178
|
CC_FILES.each do |t|
|
177
179
|
file t.ext(".o") => t
|
data/ext/frame.cc
CHANGED
@@ -23,9 +23,7 @@ Frame::Frame( const string &typecode, int width, int height, char *data ):
|
|
23
23
|
VALUE mModule = rb_define_module( "Hornetseye" );
|
24
24
|
VALUE cMalloc = rb_define_class_under( mModule, "Malloc", rb_cObject );
|
25
25
|
VALUE cFrame = rb_define_class_under( mModule, "Frame", rb_cObject );
|
26
|
-
VALUE rbSize =
|
27
|
-
rb_const_get( mModule, rb_intern( typecode.c_str() ) ),
|
28
|
-
INT2NUM( width ), INT2NUM( height ) );
|
26
|
+
VALUE rbSize = INT2NUM( storageSize( typecode, width, height ) );
|
29
27
|
VALUE rbMemory;
|
30
28
|
if ( data != NULL ) {
|
31
29
|
rbMemory = Data_Wrap_Struct( cMalloc, 0, 0, (void *)data );
|
@@ -67,3 +65,12 @@ void Frame::markRubyMember(void)
|
|
67
65
|
rb_gc_mark( m_frame );
|
68
66
|
}
|
69
67
|
|
68
|
+
int Frame::storageSize( const std::string &typecode, int width, int height )
|
69
|
+
{
|
70
|
+
VALUE mModule = rb_define_module( "Hornetseye" );
|
71
|
+
VALUE cFrame = rb_define_class_under( mModule, "Frame", rb_cObject );
|
72
|
+
return NUM2INT( rb_funcall( cFrame, rb_intern( "storage_size" ), 3,
|
73
|
+
rb_const_get( mModule, rb_intern( typecode.c_str() ) ),
|
74
|
+
INT2NUM( width ), INT2NUM( height ) ) );
|
75
|
+
}
|
76
|
+
|
data/ext/frame.hh
CHANGED
@@ -32,9 +32,8 @@ module Hornetseye
|
|
32
32
|
|
33
33
|
def show( *args, &action )
|
34
34
|
options = args.last.is_a?( Hash ) ? args.pop : {}
|
35
|
-
options = { :title => 'Hornetseye' }.merge options
|
35
|
+
options = { :title => 'Hornetseye', :output => XImageOutput }.merge options
|
36
36
|
unless action
|
37
|
-
options = { :output => XImageOutput }.merge options
|
38
37
|
frame, width, height = *args
|
39
38
|
width ||= frame.width
|
40
39
|
height ||= ( width.to_f * frame.height / frame.width ).round
|
@@ -49,8 +48,8 @@ module Hornetseye
|
|
49
48
|
ensure
|
50
49
|
window.close
|
51
50
|
end
|
51
|
+
frame
|
52
52
|
else
|
53
|
-
options = { :output => XVideoOutput }.merge options
|
54
53
|
width, height = *args
|
55
54
|
result = action.call
|
56
55
|
width ||= result.shape[0]
|
@@ -77,6 +76,7 @@ module Hornetseye
|
|
77
76
|
ensure
|
78
77
|
window.close
|
79
78
|
end
|
79
|
+
display
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# hornetseye-xorg - Graphical output under X.Org
|
2
|
+
# Copyright (C) 2010 Jan Wedekind
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
# Namespace of Hornetseye computer vision library
|
18
|
+
module Hornetseye
|
19
|
+
|
20
|
+
class X11Output
|
21
|
+
|
22
|
+
class << self
|
23
|
+
|
24
|
+
def new( *args )
|
25
|
+
raise 'X11Output is an abstract class'
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
data/lib/hornetseye_xorg_ext.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 1
|
9
|
+
version: 0.2.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jan Wedekind
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10-
|
17
|
+
date: 2010-10-08 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- README.md
|
86
86
|
- COPYING
|
87
87
|
- .document
|
88
|
+
- lib/hornetseye-xorg/x11output.rb
|
88
89
|
- lib/hornetseye-xorg/frame.rb
|
89
90
|
- lib/hornetseye-xorg/ximageoutput.rb
|
90
91
|
- lib/hornetseye-xorg/node.rb
|