magro 0.4.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/LICENSE.txt +1 -1
- data/README.md +2 -2
- data/ext/magro/extconf.rb +7 -31
- data/ext/magro/magro.c +456 -4
- data/ext/magro/magro.h +41 -1
- data/lib/magro/filter.rb +1 -1
- data/lib/magro/io.rb +32 -5
- data/lib/magro/version.rb +1 -1
- data/sig/magro/filter.rbs +20 -0
- data/sig/magro/io.rbs +14 -0
- data/sig/magro/transform.rbs +12 -0
- data/sig/magro.rbs +9 -0
- metadata +9 -18
- data/.coveralls.yml +0 -1
- data/.github/workflows/build.yml +0 -23
- data/.github/workflows/coverage.yml +0 -29
- data/.gitignore +0 -22
- data/.rspec +0 -3
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -11
- data/Rakefile +0 -14
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/ext/magro/imgrw.c +0 -421
- data/ext/magro/imgrw.h +0 -18
- data/magro.gemspec +0 -39
data/lib/magro/version.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
module Magro
|
2
|
+
module Filter
|
3
|
+
def self?.filter2d: (Numo::UInt8 image, Numo::DFloat kernel, ?scale: Float? scale, ?offset: Integer offset) -> Numo::UInt8
|
4
|
+
def self?.convolve2d: (magro_image_narray arr1, magro_image_narray arr2) -> magro_image_narray
|
5
|
+
|
6
|
+
private
|
7
|
+
|
8
|
+
INTEGER_NARRAY: Array[String]
|
9
|
+
|
10
|
+
#def self?.zero_padding: (magro_image_narray image, Integer filter_h, Integer filter_w) -> magro_image_narray
|
11
|
+
#def self?.filter1ch: (magro_image_narray image, Numo::DFloat kernel, Float? scale, Integer offset) -> magro_image_narray
|
12
|
+
#def self?.im2col: (magro_image_narray image, Integer filter_h, Integer filter_w) -> magro_image_narray
|
13
|
+
#def self?.integer_narray?: (Numo::NArray image) -> bool
|
14
|
+
|
15
|
+
def self?.zero_padding: (untyped image, Integer filter_h, Integer filter_w) -> untyped
|
16
|
+
def self?.filter1ch: (untyped image, Numo::DFloat kernel, Float? scale, Integer offset) -> untyped
|
17
|
+
def self?.im2col: (untyped image, Integer filter_h, Integer filter_w) -> untyped
|
18
|
+
def self?.integer_narray?: (Numo::NArray image) -> bool
|
19
|
+
end
|
20
|
+
end
|
data/sig/magro/io.rbs
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
module Magro
|
2
|
+
module IO
|
3
|
+
def self?.imread: (String filename) -> Numo::UInt8?
|
4
|
+
def self?.imsave: (String filename, Numo::UInt8 image, ?quality: Integer) -> bool
|
5
|
+
|
6
|
+
private
|
7
|
+
|
8
|
+
def self?.read_jpg: (String filename) -> Numo::UInt8
|
9
|
+
def self?.read_png: (String filename) -> Numo::UInt8
|
10
|
+
def self?.save_jpg: (String filename, Numo::UInt8 image, Integer? quality) -> bool
|
11
|
+
def self?.save_png: (String filename, Numo::UInt8 image) -> bool
|
12
|
+
def self?.url?: (String str) -> bool
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Magro
|
2
|
+
module Transform
|
3
|
+
def self?.resize: (Numo::UInt8 image, height: Integer height, width: Integer width) -> Numo::UInt8
|
4
|
+
|
5
|
+
private
|
6
|
+
|
7
|
+
INTEGER_NARRAY: Array[String]
|
8
|
+
|
9
|
+
def self?.bilinear_resize: (Numo::UInt8 image, Integer new_height, Integer new_width) -> Numo::UInt8
|
10
|
+
def self?.integer_narray?: (Numo::NArray image) -> bool
|
11
|
+
end
|
12
|
+
end
|
data/sig/magro.rbs
ADDED
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: magro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yoshoku
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: numo-narray
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.9.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.9.1
|
27
27
|
description: |
|
@@ -36,22 +36,10 @@ extensions:
|
|
36
36
|
- ext/magro/extconf.rb
|
37
37
|
extra_rdoc_files: []
|
38
38
|
files:
|
39
|
-
- ".coveralls.yml"
|
40
|
-
- ".github/workflows/build.yml"
|
41
|
-
- ".github/workflows/coverage.yml"
|
42
|
-
- ".gitignore"
|
43
|
-
- ".rspec"
|
44
39
|
- CHANGELOG.md
|
45
|
-
- CODE_OF_CONDUCT.md
|
46
|
-
- Gemfile
|
47
40
|
- LICENSE.txt
|
48
41
|
- README.md
|
49
|
-
- Rakefile
|
50
|
-
- bin/console
|
51
|
-
- bin/setup
|
52
42
|
- ext/magro/extconf.rb
|
53
|
-
- ext/magro/imgrw.c
|
54
|
-
- ext/magro/imgrw.h
|
55
43
|
- ext/magro/magro.c
|
56
44
|
- ext/magro/magro.h
|
57
45
|
- lib/magro.rb
|
@@ -59,7 +47,10 @@ files:
|
|
59
47
|
- lib/magro/io.rb
|
60
48
|
- lib/magro/transform.rb
|
61
49
|
- lib/magro/version.rb
|
62
|
-
- magro.
|
50
|
+
- sig/magro.rbs
|
51
|
+
- sig/magro/filter.rbs
|
52
|
+
- sig/magro/io.rbs
|
53
|
+
- sig/magro/transform.rbs
|
63
54
|
homepage: https://github.com/yoshoku/magro
|
64
55
|
licenses:
|
65
56
|
- BSD-3-Clause
|
@@ -83,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
74
|
- !ruby/object:Gem::Version
|
84
75
|
version: '0'
|
85
76
|
requirements: []
|
86
|
-
rubygems_version: 3.
|
77
|
+
rubygems_version: 3.3.3
|
87
78
|
signing_key:
|
88
79
|
specification_version: 4
|
89
80
|
summary: Magro is a minimal image processing library for Ruby.
|
data/.coveralls.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
service_name: github-ci
|
data/.github/workflows/build.yml
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
name: build
|
2
|
-
|
3
|
-
on: [push, pull_request]
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
build:
|
7
|
-
runs-on: ubuntu-20.04
|
8
|
-
strategy:
|
9
|
-
matrix:
|
10
|
-
ruby: [ '2.5', '2.6', '2.7' ]
|
11
|
-
steps:
|
12
|
-
- uses: actions/checkout@v2
|
13
|
-
- name: Install libpng and libjpeg
|
14
|
-
run: sudo apt-get install -y libpng-dev libjpeg-dev
|
15
|
-
- name: Set up Ruby ${{ matrix.ruby }}
|
16
|
-
uses: actions/setup-ruby@v1
|
17
|
-
with:
|
18
|
-
ruby-version: ${{ matrix.ruby }}
|
19
|
-
- name: Build and test with Rake
|
20
|
-
run: |
|
21
|
-
gem install bundler
|
22
|
-
bundle install --jobs 4 --retry 3
|
23
|
-
bundle exec rake
|
@@ -1,29 +0,0 @@
|
|
1
|
-
name: coverage
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches: [ main ]
|
6
|
-
pull_request:
|
7
|
-
branches: [ main ]
|
8
|
-
|
9
|
-
jobs:
|
10
|
-
coverage:
|
11
|
-
runs-on: ubuntu-20.04
|
12
|
-
steps:
|
13
|
-
- uses: actions/checkout@v2
|
14
|
-
- name: Install libpng and libjpeg
|
15
|
-
run: sudo apt-get install -y libpng-dev libjpeg-dev
|
16
|
-
- uses: actions/checkout@v2
|
17
|
-
- name: Set up Ruby 2.7
|
18
|
-
uses: actions/setup-ruby@v1
|
19
|
-
with:
|
20
|
-
ruby-version: '2.7'
|
21
|
-
- name: Build and test with Rake
|
22
|
-
run: |
|
23
|
-
gem install bundler
|
24
|
-
bundle install
|
25
|
-
bundle exec rake
|
26
|
-
- name: Coveralls GitHub Action
|
27
|
-
uses: coverallsapp/github-action@v1.1.2
|
28
|
-
with:
|
29
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
data/.gitignore
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
/.bundle/
|
2
|
-
/.yardoc
|
3
|
-
/Gemfile.lock
|
4
|
-
/_yardoc/
|
5
|
-
/coverage/
|
6
|
-
/doc/
|
7
|
-
/pkg/
|
8
|
-
/spec/reports/
|
9
|
-
/tmp/
|
10
|
-
/spec/files/tmp.jpeg
|
11
|
-
/spec/files/tmp.png
|
12
|
-
/spec/files/tmp_UC.JPEG
|
13
|
-
/spec/files/tmp_UC.PNG
|
14
|
-
|
15
|
-
# rspec failure tracking
|
16
|
-
.rspec_status
|
17
|
-
|
18
|
-
*.swp
|
19
|
-
*.bundle
|
20
|
-
tags
|
21
|
-
.DS_Store
|
22
|
-
.ruby-version
|
data/.rspec
DELETED
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
2
|
-
|
3
|
-
## Our Pledge
|
4
|
-
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
6
|
-
contributors and maintainers pledge to making participation in our project and
|
7
|
-
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
-
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
-
orientation.
|
11
|
-
|
12
|
-
## Our Standards
|
13
|
-
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
15
|
-
include:
|
16
|
-
|
17
|
-
* Using welcoming and inclusive language
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
19
|
-
* Gracefully accepting constructive criticism
|
20
|
-
* Focusing on what is best for the community
|
21
|
-
* Showing empathy towards other community members
|
22
|
-
|
23
|
-
Examples of unacceptable behavior by participants include:
|
24
|
-
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
-
advances
|
27
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
-
* Public or private harassment
|
29
|
-
* Publishing others' private information, such as a physical or electronic
|
30
|
-
address, without explicit permission
|
31
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
-
professional setting
|
33
|
-
|
34
|
-
## Our Responsibilities
|
35
|
-
|
36
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
38
|
-
response to any instances of unacceptable behavior.
|
39
|
-
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
-
threatening, offensive, or harmful.
|
45
|
-
|
46
|
-
## Scope
|
47
|
-
|
48
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
-
when an individual is representing the project or its community. Examples of
|
50
|
-
representing a project or community include using an official project e-mail
|
51
|
-
address, posting via an official social media account, or acting as an appointed
|
52
|
-
representative at an online or offline event. Representation of a project may be
|
53
|
-
further defined and clarified by project maintainers.
|
54
|
-
|
55
|
-
## Enforcement
|
56
|
-
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at yoshoku@outlook.com. All
|
59
|
-
complaints will be reviewed and investigated and will result in a response that
|
60
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
63
|
-
|
64
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
-
faith may face temporary or permanent repercussions as determined by other
|
66
|
-
members of the project's leadership.
|
67
|
-
|
68
|
-
## Attribution
|
69
|
-
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
-
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
-
|
73
|
-
[homepage]: http://contributor-covenant.org
|
74
|
-
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in magro.gemspec
|
4
|
-
gemspec
|
5
|
-
|
6
|
-
gem 'bundler', '~> 2.0'
|
7
|
-
gem 'rake', '~> 12.0'
|
8
|
-
gem 'rake-compiler', '~> 1.0'
|
9
|
-
gem 'rspec', '~> 3.0'
|
10
|
-
gem 'simplecov', '~> 0.19'
|
11
|
-
gem 'simplecov-lcov', '~> 0.8'
|
data/Rakefile
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
2
|
-
require 'rspec/core/rake_task'
|
3
|
-
|
4
|
-
RSpec::Core::RakeTask.new(:spec)
|
5
|
-
|
6
|
-
require 'rake/extensiontask'
|
7
|
-
|
8
|
-
task build: :compile
|
9
|
-
|
10
|
-
Rake::ExtensionTask.new('magro') do |ext|
|
11
|
-
ext.lib_dir = 'lib/magro'
|
12
|
-
end
|
13
|
-
|
14
|
-
task default: %i[clobber compile spec]
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "magro"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|