Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a7c8af4
commit 581c773
Showing
42 changed files
with
125 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
.*.swp | ||
*.tmproj | ||
ext/qrdecode/*.o | ||
ext/qrdecode/*.dll | ||
ext/qrdecode/Makefile | ||
ext/qrdecode/*.log | ||
ext/qrdecode/*.bundle | ||
ext/qrdecode/*.a | ||
ext/qrdecode/*.so | ||
ext/qrdecode/conftest.dSYM | ||
ext/qrtools/*.o | ||
ext/qrtools/*.dll | ||
ext/qrtools/Makefile | ||
ext/qrtools/*.log | ||
ext/qrtools/*.bundle | ||
ext/qrtools/*.a | ||
ext/qrtools/*.so | ||
ext/qrtools/conftest.dSYM | ||
tags | ||
.rake_tasks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include <qrtools.h> | ||
|
||
VALUE mQRTools; | ||
|
||
void Init_qrtools() | ||
{ | ||
VALUE qrtools = rb_define_module("QRTools"); | ||
mQRTools = qrtools; | ||
|
||
init_qrtools_image(); | ||
init_qrtools_decoder(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef QRTOOLS_QRTOOLS | ||
#define QRTOOLS_QRTOOLS | ||
|
||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include <ruby.h> | ||
#include <decodeqr.h> | ||
|
||
#include <qrtools_image.h> | ||
#include <qrtools_decoder.h> | ||
|
||
extern VALUE mQRTools; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <qrtools_decoder.h> | ||
|
||
static VALUE allocate(VALUE klass) | ||
{ | ||
QrDecoderHandle decoder = qr_decoder_open(); | ||
|
||
return Data_Wrap_Struct(klass, NULL, qr_decoder_close, decoder); | ||
} | ||
|
||
VALUE cQRToolsDecoder; | ||
void init_qrtools_decoder() | ||
{ | ||
VALUE qrtools = rb_define_module("QRTools"); | ||
VALUE klass = rb_define_class_under(qrtools, "Decoder", rb_cObject); | ||
|
||
cQRToolsDecoder = klass; | ||
|
||
rb_define_alloc_func(klass, allocate); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef QRTOOLS_DECODER | ||
#define QRTOOLS_DECODER | ||
|
||
#include <qrtools.h> | ||
|
||
extern VALUE cQRToolsDecoder; | ||
|
||
void init_qrtools_decoder(); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include <qrtools_image.h> | ||
|
||
static void dealloc(IplImage * img) | ||
{ | ||
cvReleaseImage(&img); | ||
} | ||
|
||
static VALUE load(VALUE klass, VALUE path) | ||
{ | ||
IplImage *src = cvLoadImage(StringValuePtr(path), 1); | ||
return Data_Wrap_Struct(klass, NULL, dealloc, src); | ||
} | ||
|
||
VALUE cQRToolsImage; | ||
|
||
void init_qrtools_image() | ||
{ | ||
VALUE qrtools = rb_define_module("QRTools"); | ||
VALUE klass = rb_define_class_under(qrtools, "Image", rb_cObject); | ||
|
||
cQRToolsImage = klass; | ||
|
||
rb_define_singleton_method(klass, "load", load, 1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef QRTOOLS_IMAGE | ||
#define QRTOOLS_IMAGE | ||
|
||
#include <qrtools.h> | ||
|
||
extern VALUE cQRToolsImage; | ||
|
||
void init_qrtools_image(); | ||
|
||
#endif |
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require 'qrtools/qrtools' # native | ||
|
||
module QRTools | ||
VERSION = '1.0.0' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require File.expand_path(File.join(File.dirname(__FILE__), "helper")) | ||
|
||
class DecoderTestCase < QRToolsTestCase | ||
def test_new | ||
assert decoder = QRTools::Decoder.new | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
require File.expand_path(File.join(File.dirname(__FILE__), "helper")) | ||
|
||
class ImageTestCase < QRDecodeTestCase | ||
class ImageTestCase < QRToolsTestCase | ||
def test_load | ||
assert img = QRDecode::Image.load(File.join(ASSETS, '01-1.jpg')) | ||
assert img = QRTools::Image.load(File.join(ASSETS, '01-1.jpg')) | ||
end | ||
end |