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,442 @@
|
|
|
1
|
+
module ChunkyPNG
|
|
2
|
+
class Canvas
|
|
3
|
+
|
|
4
|
+
# Methods for encoding a Canvas instance into a PNG datastream.
|
|
5
|
+
#
|
|
6
|
+
# Overview of the encoding process:
|
|
7
|
+
#
|
|
8
|
+
# * The image is split up in scanlines (i.e. rows of pixels);
|
|
9
|
+
# * All pixels are encoded as a pixelstream, based on the color mode.
|
|
10
|
+
# * All the pixel bytes in the pixelstream are adjusted using a filtering
|
|
11
|
+
# method if one is specified.
|
|
12
|
+
# * Compress the resulting string using deflate compression.
|
|
13
|
+
# * Split compressed data over one or more PNG chunks.
|
|
14
|
+
# * These chunks should be embedded in a datastream with at least a IHDR and
|
|
15
|
+
# IEND chunk and possibly a PLTE chunk.
|
|
16
|
+
#
|
|
17
|
+
# For interlaced images, the initial image is first split into 7 subimages.
|
|
18
|
+
# These images get encoded exactly as above, and the result gets combined
|
|
19
|
+
# before the compression step.
|
|
20
|
+
#
|
|
21
|
+
# @see ChunkyPNG::Canvas::PNGDecoding
|
|
22
|
+
# @see http://www.w3.org/TR/PNG/ The W3C PNG format specification
|
|
23
|
+
module PNGEncoding
|
|
24
|
+
|
|
25
|
+
# The palette used for encoding the image.This is only in used for images
|
|
26
|
+
# that get encoded using indexed colors.
|
|
27
|
+
# @return [ChunkyPNG::Palette]
|
|
28
|
+
attr_accessor :encoding_palette
|
|
29
|
+
|
|
30
|
+
# Writes the canvas to an IO stream, encoded as a PNG image.
|
|
31
|
+
# @param [IO] io The output stream to write to.
|
|
32
|
+
# @param constraints (see ChunkyPNG::Canvas::PNGEncoding#to_datastream)
|
|
33
|
+
# @return [void]
|
|
34
|
+
def write(io, constraints = {})
|
|
35
|
+
to_datastream(constraints).write(io)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Writes the canvas to a file, encoded as a PNG image.
|
|
39
|
+
# @param [String] filename The file to save the PNG image to.
|
|
40
|
+
# @param constraints (see ChunkyPNG::Canvas::PNGEncoding#to_datastream)
|
|
41
|
+
# @return [void]
|
|
42
|
+
def save(filename, constraints = {})
|
|
43
|
+
File.open(filename, 'wb') { |io| write(io, constraints) }
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Encoded the canvas to a PNG formatted string.
|
|
47
|
+
# @param constraints (see ChunkyPNG::Canvas::PNGEncoding#to_datastream)
|
|
48
|
+
# @return [String] The PNG encoded canvas as string.
|
|
49
|
+
def to_blob(constraints = {})
|
|
50
|
+
to_datastream(constraints).to_blob
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
alias_method :to_string, :to_blob
|
|
54
|
+
alias_method :to_s, :to_blob
|
|
55
|
+
|
|
56
|
+
# Converts this Canvas to a datastream, so that it can be saved as a PNG image.
|
|
57
|
+
# @param [Hash, Symbol] constraints The constraints to use when encoding the canvas.
|
|
58
|
+
# This can either be a hash with different constraints, or a symbol which acts as a
|
|
59
|
+
# preset for some constraints. If no constraints are given, ChunkyPNG will decide
|
|
60
|
+
# for itself how to best create the PNG datastream.
|
|
61
|
+
# Supported presets are <tt>:fast_rgba</tt> for quickly saving images with transparency,
|
|
62
|
+
# <tt>:fast_rgb</tt> for quickly saving opaque images, and <tt>:best_compression</tt> to
|
|
63
|
+
# obtain the smallest possible filesize.
|
|
64
|
+
# @option constraints [Fixnum] :color_mode The color mode to use. Use one of the
|
|
65
|
+
# ChunkyPNG::COLOR_* constants.
|
|
66
|
+
# @option constraints [true, false] :interlace Whether to use interlacing.
|
|
67
|
+
# @option constraints [Fixnum] :compression The compression level for Zlib. This can be a
|
|
68
|
+
# value between 0 and 9, or a Zlib constant like Zlib::BEST_COMPRESSION.
|
|
69
|
+
# @option constraints [Fixnum] :bit_depth The bit depth to use. This option is only used
|
|
70
|
+
# for indexed images, in which case it overrides the determined minimal bit depth. For
|
|
71
|
+
# all the other color modes, a bit depth of 8 is used.
|
|
72
|
+
# @return [ChunkyPNG::Datastream] The PNG datastream containing the encoded canvas.
|
|
73
|
+
# @see ChunkyPNG::Canvas::PNGEncoding#determine_png_encoding
|
|
74
|
+
def to_datastream(constraints = {})
|
|
75
|
+
encoding = determine_png_encoding(constraints)
|
|
76
|
+
|
|
77
|
+
ds = Datastream.new
|
|
78
|
+
ds.header_chunk = Chunk::Header.new(:width => width, :height => height,
|
|
79
|
+
:color => encoding[:color_mode], :depth => encoding[:bit_depth], :interlace => encoding[:interlace])
|
|
80
|
+
|
|
81
|
+
if encoding[:color_mode] == ChunkyPNG::COLOR_INDEXED
|
|
82
|
+
ds.palette_chunk = encoding_palette.to_plte_chunk
|
|
83
|
+
ds.transparency_chunk = encoding_palette.to_trns_chunk unless encoding_palette.opaque?
|
|
84
|
+
end
|
|
85
|
+
data = encode_png_pixelstream(encoding[:color_mode], encoding[:bit_depth], encoding[:interlace], encoding[:filtering])
|
|
86
|
+
ds.data_chunks = Chunk::ImageData.split_in_chunks(data, encoding[:compression])
|
|
87
|
+
ds.end_chunk = Chunk::End.new
|
|
88
|
+
return ds
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
protected
|
|
92
|
+
|
|
93
|
+
# Determines the best possible PNG encoding variables for this image, by analyzing
|
|
94
|
+
# the colors used for the image.
|
|
95
|
+
#
|
|
96
|
+
# You can provide constraints for the encoding variables by passing a hash with
|
|
97
|
+
# encoding variables to this method.
|
|
98
|
+
#
|
|
99
|
+
# @param [Hash, Symbol] constraints The constraints for the encoding. This can be a
|
|
100
|
+
# Hash or a preset symbol.
|
|
101
|
+
# @return [Hash] A hash with encoding options for {ChunkyPNG::Canvas::PNGEncoding#to_datastream}
|
|
102
|
+
def determine_png_encoding(constraints = {})
|
|
103
|
+
|
|
104
|
+
encoding = case constraints
|
|
105
|
+
when :fast_rgb; { :color_mode => ChunkyPNG::COLOR_TRUECOLOR, :compression => Zlib::BEST_SPEED }
|
|
106
|
+
when :fast_rgba; { :color_mode => ChunkyPNG::COLOR_TRUECOLOR_ALPHA, :compression => Zlib::BEST_SPEED }
|
|
107
|
+
when :best_compression; { :compression => Zlib::BEST_COMPRESSION, :filtering => ChunkyPNG::FILTER_PAETH }
|
|
108
|
+
when :good_compression; { :compression => Zlib::BEST_COMPRESSION, :filtering => ChunkyPNG::FILTER_NONE }
|
|
109
|
+
when :no_compression; { :compression => Zlib::NO_COMPRESSION }
|
|
110
|
+
when :black_and_white; { :color_mode => ChunkyPNG::COLOR_GRAYSCALE, :bit_depth => 1 }
|
|
111
|
+
when Hash; constraints
|
|
112
|
+
else raise ChunkyPNG::Exception, "Unknown encoding preset: #{constraints.inspect}"
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Do not create a palette when the encoding is given and does not require a palette.
|
|
116
|
+
if encoding[:color_mode]
|
|
117
|
+
if encoding[:color_mode] == ChunkyPNG::COLOR_INDEXED
|
|
118
|
+
self.encoding_palette = self.palette
|
|
119
|
+
encoding[:bit_depth] ||= self.encoding_palette.determine_bit_depth
|
|
120
|
+
else
|
|
121
|
+
encoding[:bit_depth] ||= 8
|
|
122
|
+
end
|
|
123
|
+
else
|
|
124
|
+
self.encoding_palette = self.palette
|
|
125
|
+
suggested_color_mode, suggested_bit_depth = encoding_palette.best_color_settings
|
|
126
|
+
encoding[:color_mode] ||= suggested_color_mode
|
|
127
|
+
encoding[:bit_depth] ||= suggested_bit_depth
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# Use Zlib's default for compression unless otherwise provided.
|
|
131
|
+
encoding[:compression] ||= Zlib::DEFAULT_COMPRESSION
|
|
132
|
+
|
|
133
|
+
encoding[:interlace] = case encoding[:interlace]
|
|
134
|
+
when nil, false, ChunkyPNG::INTERLACING_NONE; ChunkyPNG::INTERLACING_NONE
|
|
135
|
+
when true, ChunkyPNG::INTERLACING_ADAM7; ChunkyPNG::INTERLACING_ADAM7
|
|
136
|
+
else encoding[:interlace]
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
encoding[:filtering] ||= case encoding[:compression]
|
|
140
|
+
when Zlib::BEST_COMPRESSION; ChunkyPNG::FILTER_PAETH
|
|
141
|
+
when Zlib::NO_COMPRESSION..Zlib::BEST_SPEED; ChunkyPNG::FILTER_NONE
|
|
142
|
+
else ChunkyPNG::FILTER_UP
|
|
143
|
+
end
|
|
144
|
+
return encoding
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# Encodes the canvas according to the PNG format specification with a given color
|
|
148
|
+
# mode, possibly with interlacing.
|
|
149
|
+
# @param [Integer] color_mode The color mode to use for encoding.
|
|
150
|
+
# @param [Integer] bit_depth The bit depth of the image.
|
|
151
|
+
# @param [Integer] interlace The interlacing method to use.
|
|
152
|
+
# @return [String] The PNG encoded canvas as string.
|
|
153
|
+
def encode_png_pixelstream(color_mode = ChunkyPNG::COLOR_TRUECOLOR, bit_depth = 8, interlace = ChunkyPNG::INTERLACING_NONE, filtering = ChunkyPNG::FILTER_NONE)
|
|
154
|
+
|
|
155
|
+
if color_mode == ChunkyPNG::COLOR_INDEXED
|
|
156
|
+
raise ChunkyPNG::ExpectationFailed, "This palette is not suitable for encoding!" if encoding_palette.nil? || !encoding_palette.can_encode?
|
|
157
|
+
raise ChunkyPNG::ExpectationFailed, "This palette has too many colors!" if encoding_palette.size > (1 << bit_depth)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
case interlace
|
|
161
|
+
when ChunkyPNG::INTERLACING_NONE; encode_png_image_without_interlacing(color_mode, bit_depth, filtering)
|
|
162
|
+
when ChunkyPNG::INTERLACING_ADAM7; encode_png_image_with_interlacing(color_mode, bit_depth, filtering)
|
|
163
|
+
else raise ChunkyPNG::NotSupported, "Unknown interlacing method: #{interlace}!"
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# Encodes the canvas according to the PNG format specification with a given color mode.
|
|
168
|
+
# @param [Integer] color_mode The color mode to use for encoding.
|
|
169
|
+
# @param [Integer] bit_depth The bit depth of the image.
|
|
170
|
+
# @param [Integer] filtering The filtering method to use.
|
|
171
|
+
# @return [String] The PNG encoded canvas as string.
|
|
172
|
+
def encode_png_image_without_interlacing(color_mode, bit_depth = 8, filtering = ChunkyPNG::FILTER_NONE)
|
|
173
|
+
stream = ChunkyPNG::Datastream.empty_bytearray
|
|
174
|
+
encode_png_image_pass_to_stream(stream, color_mode, bit_depth, filtering)
|
|
175
|
+
stream
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# Encodes the canvas according to the PNG format specification with a given color
|
|
179
|
+
# mode and Adam7 interlacing.
|
|
180
|
+
#
|
|
181
|
+
# This method will split the original canvas in 7 smaller canvases and encode them
|
|
182
|
+
# one by one, concatenating the resulting strings.
|
|
183
|
+
#
|
|
184
|
+
# @param [Integer] color_mode The color mode to use for encoding.
|
|
185
|
+
# @param [Integer] bit_depth The bit depth of the image.
|
|
186
|
+
# @param [Integer] filtering The filtering method to use.
|
|
187
|
+
# @return [String] The PNG encoded canvas as string.
|
|
188
|
+
def encode_png_image_with_interlacing(color_mode, bit_depth = 8, filtering = ChunkyPNG::FILTER_NONE)
|
|
189
|
+
stream = ChunkyPNG::Datastream.empty_bytearray
|
|
190
|
+
0.upto(6) do |pass|
|
|
191
|
+
subcanvas = self.class.adam7_extract_pass(pass, self)
|
|
192
|
+
subcanvas.encoding_palette = encoding_palette
|
|
193
|
+
subcanvas.encode_png_image_pass_to_stream(stream, color_mode, bit_depth, filtering)
|
|
194
|
+
end
|
|
195
|
+
stream
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# Encodes the canvas to a stream, in a given color mode.
|
|
199
|
+
# @param [String] stream The stream to write to.
|
|
200
|
+
# @param [Integer] color_mode The color mode to use for encoding.
|
|
201
|
+
# @param [Integer] bit_depth The bit depth of the image.
|
|
202
|
+
# @param [Integer] filtering The filtering method to use.
|
|
203
|
+
def encode_png_image_pass_to_stream(stream, color_mode, bit_depth, filtering)
|
|
204
|
+
|
|
205
|
+
start_pos = stream.bytesize
|
|
206
|
+
pixel_size = Color.pixel_bytesize(color_mode)
|
|
207
|
+
line_width = Color.scanline_bytesize(color_mode, bit_depth, width)
|
|
208
|
+
|
|
209
|
+
# Determine the filter method
|
|
210
|
+
encode_method = encode_png_pixels_to_scanline_method(color_mode, bit_depth)
|
|
211
|
+
filter_method = case filtering
|
|
212
|
+
when ChunkyPNG::FILTER_SUB; :encode_png_str_scanline_sub
|
|
213
|
+
when ChunkyPNG::FILTER_UP; :encode_png_str_scanline_up
|
|
214
|
+
when ChunkyPNG::FILTER_AVERAGE; :encode_png_str_scanline_average
|
|
215
|
+
when ChunkyPNG::FILTER_PAETH; :encode_png_str_scanline_paeth
|
|
216
|
+
else nil
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
0.upto(height - 1) do |y|
|
|
220
|
+
stream << send(encode_method, row(y))
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
# Now, apply filtering if any
|
|
224
|
+
if filter_method
|
|
225
|
+
(height - 1).downto(0) do |y|
|
|
226
|
+
pos = start_pos + y * (line_width + 1)
|
|
227
|
+
prev_pos = (y == 0) ? nil : pos - (line_width + 1)
|
|
228
|
+
send(filter_method, stream, pos, prev_pos, line_width, pixel_size)
|
|
229
|
+
end
|
|
230
|
+
end
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
# Encodes a line of pixels using 8-bit truecolor mode.
|
|
234
|
+
# @param [Array<Integer>] pixels A row of pixels of the original image.
|
|
235
|
+
# @return [String] The encoded scanline as binary string
|
|
236
|
+
def encode_png_pixels_to_scanline_truecolor_8bit(pixels)
|
|
237
|
+
pixels.pack('x' + ('NX' * width))
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
# Encodes a line of pixels using 8-bit truecolor alpha mode.
|
|
241
|
+
# @param [Array<Integer>] pixels A row of pixels of the original image.
|
|
242
|
+
# @return [String] The encoded scanline as binary string
|
|
243
|
+
def encode_png_pixels_to_scanline_truecolor_alpha_8bit(pixels)
|
|
244
|
+
pixels.pack("xN#{width}")
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
# Encodes a line of pixels using 1-bit indexed mode.
|
|
248
|
+
# @param [Array<Integer>] pixels A row of pixels of the original image.
|
|
249
|
+
# @return [String] The encoded scanline as binary string
|
|
250
|
+
def encode_png_pixels_to_scanline_indexed_1bit(pixels)
|
|
251
|
+
chars = []
|
|
252
|
+
pixels.each_slice(8) do |p1, p2, p3, p4, p5, p6, p7, p8|
|
|
253
|
+
chars << ((encoding_palette.index(p1) << 7) |
|
|
254
|
+
(encoding_palette.index(p2) << 6) |
|
|
255
|
+
(encoding_palette.index(p3) << 5) |
|
|
256
|
+
(encoding_palette.index(p4) << 4) |
|
|
257
|
+
(encoding_palette.index(p5) << 3) |
|
|
258
|
+
(encoding_palette.index(p6) << 2) |
|
|
259
|
+
(encoding_palette.index(p7) << 1) |
|
|
260
|
+
(encoding_palette.index(p8)))
|
|
261
|
+
end
|
|
262
|
+
chars.pack('xC*')
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
# Encodes a line of pixels using 2-bit indexed mode.
|
|
266
|
+
# @param [Array<Integer>] pixels A row of pixels of the original image.
|
|
267
|
+
# @return [String] The encoded scanline as binary string
|
|
268
|
+
def encode_png_pixels_to_scanline_indexed_2bit(pixels)
|
|
269
|
+
chars = []
|
|
270
|
+
pixels.each_slice(4) do |p1, p2, p3, p4|
|
|
271
|
+
chars << ((encoding_palette.index(p1) << 6) |
|
|
272
|
+
(encoding_palette.index(p2) << 4) |
|
|
273
|
+
(encoding_palette.index(p3) << 2) |
|
|
274
|
+
(encoding_palette.index(p4)))
|
|
275
|
+
end
|
|
276
|
+
chars.pack('xC*')
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
# Encodes a line of pixels using 4-bit indexed mode.
|
|
280
|
+
# @param [Array<Integer>] pixels A row of pixels of the original image.
|
|
281
|
+
# @return [String] The encoded scanline as binary string
|
|
282
|
+
def encode_png_pixels_to_scanline_indexed_4bit(pixels)
|
|
283
|
+
chars = []
|
|
284
|
+
pixels.each_slice(2) do |p1, p2|
|
|
285
|
+
chars << ((encoding_palette.index(p1) << 4) | (encoding_palette.index(p2)))
|
|
286
|
+
end
|
|
287
|
+
chars.pack('xC*')
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
# Encodes a line of pixels using 8-bit indexed mode.
|
|
291
|
+
# @param [Array<Integer>] pixels A row of pixels of the original image.
|
|
292
|
+
# @return [String] The encoded scanline as binary string
|
|
293
|
+
def encode_png_pixels_to_scanline_indexed_8bit(pixels)
|
|
294
|
+
pixels.map { |p| encoding_palette.index(p) }.pack("xC#{width}")
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
# Encodes a line of pixels using 1-bit grayscale mode.
|
|
298
|
+
# @param [Array<Integer>] pixels A row of pixels of the original image.
|
|
299
|
+
# @return [String] The encoded scanline as binary string
|
|
300
|
+
def encode_png_pixels_to_scanline_grayscale_1bit(pixels)
|
|
301
|
+
chars = []
|
|
302
|
+
pixels.each_slice(8) do |p1, p2, p3, p4, p5, p6, p7, p8|
|
|
303
|
+
chars << ((p1.nil? ? 0 : (p1 & 0x0000ffff) >> 15 << 7) |
|
|
304
|
+
(p2.nil? ? 0 : (p2 & 0x0000ffff) >> 15 << 6) |
|
|
305
|
+
(p3.nil? ? 0 : (p3 & 0x0000ffff) >> 15 << 5) |
|
|
306
|
+
(p4.nil? ? 0 : (p4 & 0x0000ffff) >> 15 << 4) |
|
|
307
|
+
(p5.nil? ? 0 : (p5 & 0x0000ffff) >> 15 << 3) |
|
|
308
|
+
(p6.nil? ? 0 : (p6 & 0x0000ffff) >> 15 << 2) |
|
|
309
|
+
(p7.nil? ? 0 : (p7 & 0x0000ffff) >> 15 << 1) |
|
|
310
|
+
(p8.nil? ? 0 : (p8 & 0x0000ffff) >> 15))
|
|
311
|
+
end
|
|
312
|
+
chars.pack('xC*')
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
# Encodes a line of pixels using 2-bit grayscale mode.
|
|
316
|
+
# @param [Array<Integer>] pixels A row of pixels of the original image.
|
|
317
|
+
# @return [String] The encoded scanline as binary string
|
|
318
|
+
def encode_png_pixels_to_scanline_grayscale_2bit(pixels)
|
|
319
|
+
chars = []
|
|
320
|
+
pixels.each_slice(4) do |p1, p2, p3, p4|
|
|
321
|
+
chars << ((p1.nil? ? 0 : (p1 & 0x0000ffff) >> 14 << 6) |
|
|
322
|
+
(p2.nil? ? 0 : (p2 & 0x0000ffff) >> 14 << 4) |
|
|
323
|
+
(p3.nil? ? 0 : (p3 & 0x0000ffff) >> 14 << 2) |
|
|
324
|
+
(p4.nil? ? 0 : (p4 & 0x0000ffff) >> 14))
|
|
325
|
+
end
|
|
326
|
+
chars.pack('xC*')
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
# Encodes a line of pixels using 2-bit grayscale mode.
|
|
330
|
+
# @param [Array<Integer>] pixels A row of pixels of the original image.
|
|
331
|
+
# @return [String] The encoded scanline as binary string
|
|
332
|
+
def encode_png_pixels_to_scanline_grayscale_4bit(pixels)
|
|
333
|
+
chars = []
|
|
334
|
+
pixels.each_slice(2) do |p1, p2|
|
|
335
|
+
chars << ((p1.nil? ? 0 : ((p1 & 0x0000ffff) >> 12) << 4) | (p2.nil? ? 0 : ((p2 & 0x0000ffff) >> 12)))
|
|
336
|
+
end
|
|
337
|
+
chars.pack('xC*')
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
# Encodes a line of pixels using 8-bit grayscale mode.
|
|
341
|
+
# @param [Array<Integer>] pixels A row of pixels of the original image.
|
|
342
|
+
# @return [String] The encoded scanline as binary string
|
|
343
|
+
def encode_png_pixels_to_scanline_grayscale_8bit(pixels)
|
|
344
|
+
pixels.map { |p| p >> 8 }.pack("xC#{width}")
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
# Encodes a line of pixels using 8-bit grayscale alpha mode.
|
|
348
|
+
# @param [Array<Integer>] pixels A row of pixels of the original image.
|
|
349
|
+
# @return [String] The encoded scanline as binary string
|
|
350
|
+
def encode_png_pixels_to_scanline_grayscale_alpha_8bit(pixels)
|
|
351
|
+
pixels.pack("xn#{width}")
|
|
352
|
+
end
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
# Returns the method name to use to decode scanlines into pixels.
|
|
356
|
+
# @param [Integer] color_mode The color mode of the image.
|
|
357
|
+
# @param [Integer] depth The bit depth of the image.
|
|
358
|
+
# @return [Symbol] The method name to use for decoding, to be called on the canvas class.
|
|
359
|
+
# @raise [ChunkyPNG::NotSupported] when the color_mode and/or bit depth is not supported.
|
|
360
|
+
def encode_png_pixels_to_scanline_method(color_mode, depth)
|
|
361
|
+
encoder_method = case color_mode
|
|
362
|
+
when ChunkyPNG::COLOR_TRUECOLOR; :"encode_png_pixels_to_scanline_truecolor_#{depth}bit"
|
|
363
|
+
when ChunkyPNG::COLOR_TRUECOLOR_ALPHA; :"encode_png_pixels_to_scanline_truecolor_alpha_#{depth}bit"
|
|
364
|
+
when ChunkyPNG::COLOR_INDEXED; :"encode_png_pixels_to_scanline_indexed_#{depth}bit"
|
|
365
|
+
when ChunkyPNG::COLOR_GRAYSCALE; :"encode_png_pixels_to_scanline_grayscale_#{depth}bit"
|
|
366
|
+
when ChunkyPNG::COLOR_GRAYSCALE_ALPHA; :"encode_png_pixels_to_scanline_grayscale_alpha_#{depth}bit"
|
|
367
|
+
else nil
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
raise ChunkyPNG::NotSupported, "No encoder found for color mode #{color_mode} and #{depth}-bit depth!" unless respond_to?(encoder_method, true)
|
|
371
|
+
encoder_method
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
# Encodes a scanline of a pixelstream without filtering. This is a no-op.
|
|
377
|
+
# @param [String] stream The pixelstream to work on. This string will be modified.
|
|
378
|
+
# @param [Integer] pos The starting position of the scanline.
|
|
379
|
+
# @param [Integer, nil] prev_pos The starting position of the previous scanline. <tt>nil</tt> if
|
|
380
|
+
# this is the first line.
|
|
381
|
+
# @param [Integer] line_width The number of bytes in this scanline, without counting the filtering
|
|
382
|
+
# method byte.
|
|
383
|
+
# @param [Integer] pixel_size The number of bytes used per pixel.
|
|
384
|
+
# @return [void]
|
|
385
|
+
def encode_png_str_scanline_none(stream, pos, prev_pos, line_width, pixel_size)
|
|
386
|
+
# noop - this method shouldn't get called at all.
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
# Encodes a scanline of a pixelstream using SUB filtering. This will modify the stream.
|
|
390
|
+
# @param (see #encode_png_str_scanline_none)
|
|
391
|
+
# @return [void]
|
|
392
|
+
def encode_png_str_scanline_sub(stream, pos, prev_pos, line_width, pixel_size)
|
|
393
|
+
line_width.downto(1) do |i|
|
|
394
|
+
a = (i > pixel_size) ? stream.getbyte(pos + i - pixel_size) : 0
|
|
395
|
+
stream.setbyte(pos + i, (stream.getbyte(pos + i) - a) & 0xff)
|
|
396
|
+
end
|
|
397
|
+
stream.setbyte(pos, ChunkyPNG::FILTER_SUB)
|
|
398
|
+
end
|
|
399
|
+
|
|
400
|
+
# Encodes a scanline of a pixelstream using UP filtering. This will modify the stream.
|
|
401
|
+
# @param (see #encode_png_str_scanline_none)
|
|
402
|
+
# @return [void]
|
|
403
|
+
def encode_png_str_scanline_up(stream, pos, prev_pos, line_width, pixel_size)
|
|
404
|
+
line_width.downto(1) do |i|
|
|
405
|
+
b = prev_pos ? stream.getbyte(prev_pos + i) : 0
|
|
406
|
+
stream.setbyte(pos + i, (stream.getbyte(pos + i) - b) & 0xff)
|
|
407
|
+
end
|
|
408
|
+
stream.setbyte(pos, ChunkyPNG::FILTER_UP)
|
|
409
|
+
end
|
|
410
|
+
|
|
411
|
+
# Encodes a scanline of a pixelstream using AVERAGE filtering. This will modify the stream.
|
|
412
|
+
# @param (see #encode_png_str_scanline_none)
|
|
413
|
+
# @return [void]
|
|
414
|
+
def encode_png_str_scanline_average(stream, pos, prev_pos, line_width, pixel_size)
|
|
415
|
+
line_width.downto(1) do |i|
|
|
416
|
+
a = (i > pixel_size) ? stream.getbyte(pos + i - pixel_size) : 0
|
|
417
|
+
b = prev_pos ? stream.getbyte(prev_pos + i) : 0
|
|
418
|
+
stream.setbyte(pos + i, (stream.getbyte(pos + i) - ((a + b) >> 1)) & 0xff)
|
|
419
|
+
end
|
|
420
|
+
stream.setbyte(pos, ChunkyPNG::FILTER_AVERAGE)
|
|
421
|
+
end
|
|
422
|
+
|
|
423
|
+
# Encodes a scanline of a pixelstream using PAETH filtering. This will modify the stream.
|
|
424
|
+
# @param (see #encode_png_str_scanline_none)
|
|
425
|
+
# @return [void]
|
|
426
|
+
def encode_png_str_scanline_paeth(stream, pos, prev_pos, line_width, pixel_size)
|
|
427
|
+
line_width.downto(1) do |i|
|
|
428
|
+
a = (i > pixel_size) ? stream.getbyte(pos + i - pixel_size) : 0
|
|
429
|
+
b = (prev_pos) ? stream.getbyte(prev_pos + i) : 0
|
|
430
|
+
c = (prev_pos && i > pixel_size) ? stream.getbyte(prev_pos + i - pixel_size) : 0
|
|
431
|
+
p = a + b - c
|
|
432
|
+
pa = (p - a).abs
|
|
433
|
+
pb = (p - b).abs
|
|
434
|
+
pc = (p - c).abs
|
|
435
|
+
pr = (pa <= pb && pa <= pc) ? a : (pb <= pc ? b : c)
|
|
436
|
+
stream.setbyte(pos + i, (stream.getbyte(pos + i) - pr) & 0xff)
|
|
437
|
+
end
|
|
438
|
+
stream.setbyte(pos, ChunkyPNG::FILTER_PAETH)
|
|
439
|
+
end
|
|
440
|
+
end
|
|
441
|
+
end
|
|
442
|
+
end
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
module ChunkyPNG
|
|
5
|
+
class Canvas
|
|
6
|
+
|
|
7
|
+
# The ChunkyPNG::Canvas::Resampling module defines methods to perform image resampling to
|
|
8
|
+
# a {ChunkyPNG::Canvas}.
|
|
9
|
+
#
|
|
10
|
+
# Currently, only the nearest neighbor algorithm is implemented. Bilinear and cubic
|
|
11
|
+
# algorithms may be added later on.
|
|
12
|
+
#
|
|
13
|
+
# @see ChunkyPNG::Canvas
|
|
14
|
+
module Resampling
|
|
15
|
+
|
|
16
|
+
# Integer Interpolation between two values
|
|
17
|
+
#
|
|
18
|
+
# Used for generating indicies for interpolation (eg, nearest
|
|
19
|
+
# neighbour).
|
|
20
|
+
#
|
|
21
|
+
# @param [Integer] width The width of the source
|
|
22
|
+
# @param [Integer] new_width The width of the destination
|
|
23
|
+
# @return [Array<Integer>] An Array of Integer indicies
|
|
24
|
+
def steps(width, new_width)
|
|
25
|
+
indicies, residues = steps_residues(width, new_width)
|
|
26
|
+
|
|
27
|
+
for i in 1..new_width
|
|
28
|
+
indicies[i-1] = (indicies[i-1] + (residues[i-1] + 127)/255)
|
|
29
|
+
end
|
|
30
|
+
return indicies
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Fractional Interpolation between two values
|
|
34
|
+
#
|
|
35
|
+
# Used for generating values for interpolation (eg, bilinear).
|
|
36
|
+
# Produces both the indices and the interpolation factors (residues).
|
|
37
|
+
#
|
|
38
|
+
# @param [Integer] width The width of the source
|
|
39
|
+
# @param [Integer] new_width The width of the destination
|
|
40
|
+
# @return [Array<Integer>, Array<Integer>] Two arrays of indicies and residues
|
|
41
|
+
def steps_residues(width, new_width)
|
|
42
|
+
indicies = Array.new(size=new_width, obj=nil)
|
|
43
|
+
residues = Array.new(size=new_width, obj=nil)
|
|
44
|
+
|
|
45
|
+
# This works by accumulating the fractional error and
|
|
46
|
+
# overflowing when necessary.
|
|
47
|
+
|
|
48
|
+
# We use mixed number arithmetic with a denominator of
|
|
49
|
+
# 2 * new_width
|
|
50
|
+
base_step = width / new_width
|
|
51
|
+
err_step = (width % new_width) << 1
|
|
52
|
+
denominator = (new_width) << 1
|
|
53
|
+
|
|
54
|
+
# Initial pixel
|
|
55
|
+
index = (width - new_width) / denominator
|
|
56
|
+
err = (width - new_width) % denominator
|
|
57
|
+
|
|
58
|
+
for i in 1..new_width
|
|
59
|
+
indicies[i-1] = index
|
|
60
|
+
residues[i-1] = (255.0 * err.to_f / denominator.to_f).round
|
|
61
|
+
|
|
62
|
+
index += base_step
|
|
63
|
+
err += err_step
|
|
64
|
+
if err >= denominator
|
|
65
|
+
index += 1
|
|
66
|
+
err -= denominator
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
return indicies, residues
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
# Resamples the canvas using nearest neighbor interpolation.
|
|
75
|
+
# @param [Integer] new_width The width of the resampled canvas.
|
|
76
|
+
# @param [Integer] new_height The height of the resampled canvas.
|
|
77
|
+
# @return [ChunkyPNG::Canvas] A new canvas instance with the resampled pixels.
|
|
78
|
+
def resample_nearest_neighbor!(new_width, new_height)
|
|
79
|
+
steps_x = steps(width, new_width)
|
|
80
|
+
steps_y = steps(height, new_height)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
pixels = Array.new(size=new_width*new_height)
|
|
84
|
+
i = 0
|
|
85
|
+
for y in steps_y
|
|
86
|
+
for x in steps_x
|
|
87
|
+
pixels[i] = get_pixel(x, y)
|
|
88
|
+
i += 1
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
replace_canvas!(new_width.to_i, new_height.to_i, pixels)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def resample_nearest_neighbor(new_width, new_height)
|
|
96
|
+
dup.resample_nearest_neighbor!(new_width, new_height)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Resamples the canvas with bilinear interpolation.
|
|
100
|
+
# @param [Integer] new_width The width of the resampled canvas.
|
|
101
|
+
# @param [Integer] new_height The height of the resampled canvas.
|
|
102
|
+
# @return [ChunkyPNG::Canvas] A new canvas instance with the resampled pixels.
|
|
103
|
+
def resample_bilinear!(new_width, new_height)
|
|
104
|
+
index_x, interp_x = steps_residues(width, new_width)
|
|
105
|
+
index_y, interp_y = steps_residues(height, new_height)
|
|
106
|
+
|
|
107
|
+
pixels = Array.new(size=new_width*new_height)
|
|
108
|
+
i = 0
|
|
109
|
+
for y in 1..new_height
|
|
110
|
+
# Clamp the indicies to the edges of the image
|
|
111
|
+
y1 = [index_y[y-1], 0].max
|
|
112
|
+
y2 = [index_y[y-1] + 1, height - 1].min
|
|
113
|
+
y_residue = interp_y[y-1]
|
|
114
|
+
|
|
115
|
+
for x in 1..new_width
|
|
116
|
+
# Clamp the indicies to the edges of the image
|
|
117
|
+
x1 = [index_x[x-1], 0].max
|
|
118
|
+
x2 = [index_x[x-1] + 1, width - 1].min
|
|
119
|
+
x_residue = interp_x[x-1]
|
|
120
|
+
|
|
121
|
+
pixel_11 = get_pixel(x1, y1)
|
|
122
|
+
pixel_21 = get_pixel(x2, y1)
|
|
123
|
+
pixel_12 = get_pixel(x1, y2)
|
|
124
|
+
pixel_22 = get_pixel(x2, y2)
|
|
125
|
+
|
|
126
|
+
# Interpolate by Row
|
|
127
|
+
pixel_top = ChunkyPNG::Color.interpolate_quick(pixel_21, pixel_11, x_residue)
|
|
128
|
+
pixel_bot = ChunkyPNG::Color.interpolate_quick(pixel_22, pixel_12, x_residue)
|
|
129
|
+
|
|
130
|
+
# Interpolate by Column
|
|
131
|
+
|
|
132
|
+
pixels[i] = ChunkyPNG::Color.interpolate_quick(pixel_bot, pixel_top, y_residue)
|
|
133
|
+
i += 1
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
replace_canvas!(new_width.to_i, new_height.to_i, pixels)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def resample_bilinear(new_width, new_height)
|
|
140
|
+
dup.resample_bilinear!(new_width, new_height)
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
alias_method :resample, :resample_nearest_neighbor
|
|
144
|
+
alias_method :resize, :resample
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
end
|