rapngasm 3.0.0 → 3.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/rapngasm/rapngasm.cpp +79 -86
- metadata +24 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b9059697889a36b04000a804125e352b4d78004
|
4
|
+
data.tar.gz: 76316ebf184bcc8e1b879ef509b344cace3989d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c72c6f78f533e7e2c843b390029808c86b146cb5971e6eb07cacab616a3628d82eb4d5af812f1f05f5ba15646f6c35e0cf77250b1c4cf1caa5b24abfc9ea464
|
7
|
+
data.tar.gz: 7493e30582ea20e53c56dc2b7988db65704b45cc85de59d9f9ba1654121feb48481640228ce68877330d6708ff803c7bdb3b04fa87d640484a66a464bd80ab64
|
data/ext/rapngasm/rapngasm.cpp
CHANGED
@@ -2,116 +2,109 @@
|
|
2
2
|
|
3
3
|
#include <apngasm.h>
|
4
4
|
#include <apngframe.h>
|
5
|
-
#include "rice/Class.hpp"
|
6
5
|
#include "rice/Data_Type.hpp"
|
6
|
+
#include "rice/Class.hpp"
|
7
7
|
#include "rice/Constructor.hpp"
|
8
|
-
#include "rice/String.hpp"
|
9
8
|
#include "rice/Array.hpp"
|
10
|
-
#include <iostream>
|
11
9
|
|
12
10
|
using namespace Rice;
|
13
11
|
using namespace apngasm;
|
14
12
|
|
15
|
-
namespace apngasm
|
16
|
-
{
|
17
|
-
class RAPNGAsm : public APNGAsm
|
18
|
-
{
|
19
|
-
public:
|
20
|
-
size_t addFrameFromFrameObject(const APNGFrame &frame)
|
21
|
-
{
|
22
|
-
return this->addFrame(frame);
|
23
|
-
}
|
24
|
-
|
25
|
-
size_t addFrameFromFile(const std::string &filePath,
|
26
|
-
unsigned delayNum = DEFAULT_FRAME_NUMERATOR, unsigned delayDen = DEFAULT_FRAME_DENOMINATOR)
|
27
|
-
{
|
28
|
-
return this->addFrame(filePath, delayNum, delayDen);
|
29
|
-
}
|
30
|
-
|
31
|
-
template<typename T>
|
32
|
-
T from_ruby(Object o);
|
33
|
-
|
34
|
-
template<typename T>
|
35
|
-
Object to_ruby(T const & x);
|
36
|
-
};
|
37
|
-
}
|
38
|
-
|
39
|
-
// template<>
|
40
|
-
// std::vector<APNGFrame> from_ruby<std::vector<APNGFrame> >(Object o)
|
41
|
-
// {
|
42
|
-
// Array a(o);
|
43
|
-
// std::vector<APNGFrame> v;
|
44
|
-
// for(Array::iterator ai = a.begin(); ai != a.end(); ++ai)
|
45
|
-
// v.push_back(from_ruby<APNGFrame> (*ai));
|
46
|
-
// return v;
|
47
|
-
// }
|
48
|
-
|
49
|
-
template<>
|
50
|
-
Object to_ruby< unsigned char* > (unsigned char* const & x)
|
51
|
-
{
|
52
|
-
unsigned char* const c = x;
|
53
|
-
Array a;
|
54
|
-
for (unsigned int i = 0; i < sizeof(c) ; i++)
|
55
|
-
a.push(to_ruby<unsigned char>(c[i]));
|
56
|
-
return a;
|
57
|
-
}
|
58
|
-
|
59
13
|
template<>
|
60
14
|
Object to_ruby< std::vector<APNGFrame> > (std::vector<APNGFrame> const & x)
|
61
15
|
{
|
62
16
|
std::vector<APNGFrame> v = x;
|
63
17
|
Array a;
|
18
|
+
|
64
19
|
for (std::vector<APNGFrame>::iterator vi = v.begin(); vi != v.end(); ++vi)
|
65
20
|
a.push(to_ruby<APNGFrame> (*vi));
|
21
|
+
|
66
22
|
return a;
|
67
23
|
}
|
68
24
|
|
69
25
|
template<>
|
70
|
-
|
71
|
-
{
|
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
|
+
{
|
72
46
|
Array a(o);
|
73
|
-
|
47
|
+
rgba* rgbaArray = (rgba*)malloc(a.size() * 4);
|
48
|
+
|
74
49
|
for (unsigned int i = 0; i < a.size(); i++)
|
75
|
-
|
76
|
-
|
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;
|
77
58
|
}
|
78
59
|
|
60
|
+
//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) {
|
61
|
+
// return this.addFrame(from_ruby<rgb*>(pixels), width, height, from_ruby<rgb*>(trns_color), delayNum, delayDen);
|
62
|
+
//}
|
63
|
+
|
79
64
|
extern "C"
|
80
65
|
void Init_rapngasm()
|
81
66
|
{
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
// .define_method("rows", &APNGFrame::rows, (Arg("rows") = NULL));
|
97
|
-
|
98
|
-
define_class<APNGAsm>("APNGAsmSuper")
|
99
|
-
.define_constructor(Constructor<APNGAsm>())
|
100
|
-
.define_method("assemble", &APNGAsm::assemble)
|
101
|
-
.define_method("disassemble", &APNGAsm::disassemble)
|
102
|
-
.define_method("load_animation_spec", &APNGAsm::loadAnimationSpec)
|
103
|
-
.define_method("save_pngs", &APNGAsm::savePNGs)
|
104
|
-
.define_method("save_json", &APNGAsm::saveJson)
|
105
|
-
.define_method("save_xml", &APNGAsm::saveXml)
|
106
|
-
//.define_method("set_apngasm_listener", &APNGAsm::setAPNGAsmListener)
|
107
|
-
.define_method("get_frames", &APNGAsm::getFrames)
|
108
|
-
.define_method("frame_count", &APNGAsm::frameCount)
|
109
|
-
.define_method("reset", &APNGAsm::reset)
|
110
|
-
.define_method("version", &APNGAsm::version);
|
67
|
+
define_class<APNGFrame>("APNGFrame")
|
68
|
+
.define_constructor(Constructor<APNGFrame>())
|
69
|
+
.define_method("pixels", &APNGFrame::pixels, (Arg("pixels") = NULL))
|
70
|
+
.define_method("width", &APNGFrame::width, (Arg("width") = 0))
|
71
|
+
.define_method("height", &APNGFrame::height, (Arg("height") = 0))
|
72
|
+
.define_method("color_type", &APNGFrame::colorType, (Arg("color_type") = 255))
|
73
|
+
.define_method("palette", &APNGFrame::palette, (Arg("palette") = NULL))
|
74
|
+
.define_method("transparency", &APNGFrame::transparency, (Arg("transparency") = NULL))
|
75
|
+
.define_method("palettes_size", &APNGFrame::paletteSize, (Arg("palettes_size") = 0))
|
76
|
+
.define_method("transparency_size", &APNGFrame::transparencySize, (Arg("transparency_size") = NULL))
|
77
|
+
.define_method("delay_numerator", &APNGFrame::delayNum, (Arg("delay_numerator") = 0))
|
78
|
+
.define_method("delay_denominator", &APNGFrame::delayDen, (Arg("delay_denominator") = 0))
|
79
|
+
.define_method("rows", &APNGFrame::rows, (Arg("rows") = NULL))
|
80
|
+
.define_method("save", &APNGFrame::save, (Arg("out_path")));
|
111
81
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
82
|
+
typedef size_t (APNGAsm::*add_frame_object)(const APNGFrame&);
|
83
|
+
typedef size_t (APNGAsm::*add_frame_file)(const std::string&, unsigned, unsigned);
|
84
|
+
typedef size_t (APNGAsm::*add_frame_rgb)(rgb*, unsigned int, unsigned int, rgb*, unsigned, unsigned);
|
85
|
+
typedef size_t (APNGAsm::*add_frame_rgba)(rgba*, unsigned int, unsigned int, unsigned, unsigned);
|
86
|
+
define_class<APNGAsm>("APNGAsm")
|
87
|
+
.define_constructor(Constructor<APNGAsm>())
|
88
|
+
.define_method("assemble", &APNGAsm::assemble)
|
89
|
+
.define_method("disassemble", &APNGAsm::disassemble)
|
90
|
+
.define_method("load_animation_spec", &APNGAsm::loadAnimationSpec)
|
91
|
+
.define_method("save_pngs", &APNGAsm::savePNGs)
|
92
|
+
.define_method("save_json", &APNGAsm::saveJSON)
|
93
|
+
.define_method("save_xml", &APNGAsm::saveXML)
|
94
|
+
//.define_method("set_apngasm_listener", &APNGAsm::setAPNGAsmListener)
|
95
|
+
.define_method("get_frames", &APNGAsm::getFrames)
|
96
|
+
.define_method("frame_count", &APNGAsm::frameCount)
|
97
|
+
.define_method("reset", &APNGAsm::reset)
|
98
|
+
.define_method("version", &APNGAsm::version)
|
99
|
+
.define_method("add_frame", add_frame_object(&APNGAsm::addFrame))
|
100
|
+
.define_method("add_frame_file", add_frame_file(&APNGAsm::addFrame),
|
101
|
+
(Arg("file_path"), Arg("delay_numerator") = DEFAULT_FRAME_NUMERATOR,
|
102
|
+
Arg("delay_denominator") = DEFAULT_FRAME_DENOMINATOR))
|
103
|
+
.define_method("add_frame_rgb", add_frame_rgb(&APNGAsm::addFrame),
|
104
|
+
(Arg("pixels"), Arg("width"), Arg("height"), Arg("trns_color") = NULL,
|
105
|
+
Arg("delay_numerator") = DEFAULT_FRAME_NUMERATOR,
|
106
|
+
Arg("delay_denominator") = DEFAULT_FRAME_DENOMINATOR))
|
107
|
+
.define_method("add_frame_rgba", add_frame_rgba(&APNGAsm::addFrame),
|
108
|
+
(Arg("pixels"), Arg("width"), Arg("height"),
|
109
|
+
Arg("delay_numerator") = DEFAULT_FRAME_NUMERATOR, Arg("delay_denominator") = DEFAULT_FRAME_DENOMINATOR));
|
117
110
|
}
|
metadata
CHANGED
@@ -1,43 +1,56 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rapngasm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rei Kagetsuki
|
8
|
+
- Rika Yoshida
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2014-
|
12
|
+
date: 2014-05-16 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rake-compiler
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
16
17
|
requirements:
|
17
|
-
- - "
|
18
|
+
- - "~>"
|
18
19
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
+
version: '0.9'
|
21
|
+
- - "~>"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.9.2
|
20
24
|
type: :runtime
|
21
25
|
prerelease: false
|
22
26
|
version_requirements: !ruby/object:Gem::Requirement
|
23
27
|
requirements:
|
24
|
-
- - "
|
28
|
+
- - "~>"
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0.9'
|
31
|
+
- - "~>"
|
25
32
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
33
|
+
version: 0.9.2
|
27
34
|
- !ruby/object:Gem::Dependency
|
28
35
|
name: rice
|
29
36
|
requirement: !ruby/object:Gem::Requirement
|
30
37
|
requirements:
|
31
|
-
- - "
|
38
|
+
- - "~>"
|
32
39
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
40
|
+
version: '1.6'
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.6.2
|
34
44
|
type: :runtime
|
35
45
|
prerelease: false
|
36
46
|
version_requirements: !ruby/object:Gem::Requirement
|
37
47
|
requirements:
|
38
|
-
- - "
|
48
|
+
- - "~>"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '1.6'
|
51
|
+
- - "~>"
|
39
52
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
53
|
+
version: 1.6.2
|
41
54
|
description: Ruby native extension for the apngasm APNG Assembler.
|
42
55
|
email: zero@genshin.org
|
43
56
|
executables: []
|
@@ -68,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
81
|
version: '0'
|
69
82
|
requirements: []
|
70
83
|
rubyforge_project:
|
71
|
-
rubygems_version: 2.2.
|
84
|
+
rubygems_version: 2.2.2
|
72
85
|
signing_key:
|
73
86
|
specification_version: 4
|
74
87
|
summary: apngasm for Ruby
|