ruby_spriter 0.6.7.1 → 0.7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rspec +3 -3
- data/CHANGELOG.md +1035 -524
- data/Gemfile +17 -17
- data/LICENSE +21 -21
- data/README.md +183 -950
- data/bin/ruby_spriter +20 -20
- data/lib/ruby_spriter/background_sampler.rb +140 -0
- data/lib/ruby_spriter/batch_processor.rb +268 -214
- data/lib/ruby_spriter/cell_cleanup_config.rb +21 -0
- data/lib/ruby_spriter/cell_cleanup_gimp_script.rb +123 -0
- data/lib/ruby_spriter/cell_cleanup_processor.rb +230 -0
- data/lib/ruby_spriter/cli.rb +676 -612
- data/lib/ruby_spriter/compression_manager.rb +101 -101
- data/lib/ruby_spriter/consolidator.rb +179 -179
- data/lib/ruby_spriter/dependency_checker.rb +224 -224
- data/lib/ruby_spriter/ghost_edge_cleaner.rb +164 -0
- data/lib/ruby_spriter/gimp_processor.rb +1188 -1058
- data/lib/ruby_spriter/metadata_manager.rb +117 -116
- data/lib/ruby_spriter/platform.rb +137 -137
- data/lib/ruby_spriter/processor.rb +1230 -891
- data/lib/ruby_spriter/smoke_detector.rb +223 -0
- data/lib/ruby_spriter/threshold_stepper.rb +227 -0
- data/lib/ruby_spriter/utils/file_helper.rb +82 -82
- data/lib/ruby_spriter/utils/image_helper.rb +16 -0
- data/lib/ruby_spriter/utils/output_formatter.rb +65 -65
- data/lib/ruby_spriter/utils/path_helper.rb +59 -59
- data/lib/ruby_spriter/utils/spritesheet_splitter.rb +86 -86
- data/lib/ruby_spriter/version.rb +6 -7
- data/lib/ruby_spriter/video_processor.rb +357 -139
- data/lib/ruby_spriter.rb +38 -34
- data/ruby_spriter.gemspec +44 -42
- data/spec/fixtures/centered_sprite_with_inner_bg.png +0 -0
- data/spec/fixtures/centered_sprite_with_inner_bg_inner_removed.png +0 -0
- data/spec/fixtures/centered_sprite_with_inner_bg_threshold_stepped.png +0 -0
- data/spec/fixtures/complex_background_sprite.png +0 -0
- data/spec/fixtures/death - bloodborne rekconing.mp4 +0 -0
- data/spec/fixtures/death - bloodborne rekconing_spritesheet-nobg-global.png +0 -0
- data/spec/fixtures/death - bloodborne rekconing_spritesheet.png +0 -0
- data/spec/fixtures/death - bloodborne rekconing_spritesheet_20251110_185027_431-nobg-global.png +0 -0
- data/spec/fixtures/death - bloodborne rekconing_spritesheet_20251110_185027_431.png +0 -0
- data/spec/fixtures/death - bloodborne rekconing_spritesheet_20251110_185125_738-nobg-global.png +0 -0
- data/spec/fixtures/death - bloodborne rekconing_spritesheet_20251110_185125_738.png +0 -0
- data/spec/fixtures/has_inner_bg.png +0 -0
- data/spec/fixtures/has_small_inner_bg.png +0 -0
- data/spec/fixtures/smoke_effect_sprite.png +0 -0
- data/spec/fixtures/spritesheet_with_metadata.png +0 -0
- data/spec/fixtures/test_sprite.png +0 -0
- data/spec/fixtures/test_sprite_smoke_processed.png +0 -0
- data/spec/fixtures/test_video_spritesheet.png +0 -0
- data/spec/fixtures/transparent_bg_sprite.png +0 -0
- data/spec/fixtures/walk_north_sprite-sheet.png +0 -0
- data/spec/integration/no_fuzzy_mode_spec.rb +100 -0
- data/spec/ruby_spriter/batch_processor_spec.rb +509 -200
- data/spec/ruby_spriter/cli_spec.rb +2026 -1892
- data/spec/ruby_spriter/compression_manager_spec.rb +157 -157
- data/spec/ruby_spriter/consolidator_spec.rb +538 -538
- data/spec/ruby_spriter/gimp_processor_spec.rb +523 -425
- data/spec/ruby_spriter/platform_spec.rb +92 -92
- data/spec/ruby_spriter/processor_spec.rb +911 -735
- data/spec/ruby_spriter/utils/file_helper_spec.rb +150 -150
- data/spec/ruby_spriter/utils/path_helper_spec.rb +78 -78
- data/spec/ruby_spriter/utils/spritesheet_splitter_spec.rb +104 -104
- data/spec/ruby_spriter/video_processor_spec.rb +346 -29
- data/spec/spec_helper.rb +41 -41
- data/spec/tmp/cli_test_output.png +0 -0
- data/spec/tmp/cli_test_output_20251105_114647_395.png +0 -0
- data/spec/tmp/combined_test.png +0 -0
- data/spec/tmp/compat_test.png +0 -0
- data/spec/tmp/compat_test_20251030_174233_361.png +0 -0
- data/spec/tmp/final_all_features.png +0 -0
- data/spec/tmp/final_test_all_features.png +0 -0
- data/spec/tmp/full_pipeline_test.png +0 -0
- data/spec/tmp/inner_test.png +0 -0
- data/spec/tmp/integration_test.png +0 -0
- data/spec/tmp/validation_test.png +0 -0
- data/spec/unit/background_sampler_spec.rb +132 -0
- data/spec/unit/cell_cleanup_config_spec.rb +32 -0
- data/spec/unit/cell_cleanup_gimp_script_spec.rb +59 -0
- data/spec/unit/cell_cleanup_processor_spec.rb +261 -0
- data/spec/unit/ghost_edge_cleaner_spec.rb +223 -0
- data/spec/unit/gimp_processor_single_point_selection_spec.rb +81 -0
- data/spec/unit/smoke_detector_spec.rb +246 -0
- data/spec/unit/threshold_stepper_spec.rb +195 -0
- metadata +56 -10
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
RSpec.describe RubySpriter::Platform do
|
|
6
|
-
describe '.current' do
|
|
7
|
-
it 'returns a valid platform type' do
|
|
8
|
-
expect([:windows, :linux, :macos, :unknown]).to include(described_class.current)
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
describe '.windows?' do
|
|
13
|
-
it 'returns boolean' do
|
|
14
|
-
expect([true, false]).to include(described_class.windows?)
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
describe '.linux?' do
|
|
19
|
-
it 'returns boolean' do
|
|
20
|
-
expect([true, false]).to include(described_class.linux?)
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
describe '.macos?' do
|
|
25
|
-
it 'returns boolean' do
|
|
26
|
-
expect([true, false]).to include(described_class.macos?)
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
describe '.default_gimp_path' do
|
|
31
|
-
it 'returns a string path' do
|
|
32
|
-
expect(described_class.default_gimp_path).to be_a(String)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
it 'returns platform-appropriate path' do
|
|
36
|
-
path = described_class.default_gimp_path
|
|
37
|
-
|
|
38
|
-
if described_class.windows?
|
|
39
|
-
expect(path).to match(/GIMP/)
|
|
40
|
-
expect(path).to match(/\.exe$/)
|
|
41
|
-
else
|
|
42
|
-
expect(path).to start_with('/')
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
describe '.alternative_gimp_paths' do
|
|
48
|
-
it 'returns an array' do
|
|
49
|
-
expect(described_class.alternative_gimp_paths).to be_an(Array)
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
it 'contains only strings' do
|
|
53
|
-
described_class.alternative_gimp_paths.each do |path|
|
|
54
|
-
expect(path).to be_a(String)
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
describe '.imagemagick_convert_cmd' do
|
|
60
|
-
it 'returns appropriate command for platform' do
|
|
61
|
-
cmd = described_class.imagemagick_convert_cmd
|
|
62
|
-
|
|
63
|
-
if described_class.windows?
|
|
64
|
-
expect(cmd).to eq('magick convert')
|
|
65
|
-
else
|
|
66
|
-
expect(cmd).to eq('convert')
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
describe '.imagemagick_identify_cmd' do
|
|
72
|
-
it 'returns appropriate command for platform' do
|
|
73
|
-
cmd = described_class.imagemagick_identify_cmd
|
|
74
|
-
|
|
75
|
-
if described_class.windows?
|
|
76
|
-
expect(cmd).to eq('magick identify')
|
|
77
|
-
else
|
|
78
|
-
expect(cmd).to eq('identify')
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
describe '.detect_gimp_version' do
|
|
84
|
-
it 'detects GIMP 3.x version from command output' do
|
|
85
|
-
gimp3_output = "GNU Image Manipulation Program version 3.0.0"
|
|
86
|
-
version = described_class.detect_gimp_version(gimp3_output)
|
|
87
|
-
expect(version[:major]).to eq(3)
|
|
88
|
-
expect(version[:minor]).to eq(0)
|
|
89
|
-
expect(version[:full]).to eq('3.0.0')
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe RubySpriter::Platform do
|
|
6
|
+
describe '.current' do
|
|
7
|
+
it 'returns a valid platform type' do
|
|
8
|
+
expect([:windows, :linux, :macos, :unknown]).to include(described_class.current)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
describe '.windows?' do
|
|
13
|
+
it 'returns boolean' do
|
|
14
|
+
expect([true, false]).to include(described_class.windows?)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
describe '.linux?' do
|
|
19
|
+
it 'returns boolean' do
|
|
20
|
+
expect([true, false]).to include(described_class.linux?)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
describe '.macos?' do
|
|
25
|
+
it 'returns boolean' do
|
|
26
|
+
expect([true, false]).to include(described_class.macos?)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe '.default_gimp_path' do
|
|
31
|
+
it 'returns a string path' do
|
|
32
|
+
expect(described_class.default_gimp_path).to be_a(String)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'returns platform-appropriate path' do
|
|
36
|
+
path = described_class.default_gimp_path
|
|
37
|
+
|
|
38
|
+
if described_class.windows?
|
|
39
|
+
expect(path).to match(/GIMP/)
|
|
40
|
+
expect(path).to match(/\.exe$/)
|
|
41
|
+
else
|
|
42
|
+
expect(path).to start_with('/')
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
describe '.alternative_gimp_paths' do
|
|
48
|
+
it 'returns an array' do
|
|
49
|
+
expect(described_class.alternative_gimp_paths).to be_an(Array)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it 'contains only strings' do
|
|
53
|
+
described_class.alternative_gimp_paths.each do |path|
|
|
54
|
+
expect(path).to be_a(String)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
describe '.imagemagick_convert_cmd' do
|
|
60
|
+
it 'returns appropriate command for platform' do
|
|
61
|
+
cmd = described_class.imagemagick_convert_cmd
|
|
62
|
+
|
|
63
|
+
if described_class.windows?
|
|
64
|
+
expect(cmd).to eq('magick convert')
|
|
65
|
+
else
|
|
66
|
+
expect(cmd).to eq('convert')
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
describe '.imagemagick_identify_cmd' do
|
|
72
|
+
it 'returns appropriate command for platform' do
|
|
73
|
+
cmd = described_class.imagemagick_identify_cmd
|
|
74
|
+
|
|
75
|
+
if described_class.windows?
|
|
76
|
+
expect(cmd).to eq('magick identify')
|
|
77
|
+
else
|
|
78
|
+
expect(cmd).to eq('identify')
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
describe '.detect_gimp_version' do
|
|
84
|
+
it 'detects GIMP 3.x version from command output' do
|
|
85
|
+
gimp3_output = "GNU Image Manipulation Program version 3.0.0"
|
|
86
|
+
version = described_class.detect_gimp_version(gimp3_output)
|
|
87
|
+
expect(version[:major]).to eq(3)
|
|
88
|
+
expect(version[:minor]).to eq(0)
|
|
89
|
+
expect(version[:full]).to eq('3.0.0')
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|