chunky_png 1.0.0.beta2 → 1.0.0.rc1
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.
- data/.infinity_test +1 -1
- data/README.rdoc +2 -2
- data/chunky_png.gemspec +4 -4
- data/lib/chunky_png.rb +14 -8
- data/lib/chunky_png/canvas.rb +110 -38
- data/lib/chunky_png/canvas/drawing.rb +175 -34
- data/lib/chunky_png/canvas/masking.rb +91 -0
- data/lib/chunky_png/canvas/operations.rb +141 -112
- data/lib/chunky_png/canvas/png_decoding.rb +13 -13
- data/lib/chunky_png/canvas/resampling.rb +42 -0
- data/lib/chunky_png/color.rb +252 -11
- data/lib/chunky_png/compatibility.rb +5 -5
- data/lib/chunky_png/dimension.rb +106 -0
- data/lib/chunky_png/point.rb +110 -0
- data/lib/chunky_png/vector.rb +92 -0
- data/spec/chunky_png/canvas/drawing_spec.rb +107 -14
- data/spec/chunky_png/canvas/masking_spec.rb +51 -0
- data/spec/chunky_png/canvas/operations_spec.rb +142 -75
- data/spec/chunky_png/canvas/resampling_spec.rb +31 -0
- data/spec/chunky_png/canvas/stream_exporting_spec.rb +20 -0
- data/spec/chunky_png/canvas/stream_importing_spec.rb +22 -0
- data/spec/chunky_png/canvas_spec.rb +151 -22
- data/spec/chunky_png/color_spec.rb +53 -0
- data/spec/chunky_png/dimension_spec.rb +43 -0
- data/spec/chunky_png/point_spec.rb +71 -0
- data/spec/chunky_png/vector_spec.rb +58 -0
- data/spec/resources/circles.png +0 -0
- data/spec/resources/clock_nn_xdown_ydown.png +0 -0
- data/spec/resources/clock_nn_xdown_yup.png +0 -0
- data/spec/resources/clock_nn_xup_yup.png +0 -0
- data/spec/resources/lines.png +0 -0
- data/spec/resources/partial_circles.png +0 -0
- data/spec/resources/polygon_filled_horizontal.png +0 -0
- data/spec/resources/polygon_filled_vertical.png +0 -0
- data/spec/resources/polygon_triangle_filled.png +0 -0
- data/spec/resources/polygon_unfilled.png +0 -0
- data/spec/resources/rect.png +0 -0
- metadata +31 -9
- data/spec/resources/clock_flip_horizontally.png +0 -0
- data/spec/resources/clock_flip_vertically.png +0 -0
- data/spec/resources/clock_rotate_180.png +0 -0
- data/spec/resources/clock_rotate_left.png +0 -0
- data/spec/resources/clock_rotate_right.png +0 -0
- data/spec/resources/clock_stubbed.png +0 -0
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ChunkyPNG::Vector do
|
4
|
+
subject { ChunkyPNG::Vector.new([ChunkyPNG::Point.new(2, 4), ChunkyPNG::Point.new(1, 2), ChunkyPNG::Point.new(3, 6)]) }
|
5
|
+
|
6
|
+
it { should respond_to(:points) }
|
7
|
+
it { should have(3).items }
|
8
|
+
|
9
|
+
describe '#x_range' do
|
10
|
+
it "should get the right range of x values" do
|
11
|
+
subject.x_range.should == (1..3)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '#y_range' do
|
16
|
+
it "should get the right range of y values" do
|
17
|
+
subject.y_range.should == (2..6)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#edges' do
|
22
|
+
it "should get three edges when closing the path" do
|
23
|
+
subject.edges(true).to_a.should == [[ChunkyPNG::Point.new(2, 4), ChunkyPNG::Point.new(1, 2)],
|
24
|
+
[ChunkyPNG::Point.new(1, 2), ChunkyPNG::Point.new(3, 6)],
|
25
|
+
[ChunkyPNG::Point.new(3, 6), ChunkyPNG::Point.new(2, 4)]]
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should get two edges when not closing the path" do
|
29
|
+
subject.edges(false).to_a.should == [[ChunkyPNG::Point.new(2, 4), ChunkyPNG::Point.new(1, 2)],
|
30
|
+
[ChunkyPNG::Point.new(1, 2), ChunkyPNG::Point.new(3, 6)]]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe 'ChunkyPNG.Vector' do
|
36
|
+
subject { ChunkyPNG::Vector.new([ChunkyPNG::Point.new(2, 4), ChunkyPNG::Point.new(1, 2), ChunkyPNG::Point.new(3, 6)]) }
|
37
|
+
|
38
|
+
it "should return an empty vector when given an empty array" do
|
39
|
+
ChunkyPNG::Vector().should == ChunkyPNG::Vector.new([])
|
40
|
+
ChunkyPNG::Vector(*[]).should == ChunkyPNG::Vector.new([])
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should raise an error when an odd number of numerics is given" do
|
44
|
+
lambda { ChunkyPNG::Vector(1, 2, 3) }.should raise_error(ChunkyPNG::ExpectationFailed)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should create a vector from a string" do
|
48
|
+
ChunkyPNG::Vector('(2,4) (1,2) (3,6)').should == subject
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should create a vector from a flat array" do
|
52
|
+
ChunkyPNG::Vector(2,4,1,2,3,6).should == subject
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should create a vector from a nested array" do
|
56
|
+
ChunkyPNG::Vector('(2,4)', [1, 2], :x => 3, :y => 6).should == subject
|
57
|
+
end
|
58
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/spec/resources/lines.png
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/spec/resources/rect.png
CHANGED
Binary file
|
metadata
CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
|
|
6
6
|
- 1
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.0.
|
9
|
+
- rc1
|
10
|
+
version: 1.0.0.rc1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Willem van Bergen
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-02-24 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -72,28 +72,40 @@ files:
|
|
72
72
|
- lib/chunky_png/canvas.rb
|
73
73
|
- lib/chunky_png/canvas/adam7_interlacing.rb
|
74
74
|
- lib/chunky_png/canvas/drawing.rb
|
75
|
+
- lib/chunky_png/canvas/masking.rb
|
75
76
|
- lib/chunky_png/canvas/operations.rb
|
76
77
|
- lib/chunky_png/canvas/png_decoding.rb
|
77
78
|
- lib/chunky_png/canvas/png_encoding.rb
|
79
|
+
- lib/chunky_png/canvas/resampling.rb
|
78
80
|
- lib/chunky_png/canvas/stream_exporting.rb
|
79
81
|
- lib/chunky_png/canvas/stream_importing.rb
|
80
82
|
- lib/chunky_png/chunk.rb
|
81
83
|
- lib/chunky_png/color.rb
|
82
84
|
- lib/chunky_png/compatibility.rb
|
83
85
|
- lib/chunky_png/datastream.rb
|
86
|
+
- lib/chunky_png/dimension.rb
|
84
87
|
- lib/chunky_png/image.rb
|
85
88
|
- lib/chunky_png/palette.rb
|
89
|
+
- lib/chunky_png/point.rb
|
86
90
|
- lib/chunky_png/rmagick.rb
|
91
|
+
- lib/chunky_png/vector.rb
|
87
92
|
- spec/chunky_png/canvas/adam7_interlacing_spec.rb
|
88
93
|
- spec/chunky_png/canvas/drawing_spec.rb
|
94
|
+
- spec/chunky_png/canvas/masking_spec.rb
|
89
95
|
- spec/chunky_png/canvas/operations_spec.rb
|
90
96
|
- spec/chunky_png/canvas/png_decoding_spec.rb
|
91
97
|
- spec/chunky_png/canvas/png_encoding_spec.rb
|
98
|
+
- spec/chunky_png/canvas/resampling_spec.rb
|
99
|
+
- spec/chunky_png/canvas/stream_exporting_spec.rb
|
100
|
+
- spec/chunky_png/canvas/stream_importing_spec.rb
|
92
101
|
- spec/chunky_png/canvas_spec.rb
|
93
102
|
- spec/chunky_png/color_spec.rb
|
94
103
|
- spec/chunky_png/datastream_spec.rb
|
104
|
+
- spec/chunky_png/dimension_spec.rb
|
95
105
|
- spec/chunky_png/image_spec.rb
|
106
|
+
- spec/chunky_png/point_spec.rb
|
96
107
|
- spec/chunky_png/rmagick_spec.rb
|
108
|
+
- spec/chunky_png/vector_spec.rb
|
97
109
|
- spec/chunky_png_spec.rb
|
98
110
|
- spec/png_suite/background_chunks/bgai4a08.png
|
99
111
|
- spec/png_suite/background_chunks/bgai4a16.png
|
@@ -313,16 +325,14 @@ files:
|
|
313
325
|
- spec/png_suite/transparency/tp1n3p08.png
|
314
326
|
- spec/png_suite_spec.rb
|
315
327
|
- spec/resources/adam7.png
|
328
|
+
- spec/resources/circles.png
|
316
329
|
- spec/resources/clock.png
|
317
330
|
- spec/resources/clock_base.png
|
318
|
-
- spec/resources/clock_flip_horizontally.png
|
319
|
-
- spec/resources/clock_flip_vertically.png
|
320
331
|
- spec/resources/clock_mask.png
|
321
332
|
- spec/resources/clock_mask_updated.png
|
322
|
-
- spec/resources/
|
323
|
-
- spec/resources/
|
324
|
-
- spec/resources/
|
325
|
-
- spec/resources/clock_stubbed.png
|
333
|
+
- spec/resources/clock_nn_xdown_ydown.png
|
334
|
+
- spec/resources/clock_nn_xdown_yup.png
|
335
|
+
- spec/resources/clock_nn_xup_yup.png
|
326
336
|
- spec/resources/clock_updated.png
|
327
337
|
- spec/resources/composited.png
|
328
338
|
- spec/resources/cropped.png
|
@@ -330,11 +340,16 @@ files:
|
|
330
340
|
- spec/resources/damaged_signature.png
|
331
341
|
- spec/resources/lines.png
|
332
342
|
- spec/resources/operations.png
|
343
|
+
- spec/resources/partial_circles.png
|
333
344
|
- spec/resources/pixelstream.rgb
|
334
345
|
- spec/resources/pixelstream.rgba
|
335
346
|
- spec/resources/pixelstream_best_compression.png
|
336
347
|
- spec/resources/pixelstream_fast_rgba.png
|
337
348
|
- spec/resources/pixelstream_reference.png
|
349
|
+
- spec/resources/polygon_filled_horizontal.png
|
350
|
+
- spec/resources/polygon_filled_vertical.png
|
351
|
+
- spec/resources/polygon_triangle_filled.png
|
352
|
+
- spec/resources/polygon_unfilled.png
|
338
353
|
- spec/resources/rect.png
|
339
354
|
- spec/resources/replaced.png
|
340
355
|
- spec/resources/text_chunk.png
|
@@ -384,13 +399,20 @@ summary: Pure ruby library for read/write, chunk-level access to PNG files
|
|
384
399
|
test_files:
|
385
400
|
- spec/chunky_png/canvas/adam7_interlacing_spec.rb
|
386
401
|
- spec/chunky_png/canvas/drawing_spec.rb
|
402
|
+
- spec/chunky_png/canvas/masking_spec.rb
|
387
403
|
- spec/chunky_png/canvas/operations_spec.rb
|
388
404
|
- spec/chunky_png/canvas/png_decoding_spec.rb
|
389
405
|
- spec/chunky_png/canvas/png_encoding_spec.rb
|
406
|
+
- spec/chunky_png/canvas/resampling_spec.rb
|
407
|
+
- spec/chunky_png/canvas/stream_exporting_spec.rb
|
408
|
+
- spec/chunky_png/canvas/stream_importing_spec.rb
|
390
409
|
- spec/chunky_png/canvas_spec.rb
|
391
410
|
- spec/chunky_png/color_spec.rb
|
392
411
|
- spec/chunky_png/datastream_spec.rb
|
412
|
+
- spec/chunky_png/dimension_spec.rb
|
393
413
|
- spec/chunky_png/image_spec.rb
|
414
|
+
- spec/chunky_png/point_spec.rb
|
394
415
|
- spec/chunky_png/rmagick_spec.rb
|
416
|
+
- spec/chunky_png/vector_spec.rb
|
395
417
|
- spec/chunky_png_spec.rb
|
396
418
|
- spec/png_suite_spec.rb
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|