bench9000 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 +7 -0
- data/LICENSE.txt +7 -0
- data/benchmarks/chunky_png/chunky-canvas-resampling-bilinear.rb +69 -0
- data/benchmarks/chunky_png/chunky-canvas-resampling-nearest-neighbor.rb +68 -0
- data/benchmarks/chunky_png/chunky-canvas-resampling-steps-residues.rb +37 -0
- data/benchmarks/chunky_png/chunky-canvas-resampling-steps.rb +37 -0
- data/benchmarks/chunky_png/chunky-color-a.rb +39 -0
- data/benchmarks/chunky_png/chunky-color-b.rb +39 -0
- data/benchmarks/chunky_png/chunky-color-compose-quick.rb +39 -0
- data/benchmarks/chunky_png/chunky-color-g.rb +39 -0
- data/benchmarks/chunky_png/chunky-color-r.rb +39 -0
- data/benchmarks/chunky_png/chunky-decode-png-image-pass.rb +74 -0
- data/benchmarks/chunky_png/chunky-encode-png-image-pass-to-stream.rb +84 -0
- data/benchmarks/chunky_png/chunky-operations-compose.rb +70 -0
- data/benchmarks/chunky_png/chunky-operations-replace.rb +69 -0
- data/benchmarks/chunky_png/chunky_png.patch +22 -0
- data/benchmarks/chunky_png/version.txt +2 -0
- data/benchmarks/classic/binary-trees.rb +100 -0
- data/benchmarks/classic/deltablue.rb +732 -0
- data/benchmarks/classic/fannkuch-redux.rb +111 -0
- data/benchmarks/classic/fasta-string.rb +71 -0
- data/benchmarks/classic/mandelbrot.rb +112 -0
- data/benchmarks/classic/matrix-multiply.rb +78 -0
- data/benchmarks/classic/n-body.rb +188 -0
- data/benchmarks/classic/pidigits.rb +88 -0
- data/benchmarks/classic/red-black.rb +363 -0
- data/benchmarks/classic/richards-kwargs.rb +403 -0
- data/benchmarks/classic/richards.rb +403 -0
- data/benchmarks/classic/spectral-norm.rb +95 -0
- data/benchmarks/default.config.rb +206 -0
- data/benchmarks/graph/connected.rb +62 -0
- data/benchmarks/literature/acid.rb +46 -0
- data/benchmarks/micro/pack-big-U-loop.rb +24 -0
- data/benchmarks/micro/pack-big-xLX-repeat.rb +22 -0
- data/benchmarks/micro/pack-small-mixture.rb +17 -0
- data/benchmarks/micro/string-equal.rb +28 -0
- data/benchmarks/octane/deltablue.rb +981 -0
- data/benchmarks/psd.rb/mock-logger.rb +23 -0
- data/benchmarks/psd.rb/psd-color-cmyk-to-rgb.rb +46 -0
- data/benchmarks/psd.rb/psd-compose-color-burn.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-color-dodge.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-darken.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-difference.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-exclusion.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-hard-light.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-hard-mix.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-lighten.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-linear-burn.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-linear-dodge.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-linear-light.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-multiply.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-normal.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-overlay.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-pin-light.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-screen.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-soft-light.rb +43 -0
- data/benchmarks/psd.rb/psd-compose-vivid-light.rb +43 -0
- data/benchmarks/psd.rb/psd-imageformat-layerraw-parse-raw.rb +70 -0
- data/benchmarks/psd.rb/psd-imageformat-rle-decode-rle-channel.rb +87 -0
- data/benchmarks/psd.rb/psd-imagemode-cmyk-combine-cmyk-channel.rb +65 -0
- data/benchmarks/psd.rb/psd-imagemode-greyscale-combine-greyscale-channel.rb +68 -0
- data/benchmarks/psd.rb/psd-imagemode-rgb-combine-rgb-channel.rb +65 -0
- data/benchmarks/psd.rb/psd-renderer-blender-compose.rb +113 -0
- data/benchmarks/psd.rb/psd-renderer-clippingmask-apply.rb +129 -0
- data/benchmarks/psd.rb/psd-renderer-mask-apply.rb +137 -0
- data/benchmarks/psd.rb/psd-util-clamp.rb +42 -0
- data/benchmarks/psd.rb/psd-util-pad2.rb +42 -0
- data/benchmarks/psd.rb/psd-util-pad4.rb +42 -0
- data/benchmarks/psd.rb/psd_native.patch +99 -0
- data/benchmarks/psd.rb/version.txt +2 -0
- data/benchmarks/topaz/neural-net.rb +208 -0
- data/benchmarks/vm/codeload.rb +35 -0
- data/benchmarks/vm/fixtures/codeload/LICENSE.txt +25 -0
- data/benchmarks/vm/fixtures/codeload/lexer.rb +21493 -0
- data/bin/bench9000 +13 -0
- data/example/report.data +945 -0
- data/example/report.html +59178 -0
- data/lib/bench9000.rb +27 -0
- data/lib/bench9000/benchmark.rb +29 -0
- data/lib/bench9000/commands/command.rb +30 -0
- data/lib/bench9000/commands/compare-reference.rb +70 -0
- data/lib/bench9000/commands/compare.rb +43 -0
- data/lib/bench9000/commands/detail.rb +51 -0
- data/lib/bench9000/commands/list-benchmarks.rb +29 -0
- data/lib/bench9000/commands/list-implementations.rb +29 -0
- data/lib/bench9000/commands/reference.rb +46 -0
- data/lib/bench9000/commands/remove.rb +41 -0
- data/lib/bench9000/commands/report.rb +71 -0
- data/lib/bench9000/commands/score.rb +27 -0
- data/lib/bench9000/config.rb +88 -0
- data/lib/bench9000/group.rb +23 -0
- data/lib/bench9000/harness.rb +68 -0
- data/lib/bench9000/implementation.rb +134 -0
- data/lib/bench9000/json-formatter.rb +50 -0
- data/lib/bench9000/main.rb +268 -0
- data/lib/bench9000/measurement.rb +75 -0
- data/lib/bench9000/micro-harness.rb +39 -0
- data/lib/bench9000/options.rb +31 -0
- data/lib/bench9000/report/bootstrap-theme.css +5 -0
- data/lib/bench9000/report/bootstrap.css +5 -0
- data/lib/bench9000/report/bootstrap.js +6 -0
- data/lib/bench9000/report/chart.js +3432 -0
- data/lib/bench9000/report/chartjs.patch +91 -0
- data/lib/bench9000/report/jquery.js +4 -0
- data/lib/bench9000/report/report.html +177 -0
- data/lib/bench9000/report/report.js +547 -0
- data/lib/bench9000/stats.rb +41 -0
- data/readme.md +205 -0
- data/vendor/chunky_png/BENCHMARKS.rdoc +31 -0
- data/vendor/chunky_png/Gemfile +10 -0
- data/vendor/chunky_png/LICENSE +20 -0
- data/vendor/chunky_png/README.rdoc +84 -0
- data/vendor/chunky_png/Rakefile +11 -0
- data/vendor/chunky_png/benchmarks/decoding_benchmark.rb +36 -0
- data/vendor/chunky_png/benchmarks/encoding_benchmark.rb +40 -0
- data/vendor/chunky_png/benchmarks/filesize_benchmark.rb +28 -0
- data/vendor/chunky_png/chunky_png.gemspec +47 -0
- data/vendor/chunky_png/lib/chunky_png.rb +160 -0
- data/vendor/chunky_png/lib/chunky_png/canvas.rb +372 -0
- data/vendor/chunky_png/lib/chunky_png/canvas/adam7_interlacing.rb +72 -0
- data/vendor/chunky_png/lib/chunky_png/canvas/data_url_exporting.rb +15 -0
- data/vendor/chunky_png/lib/chunky_png/canvas/data_url_importing.rb +21 -0
- data/vendor/chunky_png/lib/chunky_png/canvas/drawing.rb +338 -0
- data/vendor/chunky_png/lib/chunky_png/canvas/masking.rb +91 -0
- data/vendor/chunky_png/lib/chunky_png/canvas/operations.rb +395 -0
- data/vendor/chunky_png/lib/chunky_png/canvas/png_decoding.rb +492 -0
- data/vendor/chunky_png/lib/chunky_png/canvas/png_encoding.rb +442 -0
- data/vendor/chunky_png/lib/chunky_png/canvas/resampling.rb +147 -0
- data/vendor/chunky_png/lib/chunky_png/canvas/stream_exporting.rb +58 -0
- data/vendor/chunky_png/lib/chunky_png/canvas/stream_importing.rb +77 -0
- data/vendor/chunky_png/lib/chunky_png/chunk.rb +328 -0
- data/vendor/chunky_png/lib/chunky_png/color.rb +780 -0
- data/vendor/chunky_png/lib/chunky_png/compatibility.rb +15 -0
- data/vendor/chunky_png/lib/chunky_png/datastream.rb +185 -0
- data/vendor/chunky_png/lib/chunky_png/dimension.rb +113 -0
- data/vendor/chunky_png/lib/chunky_png/image.rb +79 -0
- data/vendor/chunky_png/lib/chunky_png/palette.rb +209 -0
- data/vendor/chunky_png/lib/chunky_png/point.rb +115 -0
- data/vendor/chunky_png/lib/chunky_png/rmagick.rb +43 -0
- data/vendor/chunky_png/lib/chunky_png/vector.rb +186 -0
- data/vendor/chunky_png/lib/chunky_png/version.rb +5 -0
- data/vendor/chunky_png/spec/chunky_png/canvas/adam7_interlacing_spec.rb +106 -0
- data/vendor/chunky_png/spec/chunky_png/canvas/data_url_exporting_spec.rb +13 -0
- data/vendor/chunky_png/spec/chunky_png/canvas/data_url_importing_spec.rb +15 -0
- data/vendor/chunky_png/spec/chunky_png/canvas/drawing_spec.rb +170 -0
- data/vendor/chunky_png/spec/chunky_png/canvas/masking_spec.rb +51 -0
- data/vendor/chunky_png/spec/chunky_png/canvas/operations_spec.rb +388 -0
- data/vendor/chunky_png/spec/chunky_png/canvas/png_decoding_spec.rb +97 -0
- data/vendor/chunky_png/spec/chunky_png/canvas/png_encoding_spec.rb +235 -0
- data/vendor/chunky_png/spec/chunky_png/canvas/resampling_spec.rb +121 -0
- data/vendor/chunky_png/spec/chunky_png/canvas/stream_exporting_spec.rb +59 -0
- data/vendor/chunky_png/spec/chunky_png/canvas/stream_importing_spec.rb +31 -0
- data/vendor/chunky_png/spec/chunky_png/canvas_spec.rb +226 -0
- data/vendor/chunky_png/spec/chunky_png/color_spec.rb +251 -0
- data/vendor/chunky_png/spec/chunky_png/datastream_spec.rb +32 -0
- data/vendor/chunky_png/spec/chunky_png/dimension_spec.rb +48 -0
- data/vendor/chunky_png/spec/chunky_png/image_spec.rb +25 -0
- data/vendor/chunky_png/spec/chunky_png/point_spec.rb +76 -0
- data/vendor/chunky_png/spec/chunky_png/rmagick_spec.rb +23 -0
- data/vendor/chunky_png/spec/chunky_png/vector_spec.rb +104 -0
- data/vendor/chunky_png/spec/chunky_png_spec.rb +8 -0
- data/vendor/chunky_png/spec/png_suite/background_chunks/bgai4a08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/background_chunks/bgai4a16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/background_chunks/bgan6a08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/background_chunks/bgan6a16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/background_chunks/bgbn4a08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/background_chunks/bggn4a16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/background_chunks/bgwn6a08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/background_chunks/bgyn6a16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi0g01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi0g01.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi0g02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi0g02.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi0g04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi0g04.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi0g08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi0g08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi0g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi0g16.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi2c08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi2c16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi2c16.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi3p01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi3p01.rgba +1 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi3p02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi3p02.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi3p04.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi3p08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi4a08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi4a08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi4a16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi4a16.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi6a08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi6a08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi6a16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basi6a16.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn0g01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn0g01.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn0g02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn0g02.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn0g04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn0g04.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn0g08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn0g08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn0g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn0g16.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn2c08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn2c16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn2c16.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn3p01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn3p01.rgba +1 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn3p02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn3p02.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn3p04.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn3p08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn4a08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn4a08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn4a16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn4a16.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn6a08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn6a08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn6a16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/basic/basn6a16.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/broken/x00n0g01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/broken/xcrn0g04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/broken/xlfn0g04.png +13 -0
- data/vendor/chunky_png/spec/png_suite/chunk_ordering/oi1n0g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/chunk_ordering/oi1n2c16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/chunk_ordering/oi2n0g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/chunk_ordering/oi2n2c16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/chunk_ordering/oi4n0g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/chunk_ordering/oi4n2c16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/chunk_ordering/oi9n0g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/chunk_ordering/oi9n2c16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/compression_levels/z00n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/compression_levels/z03n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/compression_levels/z06n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/compression_levels/z09n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f00n0g08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f00n0g08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f00n0g08_reference.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f00n0g08_reference.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f00n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f00n2c08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f00n2c08_reference.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f00n2c08_reference.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f01n0g08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f01n0g08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f01n0g08_reference.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f01n0g08_reference.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f01n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f01n2c08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f01n2c08_reference.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f01n2c08_reference.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f02n0g08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f02n0g08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f02n0g08_reference.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f02n0g08_reference.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f02n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f02n2c08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f02n2c08_reference.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f02n2c08_reference.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f03n0g08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f03n0g08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f03n0g08_reference.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f03n0g08_reference.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f03n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f03n2c08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f03n2c08_reference.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f03n2c08_reference.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f04n0g08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f04n0g08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f04n0g08_reference.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f04n0g08_reference.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f04n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f04n2c08.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f04n2c08_reference.png +0 -0
- data/vendor/chunky_png/spec/png_suite/filtering/f04n2c08_reference.rgba +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g03n0g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g03n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g03n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g04n0g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g04n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g04n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g05n0g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g05n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g05n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g07n0g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g07n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g07n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g10n0g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g10n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g10n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g25n0g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g25n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/gamma/g25n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/metadata/cm0n0g04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/metadata/cm7n0g04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/metadata/cm9n0g04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/ccwn2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/ccwn3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/cdfn2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/cdhn2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/cdsn2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/cdun2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/ch1n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/ch2n3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/cs3n2c16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/cs3n3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/cs5n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/cs5n3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/cs8n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/cs8n3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/ct0n0g04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/ct1n0g04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/ctzn0g04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/pp0n2c16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/pp0n6a08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/ps1n0g08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/ps1n2c16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/ps2n0g08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/other/ps2n2c16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s01i3p01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s01n3p01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s02i3p01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s02n3p01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s03i3p01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s03n3p01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s04i3p01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s04n3p01.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s05i3p02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s05n3p02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s06i3p02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s06n3p02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s07i3p02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s07n3p02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s08i3p02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s08n3p02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s09i3p02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s09n3p02.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s32i3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s32n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s33i3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s33n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s34i3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s34n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s35i3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s35n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s36i3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s36n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s37i3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s37n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s38i3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s38n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s39i3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s39n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s40i3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/sizes/s40n3p04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tbbn1g04.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tbbn2c16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tbbn3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tbgn2c16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tbgn3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tbrn2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tbwn1g16.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tbwn3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tbyn3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tp0n1g08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tp0n2c08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tp0n3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite/transparency/tp1n3p08.png +0 -0
- data/vendor/chunky_png/spec/png_suite_spec.rb +121 -0
- data/vendor/chunky_png/spec/resources/adam7.png +0 -0
- data/vendor/chunky_png/spec/resources/bezier_five_point.png +0 -0
- data/vendor/chunky_png/spec/resources/bezier_four_point.png +0 -0
- data/vendor/chunky_png/spec/resources/bezier_four_point_flipped.png +0 -0
- data/vendor/chunky_png/spec/resources/bezier_four_point_s.png +0 -0
- data/vendor/chunky_png/spec/resources/bezier_six_point.png +0 -0
- data/vendor/chunky_png/spec/resources/bezier_three_point.png +0 -0
- data/vendor/chunky_png/spec/resources/bezier_three_point_flipped.png +0 -0
- data/vendor/chunky_png/spec/resources/circles.png +0 -0
- data/vendor/chunky_png/spec/resources/clock.png +0 -0
- data/vendor/chunky_png/spec/resources/clock_base.png +0 -0
- data/vendor/chunky_png/spec/resources/clock_bl_xdown_ydown.png +0 -0
- data/vendor/chunky_png/spec/resources/clock_bl_xdown_yup.png +0 -0
- data/vendor/chunky_png/spec/resources/clock_bl_xup_yup.png +0 -0
- data/vendor/chunky_png/spec/resources/clock_mask.png +0 -0
- data/vendor/chunky_png/spec/resources/clock_mask_updated.png +0 -0
- data/vendor/chunky_png/spec/resources/clock_nn_xdown_ydown.png +0 -0
- data/vendor/chunky_png/spec/resources/clock_nn_xdown_yup.png +0 -0
- data/vendor/chunky_png/spec/resources/clock_nn_xup_yup.png +0 -0
- data/vendor/chunky_png/spec/resources/clock_updated.png +0 -0
- data/vendor/chunky_png/spec/resources/composited.png +0 -0
- data/vendor/chunky_png/spec/resources/cropped.png +0 -0
- data/vendor/chunky_png/spec/resources/damaged_chunk.png +0 -0
- data/vendor/chunky_png/spec/resources/damaged_signature.png +13 -0
- data/vendor/chunky_png/spec/resources/lines.png +0 -0
- data/vendor/chunky_png/spec/resources/operations.png +0 -0
- data/vendor/chunky_png/spec/resources/operations_border.png +0 -0
- data/vendor/chunky_png/spec/resources/operations_grayscale.png +0 -0
- data/vendor/chunky_png/spec/resources/partial_circles.png +0 -0
- data/vendor/chunky_png/spec/resources/pixelstream.bgr +67 -0
- data/vendor/chunky_png/spec/resources/pixelstream.rgb +67 -1
- data/vendor/chunky_png/spec/resources/pixelstream.rgba +67 -0
- data/vendor/chunky_png/spec/resources/pixelstream_best_compression.png +0 -0
- data/vendor/chunky_png/spec/resources/pixelstream_fast_rgba.png +0 -0
- data/vendor/chunky_png/spec/resources/pixelstream_reference.png +0 -0
- data/vendor/chunky_png/spec/resources/polygon_filled_horizontal.png +0 -0
- data/vendor/chunky_png/spec/resources/polygon_filled_vertical.png +0 -0
- data/vendor/chunky_png/spec/resources/polygon_triangle_filled.png +0 -0
- data/vendor/chunky_png/spec/resources/polygon_unfilled.png +0 -0
- data/vendor/chunky_png/spec/resources/rect.png +0 -0
- data/vendor/chunky_png/spec/resources/replaced.png +0 -0
- data/vendor/chunky_png/spec/resources/text_chunk.png +0 -0
- data/vendor/chunky_png/spec/resources/ztxt_chunk.png +0 -0
- data/vendor/chunky_png/spec/spec_helper.rb +52 -0
- data/vendor/chunky_png/tasks/benchmarks.rake +26 -0
- data/vendor/oily_png/Gemfile +4 -0
- data/vendor/oily_png/LICENSE +20 -0
- data/vendor/oily_png/README.rdoc +26 -0
- data/vendor/oily_png/Rakefile +19 -0
- data/vendor/oily_png/ext/oily_png/color.c +58 -0
- data/vendor/oily_png/ext/oily_png/color.h +29 -0
- data/vendor/oily_png/ext/oily_png/extconf.rb +3 -0
- data/vendor/oily_png/ext/oily_png/oily_png_ext.c +59 -0
- data/vendor/oily_png/ext/oily_png/oily_png_ext.h +72 -0
- data/vendor/oily_png/ext/oily_png/operations.c +122 -0
- data/vendor/oily_png/ext/oily_png/operations.h +36 -0
- data/vendor/oily_png/ext/oily_png/png_decoding.c +374 -0
- data/vendor/oily_png/ext/oily_png/png_decoding.h +27 -0
- data/vendor/oily_png/ext/oily_png/png_encoding.c +302 -0
- data/vendor/oily_png/ext/oily_png/png_encoding.h +19 -0
- data/vendor/oily_png/ext/oily_png/resampling.c +213 -0
- data/vendor/oily_png/ext/oily_png/resampling.h +25 -0
- data/vendor/oily_png/lib/oily_png.rb +21 -0
- data/vendor/oily_png/lib/oily_png/canvas.rb +15 -0
- data/vendor/oily_png/lib/oily_png/version.rb +3 -0
- data/vendor/oily_png/oily_png.gemspec +39 -0
- data/vendor/oily_png/spec/color_spec.rb +38 -0
- data/vendor/oily_png/spec/decoding_spec.rb +51 -0
- data/vendor/oily_png/spec/encoding_spec.rb +135 -0
- data/vendor/oily_png/spec/operations_spec.rb +52 -0
- data/vendor/oily_png/spec/resampling_spec.rb +51 -0
- data/vendor/oily_png/spec/resources/basi0g01.png +0 -0
- data/vendor/oily_png/spec/resources/basi0g02.png +0 -0
- data/vendor/oily_png/spec/resources/basi0g04.png +0 -0
- data/vendor/oily_png/spec/resources/basi0g08.png +0 -0
- data/vendor/oily_png/spec/resources/basi0g16.png +0 -0
- data/vendor/oily_png/spec/resources/basi2c08.png +0 -0
- data/vendor/oily_png/spec/resources/basi2c16.png +0 -0
- data/vendor/oily_png/spec/resources/basi3p01.png +0 -0
- data/vendor/oily_png/spec/resources/basi3p02.png +0 -0
- data/vendor/oily_png/spec/resources/basi3p04.png +0 -0
- data/vendor/oily_png/spec/resources/basi3p08.png +0 -0
- data/vendor/oily_png/spec/resources/basi4a08.png +0 -0
- data/vendor/oily_png/spec/resources/basi4a16.png +0 -0
- data/vendor/oily_png/spec/resources/basi6a08.png +0 -0
- data/vendor/oily_png/spec/resources/basi6a16.png +0 -0
- data/vendor/oily_png/spec/resources/basn0g01.png +0 -0
- data/vendor/oily_png/spec/resources/basn0g02.png +0 -0
- data/vendor/oily_png/spec/resources/basn0g04.png +0 -0
- data/vendor/oily_png/spec/resources/basn0g08.png +0 -0
- data/vendor/oily_png/spec/resources/basn0g16.png +0 -0
- data/vendor/oily_png/spec/resources/basn2c08.png +0 -0
- data/vendor/oily_png/spec/resources/basn2c16.png +0 -0
- data/vendor/oily_png/spec/resources/basn3p01.png +0 -0
- data/vendor/oily_png/spec/resources/basn3p02.png +0 -0
- data/vendor/oily_png/spec/resources/basn3p04.png +0 -0
- data/vendor/oily_png/spec/resources/basn3p08.png +0 -0
- data/vendor/oily_png/spec/resources/basn4a08.png +0 -0
- data/vendor/oily_png/spec/resources/basn4a16.png +0 -0
- data/vendor/oily_png/spec/resources/basn6a08.png +0 -0
- data/vendor/oily_png/spec/resources/basn6a16.png +0 -0
- data/vendor/oily_png/spec/resources/composited.png +0 -0
- data/vendor/oily_png/spec/resources/gray.png +0 -0
- data/vendor/oily_png/spec/resources/interlaced.png +0 -0
- data/vendor/oily_png/spec/resources/nonsquare.png +0 -0
- data/vendor/oily_png/spec/resources/operations.png +0 -0
- data/vendor/oily_png/spec/resources/replaced.png +0 -0
- data/vendor/oily_png/spec/resources/s01i3p01.png +0 -0
- data/vendor/oily_png/spec/resources/s01n3p01.png +0 -0
- data/vendor/oily_png/spec/resources/s02i3p01.png +0 -0
- data/vendor/oily_png/spec/resources/s02n3p01.png +0 -0
- data/vendor/oily_png/spec/resources/s03i3p01.png +0 -0
- data/vendor/oily_png/spec/resources/s03n3p01.png +0 -0
- data/vendor/oily_png/spec/resources/s04i3p01.png +0 -0
- data/vendor/oily_png/spec/resources/s04n3p01.png +0 -0
- data/vendor/oily_png/spec/resources/s05i3p02.png +0 -0
- data/vendor/oily_png/spec/resources/s05n3p02.png +0 -0
- data/vendor/oily_png/spec/resources/s06i3p02.png +0 -0
- data/vendor/oily_png/spec/resources/s06n3p02.png +0 -0
- data/vendor/oily_png/spec/resources/s07i3p02.png +0 -0
- data/vendor/oily_png/spec/resources/s07n3p02.png +0 -0
- data/vendor/oily_png/spec/resources/s08i3p02.png +0 -0
- data/vendor/oily_png/spec/resources/s08n3p02.png +0 -0
- data/vendor/oily_png/spec/resources/s09i3p02.png +0 -0
- data/vendor/oily_png/spec/resources/s09n3p02.png +0 -0
- data/vendor/oily_png/spec/resources/s32i3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s32n3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s33i3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s33n3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s34i3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s34n3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s35i3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s35n3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s36i3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s36n3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s37i3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s37n3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s38i3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s38n3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s39i3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s39n3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s40i3p04.png +0 -0
- data/vendor/oily_png/spec/resources/s40n3p04.png +0 -0
- data/vendor/oily_png/spec/resources/square.png +0 -0
- data/vendor/oily_png/spec/resources/tbbn1g04.png +0 -0
- data/vendor/oily_png/spec/resources/tbbn2c16.png +0 -0
- data/vendor/oily_png/spec/resources/tbbn3p08.png +0 -0
- data/vendor/oily_png/spec/resources/tbgn2c16.png +0 -0
- data/vendor/oily_png/spec/resources/tbgn3p08.png +0 -0
- data/vendor/oily_png/spec/resources/tbrn2c08.png +0 -0
- data/vendor/oily_png/spec/resources/tbwn1g16.png +0 -0
- data/vendor/oily_png/spec/resources/tbwn3p08.png +0 -0
- data/vendor/oily_png/spec/resources/tbyn3p08.png +0 -0
- data/vendor/oily_png/spec/resources/tp0n1g08.png +0 -0
- data/vendor/oily_png/spec/resources/tp0n2c08.png +0 -0
- data/vendor/oily_png/spec/resources/tp0n3p08.png +0 -0
- data/vendor/oily_png/spec/resources/tp1n3p08.png +0 -0
- data/vendor/oily_png/spec/spec_helper.rb +40 -0
- data/vendor/oily_png/tasks/testing.rake +49 -0
- data/vendor/psd.rb/CONTRIBUTING.md +7 -0
- data/vendor/psd.rb/Gemfile +2 -0
- data/vendor/psd.rb/Guardfile +8 -0
- data/vendor/psd.rb/LICENSE.txt +22 -0
- data/vendor/psd.rb/README.md +235 -0
- data/vendor/psd.rb/Rakefile +6 -0
- data/vendor/psd.rb/circle.yml +6 -0
- data/vendor/psd.rb/examples/build_image.rb +16 -0
- data/vendor/psd.rb/examples/export_image.rb +12 -0
- data/vendor/psd.rb/examples/export_layer_images.rb +19 -0
- data/vendor/psd.rb/examples/export_node.rb +7 -0
- data/vendor/psd.rb/examples/export_text_data.rb +13 -0
- data/vendor/psd.rb/examples/guides.rb +17 -0
- data/vendor/psd.rb/examples/images/comp-example.psd +0 -0
- data/vendor/psd.rb/examples/images/example-cmyk.psd +0 -0
- data/vendor/psd.rb/examples/images/example-greyscale.psd +0 -0
- data/vendor/psd.rb/examples/images/example-nocompat.psd +0 -0
- data/vendor/psd.rb/examples/images/example.psd +0 -0
- data/vendor/psd.rb/examples/images/example16.psd +0 -0
- data/vendor/psd.rb/examples/images/guides.psd +0 -0
- data/vendor/psd.rb/examples/layer_comps.rb +20 -0
- data/vendor/psd.rb/examples/parse.rb +36 -0
- data/vendor/psd.rb/examples/path.rb +7 -0
- data/vendor/psd.rb/examples/profile.rb +15 -0
- data/vendor/psd.rb/examples/slices.rb +17 -0
- data/vendor/psd.rb/examples/tree.rb +8 -0
- data/vendor/psd.rb/examples/unimplemented_info.rb +9 -0
- data/vendor/psd.rb/lib/psd.rb +173 -0
- data/vendor/psd.rb/lib/psd/blend_mode.rb +80 -0
- data/vendor/psd.rb/lib/psd/channel_image.rb +115 -0
- data/vendor/psd.rb/lib/psd/color.rb +125 -0
- data/vendor/psd.rb/lib/psd/descriptor.rb +200 -0
- data/vendor/psd.rb/lib/psd/file.rb +104 -0
- data/vendor/psd.rb/lib/psd/header.rb +69 -0
- data/vendor/psd.rb/lib/psd/helpers.rb +51 -0
- data/vendor/psd.rb/lib/psd/image.rb +123 -0
- data/vendor/psd.rb/lib/psd/image_exports/png.rb +31 -0
- data/vendor/psd.rb/lib/psd/image_formats/layer_raw.rb +21 -0
- data/vendor/psd.rb/lib/psd/image_formats/layer_rle.rb +24 -0
- data/vendor/psd.rb/lib/psd/image_formats/raw.rb +12 -0
- data/vendor/psd.rb/lib/psd/image_formats/rle.rb +63 -0
- data/vendor/psd.rb/lib/psd/image_modes/cmyk.rb +31 -0
- data/vendor/psd.rb/lib/psd/image_modes/greyscale.rb +22 -0
- data/vendor/psd.rb/lib/psd/image_modes/rgb.rb +32 -0
- data/vendor/psd.rb/lib/psd/layer.rb +77 -0
- data/vendor/psd.rb/lib/psd/layer/blend_modes.rb +30 -0
- data/vendor/psd.rb/lib/psd/layer/blending_ranges.rb +62 -0
- data/vendor/psd.rb/lib/psd/layer/channel_image.rb +15 -0
- data/vendor/psd.rb/lib/psd/layer/exporting.rb +28 -0
- data/vendor/psd.rb/lib/psd/layer/helpers.rb +77 -0
- data/vendor/psd.rb/lib/psd/layer/info.rb +74 -0
- data/vendor/psd.rb/lib/psd/layer/mask.rb +19 -0
- data/vendor/psd.rb/lib/psd/layer/name.rb +33 -0
- data/vendor/psd.rb/lib/psd/layer/path_components.rb +22 -0
- data/vendor/psd.rb/lib/psd/layer/position_and_channels.rb +47 -0
- data/vendor/psd.rb/lib/psd/layer_info.rb +27 -0
- data/vendor/psd.rb/lib/psd/layer_info/blend_clipping_elements.rb +13 -0
- data/vendor/psd.rb/lib/psd/layer_info/blend_interior_elements.rb +13 -0
- data/vendor/psd.rb/lib/psd/layer_info/fill_opacity.rb +13 -0
- data/vendor/psd.rb/lib/psd/layer_info/layer_group.rb +30 -0
- data/vendor/psd.rb/lib/psd/layer_info/layer_id.rb +13 -0
- data/vendor/psd.rb/lib/psd/layer_info/layer_name_source.rb +14 -0
- data/vendor/psd.rb/lib/psd/layer_info/layer_section_divider.rb +48 -0
- data/vendor/psd.rb/lib/psd/layer_info/legacy_typetool.rb +88 -0
- data/vendor/psd.rb/lib/psd/layer_info/locked.rb +19 -0
- data/vendor/psd.rb/lib/psd/layer_info/metadata_setting.rb +35 -0
- data/vendor/psd.rb/lib/psd/layer_info/object_effects.rb +16 -0
- data/vendor/psd.rb/lib/psd/layer_info/placed_layer.rb +13 -0
- data/vendor/psd.rb/lib/psd/layer_info/reference_point.rb +16 -0
- data/vendor/psd.rb/lib/psd/layer_info/typetool.rb +165 -0
- data/vendor/psd.rb/lib/psd/layer_info/unicode_name.rb +17 -0
- data/vendor/psd.rb/lib/psd/layer_info/vector_mask.rb +25 -0
- data/vendor/psd.rb/lib/psd/layer_info/vector_mask_2.rb +10 -0
- data/vendor/psd.rb/lib/psd/layer_info/vector_stroke.rb +12 -0
- data/vendor/psd.rb/lib/psd/layer_info/vector_stroke_content.rb +15 -0
- data/vendor/psd.rb/lib/psd/layer_mask.rb +129 -0
- data/vendor/psd.rb/lib/psd/lazy_execute.rb +60 -0
- data/vendor/psd.rb/lib/psd/logger.rb +40 -0
- data/vendor/psd.rb/lib/psd/mask.rb +74 -0
- data/vendor/psd.rb/lib/psd/node.rb +70 -0
- data/vendor/psd.rb/lib/psd/node_exporting.rb +20 -0
- data/vendor/psd.rb/lib/psd/node_group.rb +86 -0
- data/vendor/psd.rb/lib/psd/node_layer.rb +81 -0
- data/vendor/psd.rb/lib/psd/node_root.rb +93 -0
- data/vendor/psd.rb/lib/psd/nodes/ancestry.rb +98 -0
- data/vendor/psd.rb/lib/psd/nodes/build_preview.rb +17 -0
- data/vendor/psd.rb/lib/psd/nodes/has_children.rb +13 -0
- data/vendor/psd.rb/lib/psd/nodes/lock_to_origin.rb +7 -0
- data/vendor/psd.rb/lib/psd/nodes/parse_layers.rb +18 -0
- data/vendor/psd.rb/lib/psd/nodes/search.rb +91 -0
- data/vendor/psd.rb/lib/psd/path_record.rb +180 -0
- data/vendor/psd.rb/lib/psd/renderer.rb +91 -0
- data/vendor/psd.rb/lib/psd/renderer/blender.rb +53 -0
- data/vendor/psd.rb/lib/psd/renderer/canvas.rb +95 -0
- data/vendor/psd.rb/lib/psd/renderer/canvas_management.rb +26 -0
- data/vendor/psd.rb/lib/psd/renderer/clipping_mask.rb +41 -0
- data/vendor/psd.rb/lib/psd/renderer/compose.rb +361 -0
- data/vendor/psd.rb/lib/psd/renderer/layer_styles.rb +56 -0
- data/vendor/psd.rb/lib/psd/renderer/layer_styles/color_overlay.rb +65 -0
- data/vendor/psd.rb/lib/psd/renderer/layer_styles/drop_shadow.rb +75 -0
- data/vendor/psd.rb/lib/psd/renderer/mask.rb +46 -0
- data/vendor/psd.rb/lib/psd/resource.rb +26 -0
- data/vendor/psd.rb/lib/psd/resource_section.rb +22 -0
- data/vendor/psd.rb/lib/psd/resources.rb +69 -0
- data/vendor/psd.rb/lib/psd/resources/guides.rb +35 -0
- data/vendor/psd.rb/lib/psd/resources/layer_comps.rb +42 -0
- data/vendor/psd.rb/lib/psd/resources/slices.rb +132 -0
- data/vendor/psd.rb/lib/psd/section.rb +26 -0
- data/vendor/psd.rb/lib/psd/util.rb +18 -0
- data/vendor/psd.rb/lib/psd/version.rb +3 -0
- data/vendor/psd.rb/psd.gemspec +32 -0
- data/vendor/psd.rb/spec/files/blendmodes.psd +0 -0
- data/vendor/psd.rb/spec/files/empty-layer-subgroups.psd +0 -0
- data/vendor/psd.rb/spec/files/empty-layer.psd +0 -0
- data/vendor/psd.rb/spec/files/example.psd +0 -0
- data/vendor/psd.rb/spec/files/guides.psd +0 -0
- data/vendor/psd.rb/spec/files/locked.psd +0 -0
- data/vendor/psd.rb/spec/files/one_layer.psd +0 -0
- data/vendor/psd.rb/spec/files/path.psd +0 -0
- data/vendor/psd.rb/spec/files/pixel.psd +0 -0
- data/vendor/psd.rb/spec/files/simplest.psd +0 -0
- data/vendor/psd.rb/spec/files/slices.psd +0 -0
- data/vendor/psd.rb/spec/files/text.psd +0 -0
- data/vendor/psd.rb/spec/guides_spec.rb +34 -0
- data/vendor/psd.rb/spec/hierarchy_spec.rb +152 -0
- data/vendor/psd.rb/spec/image_spec.rb +86 -0
- data/vendor/psd.rb/spec/lazy_execute_spec.rb +20 -0
- data/vendor/psd.rb/spec/locked_spec.rb +78 -0
- data/vendor/psd.rb/spec/parsing_spec.rb +163 -0
- data/vendor/psd.rb/spec/psd_spec.rb +37 -0
- data/vendor/psd.rb/spec/slices_spec.rb +57 -0
- data/vendor/psd.rb/spec/spec_helper.rb +13 -0
- data/vendor/psd.rb/spec/text_spec.rb +27 -0
- data/vendor/psd_native/Gemfile +4 -0
- data/vendor/psd_native/Guardfile +6 -0
- data/vendor/psd_native/LICENSE.txt +22 -0
- data/vendor/psd_native/README.md +48 -0
- data/vendor/psd_native/Rakefile +13 -0
- data/vendor/psd_native/ext/psd_native/blender.c +57 -0
- data/vendor/psd_native/ext/psd_native/blender.h +6 -0
- data/vendor/psd_native/ext/psd_native/canvas.c +9 -0
- data/vendor/psd_native/ext/psd_native/canvas.h +6 -0
- data/vendor/psd_native/ext/psd_native/clipping_mask.c +57 -0
- data/vendor/psd_native/ext/psd_native/clipping_mask.h +6 -0
- data/vendor/psd_native/ext/psd_native/color.c +20 -0
- data/vendor/psd_native/ext/psd_native/color.h +18 -0
- data/vendor/psd_native/ext/psd_native/compose.c +394 -0
- data/vendor/psd_native/ext/psd_native/compose.h +43 -0
- data/vendor/psd_native/ext/psd_native/extconf.rb +3 -0
- data/vendor/psd_native/ext/psd_native/file.c +20 -0
- data/vendor/psd_native/ext/psd_native/file.h +9 -0
- data/vendor/psd_native/ext/psd_native/image_mode_cmyk.c +64 -0
- data/vendor/psd_native/ext/psd_native/image_mode_cmyk.h +6 -0
- data/vendor/psd_native/ext/psd_native/image_mode_greyscale.c +27 -0
- data/vendor/psd_native/ext/psd_native/image_mode_greyscale.h +6 -0
- data/vendor/psd_native/ext/psd_native/image_mode_rgb.c +49 -0
- data/vendor/psd_native/ext/psd_native/image_mode_rgb.h +6 -0
- data/vendor/psd_native/ext/psd_native/layer_raw.c +20 -0
- data/vendor/psd_native/ext/psd_native/layer_raw.h +6 -0
- data/vendor/psd_native/ext/psd_native/mask.c +52 -0
- data/vendor/psd_native/ext/psd_native/mask.h +6 -0
- data/vendor/psd_native/ext/psd_native/psd_native_ext.c +87 -0
- data/vendor/psd_native/ext/psd_native/psd_native_ext.h +31 -0
- data/vendor/psd_native/ext/psd_native/rle_decoding.c +53 -0
- data/vendor/psd_native/ext/psd_native/rle_decoding.h +6 -0
- data/vendor/psd_native/ext/psd_native/util.c +17 -0
- data/vendor/psd_native/ext/psd_native/util.h +8 -0
- data/vendor/psd_native/lib/psd_native.rb +35 -0
- data/vendor/psd_native/lib/psd_native/compose.rb +19 -0
- data/vendor/psd_native/lib/psd_native/version.rb +3 -0
- data/vendor/psd_native/psd_native.gemspec +35 -0
- data/vendor/psd_native/spec/files/example.psd +0 -0
- data/vendor/psd_native/spec/files/one_layer.psd +0 -0
- data/vendor/psd_native/spec/files/path.psd +0 -0
- data/vendor/psd_native/spec/files/pixel.psd +0 -0
- data/vendor/psd_native/spec/files/simplest.psd +0 -0
- data/vendor/psd_native/spec/files/text.psd +0 -0
- data/vendor/psd_native/spec/image_spec.rb +86 -0
- data/vendor/psd_native/spec/psd_spec.rb +37 -0
- data/vendor/psd_native/spec/spec_helper.rb +13 -0
- data/vendor/psd_native/spec/util_spec.rb +15 -0
- metadata +767 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'bundler/setup'
|
|
3
|
+
|
|
4
|
+
require 'benchmark'
|
|
5
|
+
require 'chunky_png'
|
|
6
|
+
|
|
7
|
+
image = ChunkyPNG::Image.new(240, 180, ChunkyPNG::Color::TRANSPARENT)
|
|
8
|
+
|
|
9
|
+
# set some random pixels
|
|
10
|
+
image[10, 20] = ChunkyPNG::Color.rgba(255, 0, 0, 255)
|
|
11
|
+
image[50, 87] = ChunkyPNG::Color.rgba( 0, 255, 0, 255)
|
|
12
|
+
image[33, 99] = ChunkyPNG::Color.rgba( 0, 0, 255, 255)
|
|
13
|
+
|
|
14
|
+
n = (ENV['N'] || '5').to_i
|
|
15
|
+
|
|
16
|
+
puts "---------------------------------------------"
|
|
17
|
+
puts "ChunkyPNG (#{ChunkyPNG::VERSION}) encoding benchmark (n=#{n})"
|
|
18
|
+
puts "---------------------------------------------"
|
|
19
|
+
puts
|
|
20
|
+
|
|
21
|
+
Benchmark.bmbm do |x|
|
|
22
|
+
x.report('Autodetect (indexed)') { n.times { image.to_blob } }
|
|
23
|
+
|
|
24
|
+
# Presets
|
|
25
|
+
x.report(':no_compression') { n.times { image.to_blob(:no_compression) } }
|
|
26
|
+
x.report(':fast_rgba') { n.times { image.to_blob(:fast_rgba) } }
|
|
27
|
+
x.report(':fast_rgb') { n.times { image.to_blob(:fast_rgb) } }
|
|
28
|
+
x.report(':good_compression') { n.times { image.to_blob(:good_compression) } }
|
|
29
|
+
x.report(':best_compression') { n.times { image.to_blob(:best_compression) } }
|
|
30
|
+
|
|
31
|
+
# Some options
|
|
32
|
+
x.report(':rgb') { n.times { image.to_blob(:color_mode => ChunkyPNG::COLOR_TRUECOLOR) } }
|
|
33
|
+
x.report(':rgba') { n.times { image.to_blob(:color_mode => ChunkyPNG::COLOR_TRUECOLOR_ALPHA) } }
|
|
34
|
+
x.report(':indexed') { n.times { image.to_blob(:color_mode => ChunkyPNG::COLOR_INDEXED) } }
|
|
35
|
+
x.report(':interlaced') { n.times { image.to_blob(:interlaced => true) } }
|
|
36
|
+
|
|
37
|
+
# Exports
|
|
38
|
+
x.report('to RGBA pixelstream') { n.times { image.to_rgba_stream } }
|
|
39
|
+
x.report('to RGB pixelstream') { n.times { image.to_rgb_stream } }
|
|
40
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'bundler/setup'
|
|
3
|
+
|
|
4
|
+
require 'benchmark'
|
|
5
|
+
require 'chunky_png'
|
|
6
|
+
|
|
7
|
+
files = ['pixelstream_reference.png', 'operations.png', 'clock_stubbed.png']
|
|
8
|
+
|
|
9
|
+
def encode_png(image, constraints = {})
|
|
10
|
+
filesize = nil
|
|
11
|
+
time = Benchmark.realtime { filesize = image.to_blob(constraints).bytesize }
|
|
12
|
+
[filesize, time]
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
files.each do |file|
|
|
16
|
+
filename = File.join(File.dirname(__FILE__), '..', 'spec', 'resources', file)
|
|
17
|
+
image = ChunkyPNG::Canvas.from_file(filename)
|
|
18
|
+
|
|
19
|
+
puts "#{file}: #{image.width}x#{image.height} - #{image.palette.size} colors"
|
|
20
|
+
puts "------------------------------------------------"
|
|
21
|
+
puts "<default> : %8d bytes in %0.4fs" % encode_png(image)
|
|
22
|
+
puts ":no_compression : %8d bytes in %0.4fs" % encode_png(image, :no_compression)
|
|
23
|
+
puts ":fast_rgba : %8d bytes in %0.4fs" % encode_png(image, :fast_rgba)
|
|
24
|
+
puts ":fast_rgb : %8d bytes in %0.4fs" % encode_png(image, :fast_rgb)
|
|
25
|
+
puts ":good_compression : %8d bytes in %0.4fs" % encode_png(image, :good_compression)
|
|
26
|
+
puts ":best_compression : %8d bytes in %0.4fs" % encode_png(image, :best_compression)
|
|
27
|
+
puts
|
|
28
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
|
+
require 'chunky_png/version'
|
|
6
|
+
|
|
7
|
+
Gem::Specification.new do |s|
|
|
8
|
+
s.name = 'chunky_png'
|
|
9
|
+
|
|
10
|
+
# Do not change the version and date fields by hand. This will be done
|
|
11
|
+
# automatically by the gem release script.
|
|
12
|
+
s.version = ChunkyPNG::VERSION
|
|
13
|
+
|
|
14
|
+
s.summary = "Pure ruby library for read/write, chunk-level access to PNG files"
|
|
15
|
+
s.description = <<-EOT
|
|
16
|
+
This pure Ruby library can read and write PNG images without depending on an external
|
|
17
|
+
image library, like RMagick. It tries to be memory efficient and reasonably fast.
|
|
18
|
+
|
|
19
|
+
It supports reading and writing all PNG variants that are defined in the specification,
|
|
20
|
+
with one limitation: only 8-bit color depth is supported. It supports all transparency,
|
|
21
|
+
interlacing and filtering options the PNG specifications allows. It can also read and
|
|
22
|
+
write textual metadata from PNG files. Low-level read/write access to PNG chunks is
|
|
23
|
+
also possible.
|
|
24
|
+
|
|
25
|
+
This library supports simple drawing on the image canvas and simple operations like
|
|
26
|
+
alpha composition and cropping. Finally, it can import from and export to RMagick for
|
|
27
|
+
interoperability.
|
|
28
|
+
|
|
29
|
+
Also, have a look at OilyPNG at http://github.com/wvanbergen/oily_png. OilyPNG is a
|
|
30
|
+
drop in mixin module that implements some of the ChunkyPNG algorithms in C, which
|
|
31
|
+
provides a massive speed boost to encoding and decoding.
|
|
32
|
+
EOT
|
|
33
|
+
|
|
34
|
+
s.authors = ['Willem van Bergen']
|
|
35
|
+
s.email = ['willem@railsdoctors.com']
|
|
36
|
+
s.homepage = 'http://wiki.github.com/wvanbergen/chunky_png'
|
|
37
|
+
s.license = 'MIT'
|
|
38
|
+
|
|
39
|
+
s.add_development_dependency('rake')
|
|
40
|
+
s.add_development_dependency('rspec', '~> 2.2')
|
|
41
|
+
|
|
42
|
+
s.rdoc_options << '--title' << s.name << '--main' << 'README.rdoc' << '--line-numbers' << '--inline-source'
|
|
43
|
+
s.extra_rdoc_files = ['README.rdoc', 'BENCHMARKS.rdoc']
|
|
44
|
+
|
|
45
|
+
s.files = `git ls-files`.split($/)
|
|
46
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
|
47
|
+
end
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Basic requirements from standard library
|
|
2
|
+
require 'set'
|
|
3
|
+
require 'zlib'
|
|
4
|
+
require 'stringio'
|
|
5
|
+
require 'enumerator'
|
|
6
|
+
|
|
7
|
+
# ChunkyPNG - the pure ruby library to access PNG files.
|
|
8
|
+
#
|
|
9
|
+
# The ChunkyPNG module defines some constants that are used in the
|
|
10
|
+
# PNG specification, specifies some exception classes, and serves as
|
|
11
|
+
# a namespace for all the other modules and classes in this library.
|
|
12
|
+
#
|
|
13
|
+
# {ChunkyPNG::Image}:: class to represent PNG images, including metadata.
|
|
14
|
+
# {ChunkyPNG::Canvas}:: class to represent the image's canvas.
|
|
15
|
+
# {ChunkyPNG::Color}:: module to work with color values.
|
|
16
|
+
# {ChunkyPNG::Palette}:: represents the palette of colors used on a {ChunkyPNG::Canvas}.
|
|
17
|
+
# {ChunkyPNG::Datastream}:: represents the internal structure of a PNG {ChunkyPNG::Image}.
|
|
18
|
+
# {ChunkyPNG::Color}:: represents one chunk of data within a {ChunkyPNG::Datastream}.
|
|
19
|
+
# {ChunkyPNG::Point}:: geometry helper class representing a 2-dimensional point.
|
|
20
|
+
# {ChunkyPNG::Dimension}:: geometry helper class representing a dimension (i.e. width x height).
|
|
21
|
+
# {ChunkyPNG::Vector}:: geometry helper class representing a series of points.
|
|
22
|
+
#
|
|
23
|
+
# @author Willem van Bergen
|
|
24
|
+
module ChunkyPNG
|
|
25
|
+
|
|
26
|
+
###################################################
|
|
27
|
+
# PNG international standard defined constants
|
|
28
|
+
###################################################
|
|
29
|
+
|
|
30
|
+
# Indicates that the PNG image uses grayscale colors, i.e. only a
|
|
31
|
+
# single teint channel.
|
|
32
|
+
# @private
|
|
33
|
+
COLOR_GRAYSCALE = 0
|
|
34
|
+
|
|
35
|
+
# Indicates that the PNG image uses true color, composed of a red
|
|
36
|
+
# green and blue channel.
|
|
37
|
+
# @private
|
|
38
|
+
COLOR_TRUECOLOR = 2
|
|
39
|
+
|
|
40
|
+
# Indicates that the PNG image uses indexed colors, where the values
|
|
41
|
+
# point to colors defined on a palette.
|
|
42
|
+
# @private
|
|
43
|
+
COLOR_INDEXED = 3
|
|
44
|
+
|
|
45
|
+
# Indicates that the PNG image uses grayscale colors with opacity, i.e.
|
|
46
|
+
# a teint channel with an alpha channel.
|
|
47
|
+
# @private
|
|
48
|
+
COLOR_GRAYSCALE_ALPHA = 4
|
|
49
|
+
|
|
50
|
+
# Indicates that the PNG image uses true color with opacity, composed of
|
|
51
|
+
# a red, green and blue channel, and an alpha value.
|
|
52
|
+
# @private
|
|
53
|
+
COLOR_TRUECOLOR_ALPHA = 6
|
|
54
|
+
|
|
55
|
+
# Indicates that the PNG specification's default compression
|
|
56
|
+
# method is used (Zlib/Deflate)
|
|
57
|
+
# @private
|
|
58
|
+
COMPRESSION_DEFAULT = 0
|
|
59
|
+
|
|
60
|
+
# Indicates that the image does not use interlacing.
|
|
61
|
+
# @private
|
|
62
|
+
INTERLACING_NONE = 0
|
|
63
|
+
|
|
64
|
+
# Indicates that the image uses Adam7 interlacing.
|
|
65
|
+
# @private
|
|
66
|
+
INTERLACING_ADAM7 = 1
|
|
67
|
+
|
|
68
|
+
### Filter method constants
|
|
69
|
+
|
|
70
|
+
# Indicates that the PNG specification's default filtering are
|
|
71
|
+
# being used in the image.
|
|
72
|
+
# @private
|
|
73
|
+
FILTERING_DEFAULT = 0
|
|
74
|
+
|
|
75
|
+
# Indicates that no filtering is used for the scanline.
|
|
76
|
+
# @private
|
|
77
|
+
FILTER_NONE = 0
|
|
78
|
+
|
|
79
|
+
# Indicates that SUB filtering is used for the scanline.
|
|
80
|
+
# @private
|
|
81
|
+
FILTER_SUB = 1
|
|
82
|
+
|
|
83
|
+
# Indicates that UP filtering is used for the scanline.
|
|
84
|
+
# @private
|
|
85
|
+
FILTER_UP = 2
|
|
86
|
+
|
|
87
|
+
# Indicates that AVERAGE filtering is used for the scanline.
|
|
88
|
+
# @private
|
|
89
|
+
FILTER_AVERAGE = 3
|
|
90
|
+
|
|
91
|
+
# Indicates that PAETH filtering is used for the scanline.
|
|
92
|
+
# @private
|
|
93
|
+
FILTER_PAETH = 4
|
|
94
|
+
|
|
95
|
+
###################################################
|
|
96
|
+
# ChunkyPNG exception classes
|
|
97
|
+
###################################################
|
|
98
|
+
|
|
99
|
+
# Default exception class for ChunkyPNG
|
|
100
|
+
class Exception < ::StandardError
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Exception that is raised for an unsupported PNG image.
|
|
104
|
+
class NotSupported < ChunkyPNG::Exception
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Exception that is raised if the PNG signature is not encountered at the
|
|
108
|
+
# beginning of the file.
|
|
109
|
+
class SignatureMismatch < ChunkyPNG::Exception
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# Exception that is raised if the CRC check for a block fails
|
|
113
|
+
class CRCMismatch < ChunkyPNG::Exception
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Exception that is raised if an expectation fails.
|
|
117
|
+
class ExpectationFailed < ChunkyPNG::Exception
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Exception that is raised if an expectation fails.
|
|
121
|
+
class OutOfBounds < ChunkyPNG::ExpectationFailed
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def self.force_binary(str)
|
|
125
|
+
str.respond_to?(:force_encoding) ? str.force_encoding('BINARY') : str
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Empty byte array. This basically is an empty string, but with the encoding
|
|
129
|
+
# set correctly to ASCII-8BIT (binary) in Ruby 1.9.
|
|
130
|
+
# @return [String] An empty string, with encoding set to binary in Ruby 1.9
|
|
131
|
+
# @private
|
|
132
|
+
EMPTY_BYTEARRAY = force_binary("").freeze
|
|
133
|
+
|
|
134
|
+
# Null-byte, with the encoding set correctly to ASCII-8BIT (binary) in Ruby 1.9.
|
|
135
|
+
# @return [String] A binary string, consisting of one NULL-byte.
|
|
136
|
+
# @private
|
|
137
|
+
EXTRA_BYTE = force_binary("\0").freeze
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
require 'chunky_png/version'
|
|
141
|
+
|
|
142
|
+
# Ruby 1.8 / 1.9 compatibility
|
|
143
|
+
require 'chunky_png/compatibility'
|
|
144
|
+
|
|
145
|
+
# PNG file structure
|
|
146
|
+
require 'chunky_png/datastream'
|
|
147
|
+
require 'chunky_png/chunk'
|
|
148
|
+
|
|
149
|
+
# Colors
|
|
150
|
+
require 'chunky_png/palette'
|
|
151
|
+
require 'chunky_png/color'
|
|
152
|
+
|
|
153
|
+
# Geometry
|
|
154
|
+
require 'chunky_png/point'
|
|
155
|
+
require 'chunky_png/vector'
|
|
156
|
+
require 'chunky_png/dimension'
|
|
157
|
+
|
|
158
|
+
# Canvas / Image classes
|
|
159
|
+
require 'chunky_png/canvas'
|
|
160
|
+
require 'chunky_png/image'
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
require 'chunky_png/canvas/png_encoding'
|
|
2
|
+
require 'chunky_png/canvas/png_decoding'
|
|
3
|
+
require 'chunky_png/canvas/adam7_interlacing'
|
|
4
|
+
require 'chunky_png/canvas/stream_exporting'
|
|
5
|
+
require 'chunky_png/canvas/stream_importing'
|
|
6
|
+
require 'chunky_png/canvas/data_url_exporting'
|
|
7
|
+
require 'chunky_png/canvas/data_url_importing'
|
|
8
|
+
require 'chunky_png/canvas/operations'
|
|
9
|
+
require 'chunky_png/canvas/drawing'
|
|
10
|
+
require 'chunky_png/canvas/resampling'
|
|
11
|
+
require 'chunky_png/canvas/masking'
|
|
12
|
+
|
|
13
|
+
module ChunkyPNG
|
|
14
|
+
# The ChunkyPNG::Canvas class represents a raster image as a matrix of
|
|
15
|
+
# pixels.
|
|
16
|
+
#
|
|
17
|
+
# This class supports loading a Canvas from a PNG datastream, and creating a
|
|
18
|
+
# {ChunkyPNG::Datastream PNG datastream} based on this matrix. ChunkyPNG
|
|
19
|
+
# only supports 8-bit color depth, otherwise all of the PNG format's
|
|
20
|
+
# variations are supported for both reading and writing.
|
|
21
|
+
#
|
|
22
|
+
# This class offers per-pixel access to the matrix by using x,y coordinates.
|
|
23
|
+
# It uses a palette (see {ChunkyPNG::Palette}) to keep track of the
|
|
24
|
+
# different colors used in this matrix.
|
|
25
|
+
#
|
|
26
|
+
# The pixels in the canvas are stored as 4-byte fixnum, representing 32-bit
|
|
27
|
+
# RGBA colors (8 bit per channel). The module {ChunkyPNG::Color} is provided
|
|
28
|
+
# to work more easily with these number as color values.
|
|
29
|
+
#
|
|
30
|
+
# The module {ChunkyPNG::Canvas::Operations} is imported for operations on
|
|
31
|
+
# the whole canvas, like cropping and alpha compositing. Simple drawing
|
|
32
|
+
# functions are imported from the {ChunkyPNG::Canvas::Drawing} module.
|
|
33
|
+
class Canvas
|
|
34
|
+
include PNGEncoding
|
|
35
|
+
extend PNGDecoding
|
|
36
|
+
extend Adam7Interlacing
|
|
37
|
+
|
|
38
|
+
include StreamExporting
|
|
39
|
+
extend StreamImporting
|
|
40
|
+
|
|
41
|
+
include DataUrlExporting
|
|
42
|
+
extend DataUrlImporting
|
|
43
|
+
|
|
44
|
+
include Operations
|
|
45
|
+
include Drawing
|
|
46
|
+
include Resampling
|
|
47
|
+
include Masking
|
|
48
|
+
|
|
49
|
+
# @return [Integer] The number of columns in this canvas
|
|
50
|
+
attr_reader :width
|
|
51
|
+
|
|
52
|
+
# @return [Integer] The number of rows in this canvas
|
|
53
|
+
attr_reader :height
|
|
54
|
+
|
|
55
|
+
# @return [Array<ChunkyPNG::Color>] The list of pixels in this canvas.
|
|
56
|
+
# This array always should have +width * height+ elements.
|
|
57
|
+
attr_reader :pixels
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
#################################################################
|
|
61
|
+
# CONSTRUCTORS
|
|
62
|
+
#################################################################
|
|
63
|
+
|
|
64
|
+
# Initializes a new Canvas instance.
|
|
65
|
+
#
|
|
66
|
+
# @overload initialize(width, height, background_color)
|
|
67
|
+
# @param [Integer] width The width in pixels of this canvas
|
|
68
|
+
# @param [Integer] height The height in pixels of this canvas
|
|
69
|
+
# @param [Integer, ...] background_color The initial background color of
|
|
70
|
+
# this canvas. This can be a color value or any value that
|
|
71
|
+
# {ChunkyPNG::Color.parse} can handle.
|
|
72
|
+
#
|
|
73
|
+
# @overload initialize(width, height, initial)
|
|
74
|
+
# @param [Integer] width The width in pixels of this canvas
|
|
75
|
+
# @param [Integer] height The height in pixels of this canvas
|
|
76
|
+
# @param [Array<Integer>] initial The initial pizel values. Must be an
|
|
77
|
+
# array with <tt>width * height</tt> elements.
|
|
78
|
+
def initialize(width, height, initial = ChunkyPNG::Color::TRANSPARENT)
|
|
79
|
+
@width, @height = width, height
|
|
80
|
+
|
|
81
|
+
if initial.kind_of?(Array)
|
|
82
|
+
unless initial.length == width * height
|
|
83
|
+
raise ArgumentError, "The initial array should have #{width}x#{height} = #{width*height} elements!"
|
|
84
|
+
end
|
|
85
|
+
@pixels = initial
|
|
86
|
+
else
|
|
87
|
+
@pixels = Array.new(width * height, ChunkyPNG::Color.parse(initial))
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Initializes a new Canvas instances when being cloned.
|
|
92
|
+
# @param [ChunkyPNG::Canvas] other The canvas to duplicate
|
|
93
|
+
# @return [void]
|
|
94
|
+
# @private
|
|
95
|
+
def initialize_copy(other)
|
|
96
|
+
@width, @height = other.width, other.height
|
|
97
|
+
@pixels = other.pixels.dup
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Creates a new canvas instance by duplicating another instance.
|
|
101
|
+
# @param [ChunkyPNG::Canvas] canvas The canvas to duplicate
|
|
102
|
+
# @return [ChunkyPNG::Canvas] The newly constructed canvas instance.
|
|
103
|
+
def self.from_canvas(canvas)
|
|
104
|
+
new(canvas.width, canvas.height, canvas.pixels.dup)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
#################################################################
|
|
109
|
+
# PROPERTIES
|
|
110
|
+
#################################################################
|
|
111
|
+
|
|
112
|
+
# Returns the dimension (width x height) for this canvas.
|
|
113
|
+
# @return [ChunkyPNG::Dimension] A dimension instance with the width and
|
|
114
|
+
# height set for this canvas.
|
|
115
|
+
def dimension
|
|
116
|
+
ChunkyPNG::Dimension.new(width, height)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# Returns the area of this canvas in number of pixels.
|
|
120
|
+
# @return [Integer] The number of pixels in this canvas
|
|
121
|
+
def area
|
|
122
|
+
pixels.length
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# Replaces a single pixel in this canvas.
|
|
126
|
+
# @param [Integer] x The x-coordinate of the pixel (column)
|
|
127
|
+
# @param [Integer] y The y-coordinate of the pixel (row)
|
|
128
|
+
# @param [Integer] color The new color for the provided coordinates.
|
|
129
|
+
# @return [Integer] The new color value for this pixel, i.e.
|
|
130
|
+
# <tt>color</tt>.
|
|
131
|
+
# @raise [ChunkyPNG::OutOfBounds] when the coordinates are outside of the
|
|
132
|
+
# image's dimensions.
|
|
133
|
+
# @see #set_pixel
|
|
134
|
+
def []=(x, y, color)
|
|
135
|
+
assert_xy!(x, y)
|
|
136
|
+
@pixels[y * width + x] = ChunkyPNG::Color.parse(color)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# Replaces a single pixel in this canvas, without bounds checking.
|
|
140
|
+
#
|
|
141
|
+
# This method return value and effects are undefined for coordinates
|
|
142
|
+
# out of bounds of the canvas.
|
|
143
|
+
#
|
|
144
|
+
# @param [Integer] x The x-coordinate of the pixel (column)
|
|
145
|
+
# @param [Integer] y The y-coordinate of the pixel (row)
|
|
146
|
+
# @param [Integer] pixel The new color for the provided coordinates.
|
|
147
|
+
# @return [Integer] The new color value for this pixel, i.e.
|
|
148
|
+
# <tt>color</tt>.
|
|
149
|
+
def set_pixel(x, y, color)
|
|
150
|
+
@pixels[y * width + x] = color
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Replaces a single pixel in this canvas, with bounds checking. It will do
|
|
154
|
+
# noting if the provided coordinates are out of bounds.
|
|
155
|
+
#
|
|
156
|
+
# @param [Integer] x The x-coordinate of the pixel (column)
|
|
157
|
+
# @param [Integer] y The y-coordinate of the pixel (row)
|
|
158
|
+
# @param [Integer] pixel The new color value for the provided coordinates.
|
|
159
|
+
# @return [Integer] The new color value for this pixel, i.e.
|
|
160
|
+
# <tt>color</tt>, or <tt>nil</tt> if the coordinates are out of bounds.
|
|
161
|
+
def set_pixel_if_within_bounds(x, y, color)
|
|
162
|
+
return unless include_xy?(x, y)
|
|
163
|
+
@pixels[y * width + x] = color
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# Returns a single pixel's color value from this canvas.
|
|
167
|
+
# @param [Integer] x The x-coordinate of the pixel (column)
|
|
168
|
+
# @param [Integer] y The y-coordinate of the pixel (row)
|
|
169
|
+
# @return [Integer] The current color value at the provided coordinates.
|
|
170
|
+
# @raise [ChunkyPNG::OutOfBounds] when the coordinates are outside of the
|
|
171
|
+
# image's dimensions.
|
|
172
|
+
# @see #get_pixel
|
|
173
|
+
def [](x, y)
|
|
174
|
+
assert_xy!(x, y)
|
|
175
|
+
@pixels[y * width + x]
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# Returns a single pixel from this canvas, without checking bounds. The
|
|
179
|
+
# return value for this method is undefined if the coordinates are out of
|
|
180
|
+
# bounds.
|
|
181
|
+
#
|
|
182
|
+
# @param (see #[])
|
|
183
|
+
# @return [Integer] The current pixel at the provided coordinates.
|
|
184
|
+
def get_pixel(x, y)
|
|
185
|
+
@pixels[y * width + x]
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# Returns an extracted row as vector of pixels
|
|
189
|
+
# @param [Integer] y The 0-based row index
|
|
190
|
+
# @return [Array<Integer>] The vector of pixels in the requested row
|
|
191
|
+
def row(y)
|
|
192
|
+
assert_y!(y)
|
|
193
|
+
pixels.slice(y * width, width)
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# Returns an extracted column as vector of pixels.
|
|
197
|
+
# @param [Integer] x The 0-based column index.
|
|
198
|
+
# @return [Array<Integer>] The vector of pixels in the requested column.
|
|
199
|
+
def column(x)
|
|
200
|
+
assert_x!(x)
|
|
201
|
+
(0...height).inject([]) { |pixels, y| pixels << get_pixel(x, y) }
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
# Replaces a row of pixels on this canvas.
|
|
205
|
+
# @param [Integer] y The 0-based row index.
|
|
206
|
+
# @param [Array<Integer>] vector The vector of pixels to replace the row
|
|
207
|
+
# with.
|
|
208
|
+
# @return [void]
|
|
209
|
+
def replace_row!(y, vector)
|
|
210
|
+
assert_y!(y) && assert_width!(vector.length)
|
|
211
|
+
pixels[y * width, width] = vector
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# Replaces a column of pixels on this canvas.
|
|
215
|
+
# @param [Integer] x The 0-based column index.
|
|
216
|
+
# @param [Array<Integer>] vector The vector of pixels to replace the column
|
|
217
|
+
# with.
|
|
218
|
+
# @return [void]
|
|
219
|
+
def replace_column!(x, vector)
|
|
220
|
+
assert_x!(x) && assert_height!(vector.length)
|
|
221
|
+
for y in 0...height do
|
|
222
|
+
set_pixel(x, y, vector[y])
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
# Checks whether the given coordinates are in the range of the canvas
|
|
227
|
+
# @param [ChunkyPNG::Point, Array, Hash, String] point_like The point to
|
|
228
|
+
# check.
|
|
229
|
+
# @return [true, false] True if the x and y coordinates of the point are
|
|
230
|
+
# within the limits of this canvas.
|
|
231
|
+
# @see ChunkyPNG.Point
|
|
232
|
+
def include_point?(*point_like)
|
|
233
|
+
dimension.include?(ChunkyPNG::Point(*point_like))
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
alias_method :include?, :include_point?
|
|
237
|
+
|
|
238
|
+
# Checks whether the given x- and y-coordinate are in the range of the
|
|
239
|
+
# canvas
|
|
240
|
+
#
|
|
241
|
+
# @param [Integer] x The x-coordinate of the pixel (column)
|
|
242
|
+
# @param [Integer] y The y-coordinate of the pixel (row)
|
|
243
|
+
# @return [true, false] True if the x- and y-coordinate is in the range of
|
|
244
|
+
# this canvas.
|
|
245
|
+
def include_xy?(x, y)
|
|
246
|
+
y >= 0 && y < height && x >= 0 && x < width
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
# Checks whether the given y-coordinate is in the range of the canvas
|
|
250
|
+
# @param [Integer] y The y-coordinate of the pixel (row)
|
|
251
|
+
# @return [true, false] True if the y-coordinate is in the range of this
|
|
252
|
+
# canvas.
|
|
253
|
+
def include_y?(y)
|
|
254
|
+
y >= 0 && y < height
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
# Checks whether the given x-coordinate is in the range of the canvas
|
|
258
|
+
# @param [Integer] x The y-coordinate of the pixel (column)
|
|
259
|
+
# @return [true, false] True if the x-coordinate is in the range of this
|
|
260
|
+
# canvas.
|
|
261
|
+
def include_x?(x)
|
|
262
|
+
x >= 0 && x < width
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
# Returns the palette used for this canvas.
|
|
266
|
+
# @return [ChunkyPNG::Palette] A palette which contains all the colors that
|
|
267
|
+
# are being used for this image.
|
|
268
|
+
def palette
|
|
269
|
+
ChunkyPNG::Palette.from_canvas(self)
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
# Equality check to compare this canvas with other matrices.
|
|
273
|
+
# @param other The object to compare this Matrix to.
|
|
274
|
+
# @return [true, false] True if the size and pixel values of the other
|
|
275
|
+
# canvas are exactly the same as this canvas's size and pixel values.
|
|
276
|
+
def eql?(other)
|
|
277
|
+
other.kind_of?(self.class) && other.pixels == self.pixels &&
|
|
278
|
+
other.width == self.width && other.height == self.height
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
alias :== :eql?
|
|
282
|
+
|
|
283
|
+
#################################################################
|
|
284
|
+
# EXPORTING
|
|
285
|
+
#################################################################
|
|
286
|
+
|
|
287
|
+
# Creates an ChunkyPNG::Image object from this canvas.
|
|
288
|
+
# @return [ChunkyPNG::Image] This canvas wrapped in an Image instance.
|
|
289
|
+
def to_image
|
|
290
|
+
ChunkyPNG::Image.from_canvas(self)
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
# Alternative implementation of the inspect method.
|
|
294
|
+
# @return [String] A nicely formatted string representation of this canvas.
|
|
295
|
+
# @private
|
|
296
|
+
def inspect
|
|
297
|
+
inspected = "<#{self.class.name} #{width}x#{height} ["
|
|
298
|
+
for y in 0...height
|
|
299
|
+
inspected << "\n\t[" << row(y).map { |p| ChunkyPNG::Color.to_hex(p) }.join(' ') << ']'
|
|
300
|
+
end
|
|
301
|
+
inspected << "\n]>"
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
protected
|
|
305
|
+
|
|
306
|
+
# Replaces the image, given a new width, new height, and a new pixel array.
|
|
307
|
+
def replace_canvas!(new_width, new_height, new_pixels)
|
|
308
|
+
unless new_pixels.length == new_width * new_height
|
|
309
|
+
raise ArgumentError, "The provided pixel array should have #{new_width * new_height} items"
|
|
310
|
+
end
|
|
311
|
+
@width, @height, @pixels = new_width, new_height, new_pixels
|
|
312
|
+
self
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
# Throws an exception if the x-coordinate is out of bounds.
|
|
316
|
+
def assert_x!(x)
|
|
317
|
+
unless include_x?(x)
|
|
318
|
+
raise ChunkyPNG::OutOfBounds, "Column index #{x} out of bounds!"
|
|
319
|
+
end
|
|
320
|
+
true
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
# Throws an exception if the y-coordinate is out of bounds.
|
|
324
|
+
def assert_y!(y)
|
|
325
|
+
unless include_y?(y)
|
|
326
|
+
raise ChunkyPNG::OutOfBounds, "Row index #{y} out of bounds!"
|
|
327
|
+
end
|
|
328
|
+
true
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
# Throws an exception if the x- or y-coordinate is out of bounds.
|
|
332
|
+
def assert_xy!(x, y)
|
|
333
|
+
unless include_xy?(x, y)
|
|
334
|
+
raise ChunkyPNG::OutOfBounds, "Coordinates (#{x},#{y}) out of bounds!"
|
|
335
|
+
end
|
|
336
|
+
true
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
# Throws an exception if the vector_length does not match this canvas'
|
|
340
|
+
# height.
|
|
341
|
+
def assert_height!(vector_length)
|
|
342
|
+
if height != vector_length
|
|
343
|
+
raise ChunkyPNG::ExpectationFailed,
|
|
344
|
+
"The length of the vector (#{vector_length}) does not match the canvas height (#{height})!"
|
|
345
|
+
end
|
|
346
|
+
true
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
# Throws an exception if the vector_length does not match this canvas'
|
|
350
|
+
# width.
|
|
351
|
+
def assert_width!(vector_length)
|
|
352
|
+
if width != vector_length
|
|
353
|
+
raise ChunkyPNG::ExpectationFailed,
|
|
354
|
+
"The length of the vector (#{vector_length}) does not match the canvas width (#{width})!"
|
|
355
|
+
end
|
|
356
|
+
true
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
# Throws an exception if the matrix width and height does not match this canvas' dimensions.
|
|
360
|
+
def assert_size!(matrix_width, matrix_height)
|
|
361
|
+
if width != matrix_width
|
|
362
|
+
raise ChunkyPNG::ExpectationFailed,
|
|
363
|
+
'The width of the matrix does not match the canvas width!'
|
|
364
|
+
end
|
|
365
|
+
if height != matrix_height
|
|
366
|
+
raise ChunkyPNG::ExpectationFailed,
|
|
367
|
+
'The height of the matrix does not match the canvas height!'
|
|
368
|
+
end
|
|
369
|
+
true
|
|
370
|
+
end
|
|
371
|
+
end
|
|
372
|
+
end
|