rapngasm 0.0.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fff4bb0b365e3b03efb422e6a84e99a073693794
4
- data.tar.gz: befb77a0c0fc3818327f408f6abf3cc67b6518af
3
+ metadata.gz: 92d8f726309d7524f19d695fdc95d4e3aba2588e
4
+ data.tar.gz: c78a22ad85f90c2760db03ddac460afc25c79ebf
5
5
  SHA512:
6
- metadata.gz: e4149054fab680edcacee31e7ec6bcfa745e88b5501e528d17f9c88f8c347bd4c28e71b554a537df603cf448526dd4dafd0d6f0414b8af0e302634098b6aa704
7
- data.tar.gz: 98fe3efe993cf919fe7226d0ea5e23cb787bb6e21a85bc4c46263a74121e751599b9d1a5bc8c61cc52770a7a4ba368f60c65b856ab341370563e15729a95be60
6
+ metadata.gz: 404d4b212bb7014a009f43a042890e0a1ffb27c01abb5a06ddd3b533b1c221f709c41e9e7f4ab006a04ba0ed47198205f6046816e01f4b02b3f45aa674fa474e
7
+ data.tar.gz: e33591d72f8b74ed38e4dbe2501aa9177a3837a169d5318a3d50ec82a9d92fb2cab89d5d67841fd2bad815f16b1d4e81056bdd2d0b48a659a86ce8eadaf13a7a
@@ -0,0 +1,5 @@
1
+ #ifndef _APNGASM_RUBY_
2
+ #define _APNGASM_RUBY_
3
+
4
+
5
+ #endif /* _APNGASM_RUBY_ */
@@ -0,0 +1,12 @@
1
+ require 'mkmf-rice'
2
+
3
+ $CFLAGS = '-x c++'
4
+ $LOCAL_LIBS = '-lapngasm'
5
+
6
+ dir_config 'apngasm'
7
+
8
+ if have_header('apngasm.h')
9
+ create_makefile 'rapngasm'
10
+ else
11
+ puts 'apngasm is not installed or the headers are not in the system path.\n'
12
+ end
@@ -0,0 +1,111 @@
1
+ //#include <apngasm_ruby.h>
2
+
3
+ #include <apngasm.h>
4
+ #include <apngframe.h>
5
+ #include "rice/Class.hpp"
6
+ #include "rice/Data_Type.hpp"
7
+ #include "rice/Constructor.hpp"
8
+ #include "rice/String.hpp"
9
+ #include "rice/Array.hpp"
10
+ #include <iostream>
11
+
12
+ using namespace Rice;
13
+ using namespace apngasm;
14
+
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(c[i]);
56
+ return a;
57
+ }
58
+
59
+ template<>
60
+ Object to_ruby< std::vector<APNGFrame> > (std::vector<APNGFrame> const & x)
61
+ {
62
+ std::vector<APNGFrame> v = x;
63
+ Array a;
64
+ for (std::vector<APNGFrame>::iterator vi = v.begin(); vi != v.end(); ++vi)
65
+ a.push(to_ruby<APNGFrame> (*vi));
66
+ return a;
67
+ }
68
+
69
+ template<>
70
+ unsigned char* from_ruby< unsigned char* > (Object o)
71
+ {
72
+ Array a(o);
73
+ unsigned char* c = (unsigned char*)malloc(a.size());
74
+ for (unsigned int i = 0; i < a.size(); i++)
75
+ c[i] = from_ruby<unsigned char>(a[i]);
76
+ return c;
77
+ }
78
+
79
+ extern "C"
80
+ void Init_rapngasm()
81
+ {
82
+ define_class<APNGFrame>("APNGFrame")
83
+ //.define_constructor(Constructor<APNGFrame>())
84
+ .define_constructor(Constructor<APNGFrame, const std::string, unsigned, unsigned>(),
85
+ (Arg("file_path"), Arg("delay_num") = DEFAULT_FRAME_NUMERATOR, Arg("dela_den") = DEFAULT_FRAME_DENOMINATOR))
86
+ .define_method("pixels", &APNGFrame::pixels, (Arg("pixels") = NULL))
87
+ .define_method("width", &APNGFrame::width, (Arg("width") = 0))
88
+ .define_method("height", &APNGFrame::height, (Arg("height") = 0))
89
+ .define_method("color_type", &APNGFrame::colorType, (Arg("color_type") = 255))
90
+ // .define_method("palette", &APNGFrame::palette, (Arg("palette") = NULL))
91
+ .define_method("transparency", &APNGFrame::transparency, (Arg("transparency") = NULL))
92
+ .define_method("palettes_size", &APNGFrame::paletteSize, (Arg("palettes_size") = 0))
93
+ .define_method("transparency_size", &APNGFrame::transparencySize, (Arg("transparency_size") = NULL))
94
+ .define_method("delay_numerator", &APNGFrame::delayNum, (Arg("delay_numerator") = 0))
95
+ .define_method("delay_denominator", &APNGFrame::delayDen, (Arg("delay_denominator") = 0));
96
+ // .define_method("rows", &APNGFrame::rows, (Arg("rows") = NULL));
97
+
98
+ define_class<APNGAsm>("APNGAsmSuper")
99
+ .define_constructor(Constructor<APNGAsm>())
100
+ .define_method("version", &APNGAsm::version)
101
+ .define_method("assemble", &APNGAsm::assemble)
102
+ .define_method("disassemble", &APNGAsm::disassemble)
103
+ .define_method("frame_count", &APNGAsm::frameCount)
104
+ .define_method("reset", &APNGAsm::reset);
105
+
106
+ define_class<RAPNGAsm, APNGAsm>("APNGAsm")
107
+ .define_constructor(Constructor<RAPNGAsm>())
108
+ .define_method("add_frame", &RAPNGAsm::addFrameFromFrameObject, Arg("frame"))
109
+ .define_method("add_frame_from_file", &RAPNGAsm::addFrameFromFile,
110
+ (Arg("filePath"), Arg("delayNum") = DEFAULT_FRAME_NUMERATOR, Arg("delayDen") = DEFAULT_FRAME_DENOMINATOR));
111
+ }
metadata CHANGED
@@ -1,27 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rapngasm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rei Kagetsuki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-08 00:00:00.000000000 Z
11
+ date: 2013-12-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: '[Will be:] Ruby front end and module library for apngasm.'
14
- email: info@genshin.org
13
+ description: Ruby native extension for the apngasm APNG Assembler.
14
+ email: zero@genshin.org
15
15
  executables: []
16
- extensions: []
16
+ extensions:
17
+ - ext/rapngasm/extconf.rb
17
18
  extra_rdoc_files: []
18
19
  files:
19
- - .gitignore
20
- - README.md
21
- - rapngasm.gemspec
22
- homepage: http://genshin.org
20
+ - ext/rapngasm/apngasm_ruby.h
21
+ - ext/rapngasm/rapngasm.cpp
22
+ - ext/rapngasm/extconf.rb
23
+ homepage: http://www.github.com/apngasm/rapngasm
23
24
  licenses:
24
- - GPLv3
25
+ - libpng/zlib
25
26
  metadata: {}
26
27
  post_install_message:
27
28
  rdoc_options: []
@@ -39,7 +40,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
39
40
  version: '0'
40
41
  requirements: []
41
42
  rubyforge_project:
42
- rubygems_version: 2.0.3
43
+ rubygems_version: 2.1.11
43
44
  signing_key:
44
45
  specification_version: 4
45
46
  summary: apngasm for Ruby
data/.gitignore DELETED
@@ -1,2 +0,0 @@
1
- *.swp
2
- *.swo
data/README.md DELETED
@@ -1,4 +0,0 @@
1
- rapngasm
2
- ========
3
-
4
- Ruby interface for apngasm
@@ -1,11 +0,0 @@
1
- Gem::Specification.new do |s|
2
- s.name = 'rapngasm'
3
- s.version = '0.0.1'
4
- s.license = "GPLv3"
5
- s.summary = "apngasm for Ruby"
6
- s.description = "[Will be:] Ruby front end and module library for apngasm."
7
- s.authors = ["Rei Kagetsuki"]
8
- s.email = 'info@genshin.org'
9
- s.files = `git ls-files`.split("\n")
10
- s.homepage = 'http://genshin.org'
11
- end