bench9000 0.1
Sign up to get free protection for your applications and to get access to all the features.
- 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,15 @@
|
|
1
|
+
# Define the byte-operators on a string if they're not defined (Ruby 1.8)
|
2
|
+
|
3
|
+
class String
|
4
|
+
alias_method :getbyte, :[] unless method_defined?(:getbyte)
|
5
|
+
alias_method :setbyte, :[]= unless method_defined?(:setbyte)
|
6
|
+
alias_method :bytesize, :size unless method_defined?(:bytesize)
|
7
|
+
end
|
8
|
+
|
9
|
+
module Enumerable
|
10
|
+
unless method_defined?(:minmax)
|
11
|
+
def minmax
|
12
|
+
[min, max]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,185 @@
|
|
1
|
+
module ChunkyPNG
|
2
|
+
|
3
|
+
# The Datastream class represents a PNG formatted datastream. It supports
|
4
|
+
# both reading from and writing to strings, streams and files.
|
5
|
+
#
|
6
|
+
# A PNG datastream begins with the PNG signature, and than contains multiple
|
7
|
+
# chunks, starting with a header (IHDR) chunk and finishing with an end
|
8
|
+
# (IEND) chunk.
|
9
|
+
#
|
10
|
+
# @see ChunkyPNG::Chunk
|
11
|
+
class Datastream
|
12
|
+
|
13
|
+
# The signature that each PNG file or stream should begin with.
|
14
|
+
SIGNATURE = ChunkyPNG.force_binary([137, 80, 78, 71, 13, 10, 26, 10].pack('C8'))
|
15
|
+
|
16
|
+
# The header chunk of this datastream.
|
17
|
+
# @return [ChunkyPNG::Chunk::Header]
|
18
|
+
attr_accessor :header_chunk
|
19
|
+
|
20
|
+
# All other chunks in this PNG file.
|
21
|
+
# @return [Array<ChunkyPNG::Chunk::Generic>]
|
22
|
+
attr_accessor :other_chunks
|
23
|
+
|
24
|
+
# The chunk containing the image's palette.
|
25
|
+
# @return [ChunkyPNG::Chunk::Palette]
|
26
|
+
attr_accessor :palette_chunk
|
27
|
+
|
28
|
+
# The chunk containing the transparency information of the palette.
|
29
|
+
# @return [ChunkyPNG::Chunk::Transparency]
|
30
|
+
attr_accessor :transparency_chunk
|
31
|
+
|
32
|
+
# The chunks that together compose the images pixel data.
|
33
|
+
# @return [Array<ChunkyPNG::Chunk::ImageData>]
|
34
|
+
attr_accessor :data_chunks
|
35
|
+
|
36
|
+
# The empty chunk that signals the end of this datastream
|
37
|
+
# @return [ChunkyPNG::Chunk::Header]
|
38
|
+
attr_accessor :end_chunk
|
39
|
+
|
40
|
+
# Initializes a new Datastream instance.
|
41
|
+
def initialize
|
42
|
+
@other_chunks = []
|
43
|
+
@data_chunks = []
|
44
|
+
end
|
45
|
+
|
46
|
+
##############################################################################
|
47
|
+
# LOADING DATASTREAMS
|
48
|
+
##############################################################################
|
49
|
+
|
50
|
+
class << self
|
51
|
+
|
52
|
+
# Reads a PNG datastream from a string.
|
53
|
+
# @param [String] str The PNG encoded string to load from.
|
54
|
+
# @return [ChunkyPNG::Datastream] The loaded datastream instance.
|
55
|
+
def from_blob(str)
|
56
|
+
from_io(StringIO.new(str))
|
57
|
+
end
|
58
|
+
|
59
|
+
alias :from_string :from_blob
|
60
|
+
|
61
|
+
# Reads a PNG datastream from a file.
|
62
|
+
# @param [String] filename The path of the file to load from.
|
63
|
+
# @return [ChunkyPNG::Datastream] The loaded datastream instance.
|
64
|
+
def from_file(filename)
|
65
|
+
ds = nil
|
66
|
+
File.open(filename, 'rb') { |f| ds = from_io(f) }
|
67
|
+
ds
|
68
|
+
end
|
69
|
+
|
70
|
+
# Reads a PNG datastream from an input stream
|
71
|
+
# @param [IO] io The stream to read from.
|
72
|
+
# @return [ChunkyPNG::Datastream] The loaded datastream instance.
|
73
|
+
def from_io(io)
|
74
|
+
verify_signature!(io)
|
75
|
+
|
76
|
+
ds = self.new
|
77
|
+
until io.eof?
|
78
|
+
chunk = ChunkyPNG::Chunk.read(io)
|
79
|
+
case chunk
|
80
|
+
when ChunkyPNG::Chunk::Header; ds.header_chunk = chunk
|
81
|
+
when ChunkyPNG::Chunk::Palette; ds.palette_chunk = chunk
|
82
|
+
when ChunkyPNG::Chunk::Transparency; ds.transparency_chunk = chunk
|
83
|
+
when ChunkyPNG::Chunk::ImageData; ds.data_chunks << chunk
|
84
|
+
when ChunkyPNG::Chunk::End; ds.end_chunk = chunk
|
85
|
+
else ds.other_chunks << chunk
|
86
|
+
end
|
87
|
+
end
|
88
|
+
return ds
|
89
|
+
end
|
90
|
+
|
91
|
+
# Verifies that the current stream is a PNG datastream by checking its signature.
|
92
|
+
#
|
93
|
+
# This method reads the PNG signature from the stream, setting the current position
|
94
|
+
# of the stream directly after the signature, where the IHDR chunk should begin.
|
95
|
+
#
|
96
|
+
# @param [IO] io The stream to read the PNG signature from.
|
97
|
+
# @raise [RuntimeError] An exception is raised if the PNG signature is not found at
|
98
|
+
# the beginning of the stream.
|
99
|
+
def verify_signature!(io)
|
100
|
+
signature = io.read(ChunkyPNG::Datastream::SIGNATURE.length)
|
101
|
+
unless ChunkyPNG.force_binary(signature) == ChunkyPNG::Datastream::SIGNATURE
|
102
|
+
raise ChunkyPNG::SignatureMismatch, "PNG signature not found, found #{signature.inspect} instead of #{ChunkyPNG::Datastream::SIGNATURE.inspect}!"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
##################################################################################
|
108
|
+
# CHUNKS
|
109
|
+
##################################################################################
|
110
|
+
|
111
|
+
# Enumerates the chunks in this datastream.
|
112
|
+
#
|
113
|
+
# This will iterate over the chunks using the order in which the chunks
|
114
|
+
# should appear in the PNG file.
|
115
|
+
#
|
116
|
+
# @yield [chunk] Yields the chunks in this datastream, one by one in the correct order.
|
117
|
+
# @yieldparam [ChunkyPNG::Chunk::Base] chunk A chunk in this datastream.
|
118
|
+
# @see ChunkyPNG::Datastream#chunks
|
119
|
+
def each_chunk
|
120
|
+
yield(header_chunk)
|
121
|
+
other_chunks.each { |chunk| yield(chunk) }
|
122
|
+
yield(palette_chunk) if palette_chunk
|
123
|
+
yield(transparency_chunk) if transparency_chunk
|
124
|
+
data_chunks.each { |chunk| yield(chunk) }
|
125
|
+
yield(end_chunk)
|
126
|
+
end
|
127
|
+
|
128
|
+
# Returns an enumerator instance for this datastream's chunks.
|
129
|
+
# @return [Enumerable::Enumerator] An enumerator for the :each_chunk method.
|
130
|
+
# @see ChunkyPNG::Datastream#each_chunk
|
131
|
+
def chunks
|
132
|
+
enum_for(:each_chunk)
|
133
|
+
end
|
134
|
+
|
135
|
+
# Returns all the textual metadata key/value pairs as hash.
|
136
|
+
# @return [Hash] A hash containing metadata fields and their values.
|
137
|
+
def metadata
|
138
|
+
metadata = {}
|
139
|
+
other_chunks.select do |chunk|
|
140
|
+
metadata[chunk.keyword] = chunk.value if chunk.respond_to?(:keyword)
|
141
|
+
end
|
142
|
+
metadata
|
143
|
+
end
|
144
|
+
|
145
|
+
# Returns the uncompressed image data, combined from all the IDAT chunks
|
146
|
+
# @return [String] The uncompressed image data for this datastream
|
147
|
+
def imagedata
|
148
|
+
ChunkyPNG::Chunk::ImageData.combine_chunks(data_chunks)
|
149
|
+
end
|
150
|
+
|
151
|
+
##################################################################################
|
152
|
+
# WRITING DATASTREAMS
|
153
|
+
##################################################################################
|
154
|
+
|
155
|
+
# Returns an empty stream using binary encoding that can be used as stream to encode to.
|
156
|
+
# @return [String] An empty, binary string.
|
157
|
+
def self.empty_bytearray
|
158
|
+
ChunkyPNG::EMPTY_BYTEARRAY.dup
|
159
|
+
end
|
160
|
+
|
161
|
+
# Writes the datastream to the given output stream.
|
162
|
+
# @param [IO] io The output stream to write to.
|
163
|
+
def write(io)
|
164
|
+
io << SIGNATURE
|
165
|
+
each_chunk { |c| c.write(io) }
|
166
|
+
end
|
167
|
+
|
168
|
+
# Saves this datastream as a PNG file.
|
169
|
+
# @param [String] filename The filename to use.
|
170
|
+
def save(filename)
|
171
|
+
File.open(filename, 'wb') { |f| write(f) }
|
172
|
+
end
|
173
|
+
|
174
|
+
# Encodes this datastream into a string.
|
175
|
+
# @return [String] The encoded PNG datastream.
|
176
|
+
def to_blob
|
177
|
+
str = StringIO.new
|
178
|
+
write(str)
|
179
|
+
return str.string
|
180
|
+
end
|
181
|
+
|
182
|
+
alias :to_string :to_blob
|
183
|
+
alias :to_s :to_blob
|
184
|
+
end
|
185
|
+
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
module ChunkyPNG
|
2
|
+
|
3
|
+
# Creates a {ChunkyPNG::Dimension} instance using arguments that can be interpreted
|
4
|
+
# as width and height.
|
5
|
+
#
|
6
|
+
# @overload Dimension(width, height)
|
7
|
+
# @param [Integer] width The width-component of the dimension.
|
8
|
+
# @param [Integer] height The height-component of the dimension.
|
9
|
+
# @return [ChunkyPNG::Dimension] The instantiated dimension.
|
10
|
+
#
|
11
|
+
# @overload Dimension(string)
|
12
|
+
# @param [String] string A string from which a width and height value can be parsed, e.g.
|
13
|
+
# <tt>'10x20'</tt> or <tt>'[10, 20]'</tt>.
|
14
|
+
# @return [ChunkyPNG::Dimension] The instantiated dimension.
|
15
|
+
#
|
16
|
+
# @overload Dimension(ary)
|
17
|
+
# @param [Array] ary An array with the desired width as first element and the
|
18
|
+
# desired height as second element, e.g. <tt>[10, 20]</tt>.
|
19
|
+
# @return [ChunkyPNG::Dimension] The instantiated dimension.
|
20
|
+
#
|
21
|
+
# @overload Dimension(hash)
|
22
|
+
# @param [Hash] hash An hash with a <tt>'height'</tt> or <tt>:height</tt> key for the
|
23
|
+
# desired height and with a <tt>'width'</tt> or <tt>:width</tt> key for the desired
|
24
|
+
# width.
|
25
|
+
# @return [ChunkyPNG::Dimension] The instantiated dimension.
|
26
|
+
#
|
27
|
+
# @return [ChunkyPNG::Dimension] The dimension created by this factory method.
|
28
|
+
# @raise [ArgumentError] If the argument(s) given where not understood as a dimension.
|
29
|
+
# @see ChunkyPNG::Dimension
|
30
|
+
def self.Dimension(*args)
|
31
|
+
|
32
|
+
case args.length
|
33
|
+
when 2; ChunkyPNG::Dimension.new(*args)
|
34
|
+
when 1; case source = args.first
|
35
|
+
when ChunkyPNG::Dimension; source
|
36
|
+
when ChunkyPNG::Point; ChunkyPNG::Dimension.new(source.x, source.y)
|
37
|
+
when Array; ChunkyPNG::Dimension.new(source[0], source[1])
|
38
|
+
when Hash; ChunkyPNG::Dimension.new(source[:width] || source['width'], source[:height] || source['height'])
|
39
|
+
when ChunkyPNG::Dimension::DIMENSION_REGEXP; ChunkyPNG::Dimension.new($1, $2)
|
40
|
+
else
|
41
|
+
if source.respond_to?(:width) && source.respond_to?(:height)
|
42
|
+
ChunkyPNG::Dimension.new(source.width, source.height)
|
43
|
+
else
|
44
|
+
raise ArgumentError, "Don't know how to construct a point from #{source.inspect}!"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
else raise ArgumentError, "Don't know how to construct a point from #{args.inspect}!"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# Class that represents the dimension of something, e.g. a {ChunkyPNG::Canvas}.
|
52
|
+
#
|
53
|
+
# This class contains some methods to simplify performing dimension related checks.
|
54
|
+
class Dimension
|
55
|
+
|
56
|
+
# @return [Regexp] The regexp to parse dimensions from a string.
|
57
|
+
# @private
|
58
|
+
DIMENSION_REGEXP = /^[\(\[\{]?(\d+)\s*[x,]?\s*(\d+)[\)\]\}]?$/
|
59
|
+
|
60
|
+
# @return [Integer] The width-component of this dimension.
|
61
|
+
attr_accessor :width
|
62
|
+
|
63
|
+
# @return [Integer] The height-component of this dimension.
|
64
|
+
attr_accessor :height
|
65
|
+
|
66
|
+
# Initializes a new dimension instance.
|
67
|
+
# @param [Integer] width The width-component of the new dimension.
|
68
|
+
# @param [Integer] height The height-component of the new dimension.
|
69
|
+
def initialize(width, height)
|
70
|
+
@width, @height = width.to_i, height.to_i
|
71
|
+
end
|
72
|
+
|
73
|
+
# Returns the area of this dimension.
|
74
|
+
# @return [Integer] The area in number of pixels.
|
75
|
+
def area
|
76
|
+
width * height
|
77
|
+
end
|
78
|
+
|
79
|
+
# Checks whether a point is within bounds of this dimension.
|
80
|
+
# @param [ChunkyPNG::Point, ...] A point-like to bounds-check.
|
81
|
+
# @return [true, false] True iff the x and y coordinate fall in this dimension.
|
82
|
+
# @see ChunkyPNG.Point
|
83
|
+
def include?(*point_like)
|
84
|
+
point = ChunkyPNG::Point(*point_like)
|
85
|
+
point.x >= 0 && point.x < width && point.y >= 0 && point.y < height
|
86
|
+
end
|
87
|
+
|
88
|
+
# Checks whether 2 dimensions are identical.
|
89
|
+
# @param [ChunkyPNG::Dimension] The dimension to compare with.
|
90
|
+
# @return [true, false] <tt>true</tt> iff width and height match.
|
91
|
+
def eql?(other)
|
92
|
+
other.width == width && other.height == height
|
93
|
+
end
|
94
|
+
|
95
|
+
alias_method :==, :eql?
|
96
|
+
|
97
|
+
# Compares the size of 2 dimensions.
|
98
|
+
# @param [ChunkyPNG::Dimension] The dimension to compare with.
|
99
|
+
# @return [-1, 0, 1] -1 if the other dimension has a larger area, 1 of this
|
100
|
+
# dimension is larger, 0 if both are identical in size.
|
101
|
+
def <=>(other)
|
102
|
+
other.area <=> area
|
103
|
+
end
|
104
|
+
|
105
|
+
# Casts this dimension into an array.
|
106
|
+
# @return [Array<Integer>] <tt>[width, height]</tt> for this dimension.
|
107
|
+
def to_a
|
108
|
+
[width, height]
|
109
|
+
end
|
110
|
+
|
111
|
+
alias_method :to_ary, :to_a
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
module ChunkyPNG
|
2
|
+
|
3
|
+
# ChunkyPNG::Image is an extension of the {ChunkyPNG::Canvas} class, that
|
4
|
+
# also includes support for metadata.
|
5
|
+
#
|
6
|
+
# @see ChunkyPNG::Canvas
|
7
|
+
class Image < Canvas
|
8
|
+
|
9
|
+
# The minimum size of bytes the value of a metadata field should be before compression
|
10
|
+
# is enabled for the chunk.
|
11
|
+
METADATA_COMPRESSION_TRESHOLD = 300
|
12
|
+
|
13
|
+
# @return [Hash] The hash of metadata fields for this PNG image.
|
14
|
+
attr_accessor :metadata
|
15
|
+
|
16
|
+
# Initializes a new ChunkyPNG::Image instance.
|
17
|
+
# @param [Integer] width The width of the new image.
|
18
|
+
# @param [Integer] height The height of the new image.
|
19
|
+
# @param [Integer] bg_color The background color of the new image.
|
20
|
+
# @param [Hash] metadata A hash of metadata fields and values for this image.
|
21
|
+
# @see ChunkyPNG::Canvas#initialize
|
22
|
+
def initialize(width, height, bg_color = ChunkyPNG::Color::TRANSPARENT, metadata = {})
|
23
|
+
super(width, height, bg_color)
|
24
|
+
@metadata = metadata
|
25
|
+
end
|
26
|
+
|
27
|
+
# Initializes a copy of another ChunkyPNG::Image instance.
|
28
|
+
#
|
29
|
+
# @param [ChunkyPNG::Image] other The other image to copy.
|
30
|
+
def initialize_copy(other)
|
31
|
+
super(other)
|
32
|
+
@metadata = other.metadata
|
33
|
+
end
|
34
|
+
|
35
|
+
# Returns the metadata for this image as PNG chunks.
|
36
|
+
#
|
37
|
+
# Chunks will either be of the {ChunkyPNG::Chunk::Text} type for small
|
38
|
+
# values (in bytes), or of the {ChunkyPNG::Chunk::CompressedText} type
|
39
|
+
# for values that are larger in size.
|
40
|
+
#
|
41
|
+
# @return [Array<ChunkyPNG::Chunk>] An array of metadata chunks.
|
42
|
+
# @see ChunkyPNG::Image::METADATA_COMPRESSION_TRESHOLD
|
43
|
+
def metadata_chunks
|
44
|
+
metadata.map do |key, value|
|
45
|
+
if value.length >= METADATA_COMPRESSION_TRESHOLD
|
46
|
+
ChunkyPNG::Chunk::CompressedText.new(key, value)
|
47
|
+
else
|
48
|
+
ChunkyPNG::Chunk::Text.new(key, value)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# Encodes the image to a PNG datastream for saving to disk or writing to an IO stream.
|
54
|
+
#
|
55
|
+
# Besides encoding the canvas, it will also encode the metadata fields to text chunks.
|
56
|
+
#
|
57
|
+
# @param [Hash] constraints The constraints to use when encoding the canvas.
|
58
|
+
# @return [ChunkyPNG::Datastream] The datastream that contains this image.
|
59
|
+
# @see ChunkyPNG::Canvas::PNGEncoding#to_datastream
|
60
|
+
# @see #metadata_chunks
|
61
|
+
def to_datastream(constraints = {})
|
62
|
+
ds = super(constraints)
|
63
|
+
ds.other_chunks += metadata_chunks
|
64
|
+
return ds
|
65
|
+
end
|
66
|
+
|
67
|
+
# Reads a ChunkyPNG::Image instance from a data stream.
|
68
|
+
#
|
69
|
+
# Besides decoding the canvas, this will also read the metadata fields
|
70
|
+
# from the datastream.
|
71
|
+
#
|
72
|
+
# @param [ChunkyPNG::Datastream] The datastream to read from.
|
73
|
+
def self.from_datastream(ds)
|
74
|
+
image = super(ds)
|
75
|
+
image.metadata = ds.metadata
|
76
|
+
return image
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,209 @@
|
|
1
|
+
module ChunkyPNG
|
2
|
+
|
3
|
+
# A palette describes the set of colors that is being used for an image.
|
4
|
+
#
|
5
|
+
# A PNG image can contain an explicit palette which defines the colors of
|
6
|
+
# that image, but can also use an implicit palette, e.g. all truecolor
|
7
|
+
# colors or all grayscale colors.
|
8
|
+
#
|
9
|
+
# This palette supports decoding colors from a palette if an explicit
|
10
|
+
# palette is provided in a PNG datastream, and it supports encoding colors
|
11
|
+
# to an explicit palette (stores as PLTE & tRNS chunks in a PNG file).
|
12
|
+
#
|
13
|
+
# @see ChunkyPNG::Color
|
14
|
+
class Palette < SortedSet
|
15
|
+
|
16
|
+
# Builds a new palette given a set (Enumerable instance) of colors.
|
17
|
+
#
|
18
|
+
# @param [Enumerable<Integer>] enum The set of colors to include in this palette.
|
19
|
+
# This Enumerable can contains duplicates.
|
20
|
+
# @param [Array] decoding_map An array of colors in the exact order at which
|
21
|
+
# they appeared in the palette chunk, so that this array can be used for decoding.
|
22
|
+
def initialize(enum, decoding_map = nil)
|
23
|
+
super(enum)
|
24
|
+
@decoding_map = decoding_map if decoding_map
|
25
|
+
end
|
26
|
+
|
27
|
+
# Builds a palette instance from a PLTE chunk and optionally a tRNS chunk
|
28
|
+
# from a PNG datastream.
|
29
|
+
#
|
30
|
+
# This method will cerate a palette that is suitable for decoding an image.
|
31
|
+
#
|
32
|
+
# @param [ChunkyPNG::Chunk::Palette] The palette chunk to load from
|
33
|
+
# @param [ChunkyPNG::Chunk::Transparency, nil] The optional transparency chunk.
|
34
|
+
# @return [ChunkyPNG::Palette] The loaded palette instance.
|
35
|
+
# @see ChunkyPNG::Palette#can_decode?
|
36
|
+
def self.from_chunks(palette_chunk, transparency_chunk = nil)
|
37
|
+
return nil if palette_chunk.nil?
|
38
|
+
|
39
|
+
decoding_map = []
|
40
|
+
index = 0
|
41
|
+
|
42
|
+
palatte_bytes = palette_chunk.content.unpack('C*')
|
43
|
+
if transparency_chunk
|
44
|
+
alpha_channel = transparency_chunk.content.unpack('C*')
|
45
|
+
else
|
46
|
+
alpha_channel = []
|
47
|
+
end
|
48
|
+
|
49
|
+
index = 0
|
50
|
+
palatte_bytes.each_slice(3) do |bytes|
|
51
|
+
bytes << alpha_channel.fetch(index, ChunkyPNG::Color::MAX)
|
52
|
+
decoding_map << ChunkyPNG::Color.rgba(*bytes)
|
53
|
+
index += 1
|
54
|
+
end
|
55
|
+
|
56
|
+
self.new(decoding_map, decoding_map)
|
57
|
+
end
|
58
|
+
|
59
|
+
# Builds a palette instance from a given canvas.
|
60
|
+
# @param [ChunkyPNG::Canvas] canvas The canvas to create a palette for.
|
61
|
+
# @return [ChunkyPNG::Palette] The palette instance.
|
62
|
+
def self.from_canvas(canvas)
|
63
|
+
self.new(canvas.pixels)
|
64
|
+
end
|
65
|
+
|
66
|
+
# Builds a palette instance from a given set of pixels.
|
67
|
+
# @param [Enumerable<Integer>] pixels An enumeration of pixels to create a palette for
|
68
|
+
# @return [ChunkyPNG::Palette] The palette instance.
|
69
|
+
def self.from_pixels(pixels)
|
70
|
+
self.new(pixels)
|
71
|
+
end
|
72
|
+
|
73
|
+
# Checks whether the size of this palette is suitable for indexed storage.
|
74
|
+
# @return [true, false] True if the number of colors in this palette is at most 256.
|
75
|
+
def indexable?
|
76
|
+
size <= 256
|
77
|
+
end
|
78
|
+
|
79
|
+
# Check whether this palette only contains opaque colors.
|
80
|
+
# @return [true, false] True if all colors in this palette are opaque.
|
81
|
+
# @see ChunkyPNG::Color#opaque?
|
82
|
+
def opaque?
|
83
|
+
all? { |color| Color.opaque?(color) }
|
84
|
+
end
|
85
|
+
|
86
|
+
# Check whether this palette only contains grayscale colors.
|
87
|
+
# @return [true, false] True if all colors in this palette are grayscale teints.
|
88
|
+
# @see ChunkyPNG::Color#grayscale??
|
89
|
+
def grayscale?
|
90
|
+
all? { |color| Color.grayscale?(color) }
|
91
|
+
end
|
92
|
+
|
93
|
+
# Check whether this palette only contains bacl and white.
|
94
|
+
# @return [true, false] True if all colors in this palette are grayscale teints.
|
95
|
+
# @see ChunkyPNG::Color#grayscale??
|
96
|
+
def black_and_white?
|
97
|
+
entries == [ChunkyPNG::Color::BLACK, ChunkyPNG::Color::WHITE]
|
98
|
+
end
|
99
|
+
|
100
|
+
# Returns a palette with all the opaque variants of the colors in this palette.
|
101
|
+
# @return [ChunkyPNG::Palette] A new Palette instance with only opaque colors.
|
102
|
+
# @see ChunkyPNG::Color#opaque!
|
103
|
+
def opaque_palette
|
104
|
+
self.class.new(map { |c| ChunkyPNG::Color.opaque!(c) })
|
105
|
+
end
|
106
|
+
|
107
|
+
# Checks whether this palette is suitable for decoding an image from a datastream.
|
108
|
+
#
|
109
|
+
# This requires that the positions of the colors in the original palette chunk is known,
|
110
|
+
# which is stored as an array in the +@decoding_map+ instance variable.
|
111
|
+
#
|
112
|
+
# @return [true, false] True if a decoding map was built when this palette was loaded.
|
113
|
+
def can_decode?
|
114
|
+
!@decoding_map.nil?
|
115
|
+
end
|
116
|
+
|
117
|
+
# Checks whether this palette is suitable for encoding an image from to datastream.
|
118
|
+
#
|
119
|
+
# This requires that the position of the color in the future palette chunk is known,
|
120
|
+
# which is stored as a hash in the +@encoding_map+ instance variable.
|
121
|
+
#
|
122
|
+
# @return [true, false] True if a encoding map was built when this palette was loaded.
|
123
|
+
def can_encode?
|
124
|
+
!@encoding_map.nil?
|
125
|
+
end
|
126
|
+
|
127
|
+
# Returns a color, given the position in the original palette chunk.
|
128
|
+
# @param [Integer] index The 0-based position of the color in the palette.
|
129
|
+
# @return [ChunkyPNG::Color] The color that is stored in the palette under the given index
|
130
|
+
# @see ChunkyPNG::Palette#can_decode?
|
131
|
+
def [](index)
|
132
|
+
@decoding_map[index]
|
133
|
+
end
|
134
|
+
|
135
|
+
# Returns the position of a color in the palette
|
136
|
+
# @param [ChunkyPNG::Color] color The color for which to look up the index.
|
137
|
+
# @return [Integer] The 0-based position of the color in the palette.
|
138
|
+
# @see ChunkyPNG::Palette#can_encode?
|
139
|
+
def index(color)
|
140
|
+
color.nil? ? 0 : @encoding_map[color]
|
141
|
+
end
|
142
|
+
|
143
|
+
# Creates a tRNS chunk that corresponds with this palette to store the
|
144
|
+
# alpha channel of all colors.
|
145
|
+
#
|
146
|
+
# Note that this chunk can be left out of every color in the palette is
|
147
|
+
# opaque, and the image is encoded using indexed colors.
|
148
|
+
#
|
149
|
+
# @return [ChunkyPNG::Chunk::Transparency] The tRNS chunk.
|
150
|
+
def to_trns_chunk
|
151
|
+
ChunkyPNG::Chunk::Transparency.new('tRNS', map { |c| ChunkyPNG::Color.a(c) }.pack('C*'))
|
152
|
+
end
|
153
|
+
|
154
|
+
# Creates a PLTE chunk that corresponds with this palette to store the
|
155
|
+
# r, g and b channels of all colors.
|
156
|
+
#
|
157
|
+
# Note that a PLTE chunk should only be included if the image is
|
158
|
+
# encoded using index colors. After this chunk has been built, the
|
159
|
+
# palette becomes suitable for encoding an image.
|
160
|
+
#
|
161
|
+
# @return [ChunkyPNG::Chunk::Palette] The PLTE chunk.
|
162
|
+
# @see ChunkyPNG::Palette#can_encode?
|
163
|
+
def to_plte_chunk
|
164
|
+
@encoding_map = {}
|
165
|
+
colors = []
|
166
|
+
|
167
|
+
each_with_index do |color, index|
|
168
|
+
@encoding_map[color] = index
|
169
|
+
colors += ChunkyPNG::Color.to_truecolor_bytes(color)
|
170
|
+
end
|
171
|
+
|
172
|
+
ChunkyPNG::Chunk::Palette.new('PLTE', colors.pack('C*'))
|
173
|
+
end
|
174
|
+
|
175
|
+
# Determines the most suitable colormode for this palette.
|
176
|
+
# @return [Integer] The colormode which would create the smallest possible
|
177
|
+
# file for images that use this exact palette.
|
178
|
+
def best_color_settings
|
179
|
+
if black_and_white?
|
180
|
+
[ChunkyPNG::COLOR_GRAYSCALE, 1]
|
181
|
+
elsif grayscale?
|
182
|
+
if opaque?
|
183
|
+
[ChunkyPNG::COLOR_GRAYSCALE, 8]
|
184
|
+
else
|
185
|
+
[ChunkyPNG::COLOR_GRAYSCALE_ALPHA, 8]
|
186
|
+
end
|
187
|
+
elsif indexable?
|
188
|
+
[ChunkyPNG::COLOR_INDEXED, determine_bit_depth]
|
189
|
+
elsif opaque?
|
190
|
+
[ChunkyPNG::COLOR_TRUECOLOR, 8]
|
191
|
+
else
|
192
|
+
[ChunkyPNG::COLOR_TRUECOLOR_ALPHA, 8]
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
# Determines the minimal bit depth required for an indexed image
|
197
|
+
# @return [Integer] Number of bits per pixel, i.e. 1, 2, 4 or 8, or nil if this
|
198
|
+
# image cannot be saved as an indexed image.
|
199
|
+
def determine_bit_depth
|
200
|
+
case size
|
201
|
+
when 1..2; 1
|
202
|
+
when 3..4; 2
|
203
|
+
when 5..16; 4
|
204
|
+
when 17..256; 8
|
205
|
+
else nil
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|