rapngasm 3.1.7 → 3.2.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/rapngasm/apng.i +154 -0
- data/ext/rapngasm/apng_wrap.cxx +12317 -0
- data/ext/rapngasm/extconf.rb +25 -10
- data/rapngasm.gemspec +5 -10
- metadata +6 -33
- data/ext/rapngasm/apngasm_ruby.h +0 -5
- data/ext/rapngasm/rapngasm.cpp +0 -124
data/ext/rapngasm/extconf.rb
CHANGED
@@ -1,13 +1,28 @@
|
|
1
|
-
require '
|
2
|
-
require 'mkmf-rice'
|
1
|
+
require 'mkmf'
|
3
2
|
|
4
|
-
|
5
|
-
$LOCAL_LIBS = '-lapngasm'
|
3
|
+
return unless have_library('stdc++') # make sure we don't have some funny system
|
6
4
|
|
7
|
-
|
5
|
+
$stdout.write 'Checking for APNGAsm.'
|
6
|
+
if have_library('apngasm')
|
7
|
+
$stdout.write 'APNGAsm found, building RAPNGAsm.'
|
8
|
+
else
|
9
|
+
$stdout.write 'APNGAsm NOT found. Please install libapngasm.'
|
10
|
+
exit 1
|
11
|
+
end
|
8
12
|
|
9
|
-
#
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
#
|
13
|
+
#find header location
|
14
|
+
header_loc = `echo '#include <apngasm-conf.h>' | gcc -xc - -E`
|
15
|
+
header_loc = header_loc.to_s.match(".*apngasm-conf\.h")
|
16
|
+
header_loc = header_loc.to_s.match("\/.*\/")
|
17
|
+
$stdout.write "\nAPNGAsm config header found in: #{header_loc.to_s}"
|
18
|
+
|
19
|
+
dir_config('rapngasm')
|
20
|
+
|
21
|
+
$stdout.write "\nGenerating native interface wrappers with SWIG\n"
|
22
|
+
$stdout.write "Using SWIG from #{`which swig`}\n"
|
23
|
+
$stdout.write "Generating wrapper sources from #{File.expand_path(File.dirname(__FILE__))}/apngasm.i\n"
|
24
|
+
`swig -c++ -ruby -I#{header_loc.to_s} #{File.expand_path(File.dirname(__FILE__))}/apng.i`
|
25
|
+
$stdout.write 'Wrappers generated'
|
26
|
+
$distcleanfiles += ['apngasm_wrap.cxx']
|
27
|
+
|
28
|
+
create_makefile('rapngasm')
|
data/rapngasm.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'rapngasm'
|
3
|
-
s.version = '3.
|
3
|
+
s.version = '3.2.0.pre2'
|
4
4
|
s.license = 'libpng/zlib'
|
5
5
|
s.summary = 'apngasm for Ruby'
|
6
6
|
s.description = 'Ruby native extension for the apngasm APNG Assembler.'
|
@@ -8,18 +8,13 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.email = 'zero@genshin.org'
|
9
9
|
s.homepage = 'http://www.github.com/apngasm/rapngasm'
|
10
10
|
|
11
|
-
s.files = Dir.glob('ext
|
11
|
+
s.files = Dir.glob('ext/**/*') +
|
12
12
|
Dir.glob('lib/**/*.rb') +
|
13
13
|
Dir.glob('vendor/**/*') +
|
14
14
|
['rapngasm.gemspec']
|
15
15
|
|
16
16
|
s.extensions << 'ext/rapngasm/extconf.rb'
|
17
|
-
s.require_paths = ['lib'
|
18
|
-
|
19
|
-
|
20
|
-
# This is to avoid version issues. Precompiled native gems
|
21
|
-
# would be nice if we could version lock them to native lib
|
22
|
-
# versions...
|
23
|
-
s.add_development_dependency 'rake-compiler', '~> 0.9', '~> 0.9.5'
|
24
|
-
s.add_development_dependency 'rice', '~> 1.7', '~> 1.7.0'
|
17
|
+
s.require_paths = ['lib']
|
18
|
+
|
19
|
+
s.add_development_dependency 'rake-compiler', '~> 0.9'
|
25
20
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rapngasm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0.pre2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rei Kagetsuki
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-12-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake-compiler
|
@@ -18,9 +18,6 @@ dependencies:
|
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '0.9'
|
21
|
-
- - "~>"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.9.5
|
24
21
|
type: :development
|
25
22
|
prerelease: false
|
26
23
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -28,29 +25,6 @@ dependencies:
|
|
28
25
|
- - "~>"
|
29
26
|
- !ruby/object:Gem::Version
|
30
27
|
version: '0.9'
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.9.5
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: rice
|
36
|
-
requirement: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.7'
|
41
|
-
- - "~>"
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: 1.7.0
|
44
|
-
type: :development
|
45
|
-
prerelease: false
|
46
|
-
version_requirements: !ruby/object:Gem::Requirement
|
47
|
-
requirements:
|
48
|
-
- - "~>"
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: '1.7'
|
51
|
-
- - "~>"
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 1.7.0
|
54
28
|
description: Ruby native extension for the apngasm APNG Assembler.
|
55
29
|
email: zero@genshin.org
|
56
30
|
executables: []
|
@@ -58,9 +32,9 @@ extensions:
|
|
58
32
|
- ext/rapngasm/extconf.rb
|
59
33
|
extra_rdoc_files: []
|
60
34
|
files:
|
61
|
-
- ext/rapngasm/
|
35
|
+
- ext/rapngasm/apng.i
|
36
|
+
- ext/rapngasm/apng_wrap.cxx
|
62
37
|
- ext/rapngasm/extconf.rb
|
63
|
-
- ext/rapngasm/rapngasm.cpp
|
64
38
|
- rapngasm.gemspec
|
65
39
|
homepage: http://www.github.com/apngasm/rapngasm
|
66
40
|
licenses:
|
@@ -70,7 +44,6 @@ post_install_message:
|
|
70
44
|
rdoc_options: []
|
71
45
|
require_paths:
|
72
46
|
- lib
|
73
|
-
- ext
|
74
47
|
required_ruby_version: !ruby/object:Gem::Requirement
|
75
48
|
requirements:
|
76
49
|
- - ">="
|
@@ -78,9 +51,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
78
51
|
version: '0'
|
79
52
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
53
|
requirements:
|
81
|
-
- - "
|
54
|
+
- - ">"
|
82
55
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
56
|
+
version: 1.3.1
|
84
57
|
requirements: []
|
85
58
|
rubyforge_project:
|
86
59
|
rubygems_version: 2.4.8
|
data/ext/rapngasm/apngasm_ruby.h
DELETED
data/ext/rapngasm/rapngasm.cpp
DELETED
@@ -1,124 +0,0 @@
|
|
1
|
-
//#include <apngasm_ruby.h>
|
2
|
-
|
3
|
-
#include <apngasm.h>
|
4
|
-
#include <apngframe.h>
|
5
|
-
#include "rice/Data_Type.hpp"
|
6
|
-
#include "rice/Class.hpp"
|
7
|
-
#include "rice/Constructor.hpp"
|
8
|
-
#include "rice/Array.hpp"
|
9
|
-
|
10
|
-
using namespace Rice;
|
11
|
-
using namespace apngasm;
|
12
|
-
|
13
|
-
template<>
|
14
|
-
Object to_ruby< std::vector<APNGFrame> > (std::vector<APNGFrame> const & x)
|
15
|
-
{
|
16
|
-
std::vector<APNGFrame> v = x;
|
17
|
-
Array a;
|
18
|
-
|
19
|
-
for (std::vector<APNGFrame>::iterator vi = v.begin(); vi != v.end(); ++vi)
|
20
|
-
a.push(to_ruby<APNGFrame> (*vi));
|
21
|
-
|
22
|
-
return a;
|
23
|
-
}
|
24
|
-
|
25
|
-
template<>
|
26
|
-
rgb* from_ruby< rgb* > (Object o)
|
27
|
-
{
|
28
|
-
Array a(o);
|
29
|
-
rgb* rgbArray = (rgb*)malloc(a.size() * 3);
|
30
|
-
|
31
|
-
for (unsigned int i = 0; i < a.size(); i++)
|
32
|
-
{
|
33
|
-
Array array(a[i]);
|
34
|
-
rgb r = { from_ruby<unsigned char>(array[0]), from_ruby<unsigned char>(array[1]),
|
35
|
-
from_ruby<unsigned char>(array[2]) };
|
36
|
-
rgbArray[i] = r;
|
37
|
-
}
|
38
|
-
|
39
|
-
return rgbArray;
|
40
|
-
return NULL;
|
41
|
-
}
|
42
|
-
|
43
|
-
template<>
|
44
|
-
rgba* from_ruby< rgba* > (Object o)
|
45
|
-
{
|
46
|
-
Array a(o);
|
47
|
-
rgba* rgbaArray = (rgba*)malloc(a.size() * 4);
|
48
|
-
|
49
|
-
for (unsigned int i = 0; i < a.size(); i++)
|
50
|
-
{
|
51
|
-
Array array(a[i]);
|
52
|
-
rgba r = { from_ruby<unsigned char>(array[0]), from_ruby<unsigned char>(array[1]),
|
53
|
-
from_ruby<unsigned char>(array[2]), from_ruby<unsigned char>(array[3]) };
|
54
|
-
rgbaArray[i] = r;
|
55
|
-
}
|
56
|
-
|
57
|
-
return rgbaArray;
|
58
|
-
}
|
59
|
-
|
60
|
-
template<>
|
61
|
-
const std::string& from_ruby< const std::string& > (Object o)
|
62
|
-
{
|
63
|
-
static std::string tmp;
|
64
|
-
String str(o);
|
65
|
-
tmp.clear();
|
66
|
-
tmp.append(str.c_str());
|
67
|
-
return tmp;
|
68
|
-
}
|
69
|
-
|
70
|
-
//size_t APNGAsm::wrap_add_frame_rgb(Object pixels, unsigned int width, unsigned int height, Object trns_color = NULL, unsigned delayNum = DEFAULT_FRAME_NUMERATOR, unsigned delayDen = DEFAULT_FRAME_DENOMINATOR) {
|
71
|
-
// return this.addFrame(from_ruby<rgb*>(pixels), width, height, from_ruby<rgb*>(trns_color), delayNum, delayDen);
|
72
|
-
//}
|
73
|
-
|
74
|
-
extern "C"
|
75
|
-
void Init_rapngasm()
|
76
|
-
{
|
77
|
-
define_class<APNGFrame>("APNGFrame")
|
78
|
-
.define_constructor(Constructor<APNGFrame>())
|
79
|
-
.define_method("pixels", &APNGFrame::pixels, (Arg("pixels") = NULL))
|
80
|
-
.define_method("width", &APNGFrame::width, (Arg("width") = 0))
|
81
|
-
.define_method("height", &APNGFrame::height, (Arg("height") = 0))
|
82
|
-
.define_method("color_type", &APNGFrame::colorType, (Arg("color_type") = 255))
|
83
|
-
.define_method("palette", &APNGFrame::palette, (Arg("palette") = NULL))
|
84
|
-
.define_method("transparency", &APNGFrame::transparency, (Arg("transparency") = NULL))
|
85
|
-
.define_method("palettes_size", &APNGFrame::paletteSize, (Arg("palettes_size") = 0))
|
86
|
-
.define_method("transparency_size", &APNGFrame::transparencySize, (Arg("transparency_size") = NULL))
|
87
|
-
.define_method("delay_numerator", &APNGFrame::delayNum, (Arg("delay_numerator") = 0))
|
88
|
-
.define_method("delay_denominator", &APNGFrame::delayDen, (Arg("delay_denominator") = 0))
|
89
|
-
.define_method("rows", &APNGFrame::rows, (Arg("rows") = NULL))
|
90
|
-
.define_method("save", &APNGFrame::save, (Arg("out_path")));
|
91
|
-
|
92
|
-
typedef size_t (APNGAsm::*add_frame_object)(const APNGFrame&);
|
93
|
-
typedef size_t (APNGAsm::*add_frame_file)(const std::string&, unsigned, unsigned);
|
94
|
-
typedef size_t (APNGAsm::*add_frame_rgb)(rgb*, unsigned int, unsigned int, rgb*, unsigned, unsigned);
|
95
|
-
typedef size_t (APNGAsm::*add_frame_rgba)(rgba*, unsigned int, unsigned int, unsigned, unsigned);
|
96
|
-
define_class<APNGAsm>("APNGAsm")
|
97
|
-
.define_constructor(Constructor<APNGAsm>())
|
98
|
-
.define_method("assemble", &APNGAsm::assemble)
|
99
|
-
.define_method("disassemble", &APNGAsm::disassemble)
|
100
|
-
.define_method("load_animation_spec", &APNGAsm::loadAnimationSpec)
|
101
|
-
.define_method("save_pngs", &APNGAsm::savePNGs)
|
102
|
-
.define_method("save_json", &APNGAsm::saveJSON)
|
103
|
-
.define_method("save_xml", &APNGAsm::saveXML)
|
104
|
-
//.define_method("set_apngasm_listener", &APNGAsm::setAPNGAsmListener)
|
105
|
-
.define_method("get_frames", &APNGAsm::getFrames)
|
106
|
-
.define_method("frame_count", &APNGAsm::frameCount)
|
107
|
-
.define_method("set_loops", &APNGAsm::setLoops, Arg("loops") = 0)
|
108
|
-
.define_method("set_skip_first", &APNGAsm::setSkipFirst, Arg("skip_first"))
|
109
|
-
.define_method("get_loops", &APNGAsm::getLoops)
|
110
|
-
.define_method("is_skip_first", &APNGAsm::isSkipFirst)
|
111
|
-
.define_method("reset", &APNGAsm::reset)
|
112
|
-
.define_method("version", &APNGAsm::version)
|
113
|
-
.define_method("add_frame", add_frame_object(&APNGAsm::addFrame))
|
114
|
-
.define_method("add_frame_file", add_frame_file(&APNGAsm::addFrame),
|
115
|
-
(Arg("file_path"), Arg("delay_numerator") = DEFAULT_FRAME_NUMERATOR,
|
116
|
-
Arg("delay_denominator") = DEFAULT_FRAME_DENOMINATOR))
|
117
|
-
.define_method("add_frame_rgb", add_frame_rgb(&APNGAsm::addFrame),
|
118
|
-
(Arg("pixels"), Arg("width"), Arg("height"), Arg("trns_color") = NULL,
|
119
|
-
Arg("delay_numerator") = DEFAULT_FRAME_NUMERATOR,
|
120
|
-
Arg("delay_denominator") = DEFAULT_FRAME_DENOMINATOR))
|
121
|
-
.define_method("add_frame_rgba", add_frame_rgba(&APNGAsm::addFrame),
|
122
|
-
(Arg("pixels"), Arg("width"), Arg("height"),
|
123
|
-
Arg("delay_numerator") = DEFAULT_FRAME_NUMERATOR, Arg("delay_denominator") = DEFAULT_FRAME_DENOMINATOR));
|
124
|
-
}
|