Sha256: 46a492cc6c3636b1a1f1860db59a56fd74754dd5b866526311b29df789b2665d

Contents?: true

Size: 1.98 KB

Versions: 1

Compression:

Stored size: 1.98 KB

Contents

o: ActiveSupport::Cache::Entry	:@compressedF:@expires_in0:@created_atf1372843464.4422789:@value"€{I"
class:EFI"BundledAsset;FI"logical_path;FI"Core/getImagePixels.js;TI"
pathname;FI"S/Users/bwrona/www/engines/cesium/app/assets/javascripts/Core/getImagePixels.js;TI"content_type;FI"application/javascript;FI"
mtime;FI"2013-07-03T11:02:49+02:00;FI"length;Fi¦I"digest;F"%1d00662b908507c2fa95e563966f74b5I"source;FI"¦/*global define*/

define(function() {
    "use strict";

    var context2DsByWidthAndHeight = {};

    /**
     * Extract a pixel array from a loaded image.  Draws the image
     * into a canvas so it can read the pixels back.
     *
     * @exports getImagePixels
     *
     * @param {Image} image The image to extract pixels from.
     *
     * @returns {CanvasPixelArray} The pixels of the image.
     */
    var getImagePixels = function(image, width, height) {
        if (typeof width === 'undefined') {
            width = image.width;
        }
        if (typeof height === 'undefined') {
            height = image.height;
        }

        var context2DsByHeight = context2DsByWidthAndHeight[width];
        if (typeof context2DsByHeight === 'undefined') {
            context2DsByHeight = {};
            context2DsByWidthAndHeight[width] = context2DsByHeight;
        }

        var context2d = context2DsByHeight[height];
        if (typeof context2d === 'undefined') {
            var canvas = document.createElement('canvas');
            canvas.width = width;
            canvas.height = height;
            context2d = canvas.getContext('2d');
            context2d.globalCompositeOperation = 'copy';
            context2DsByHeight[height] = context2d;
        }

        context2d.drawImage(image, 0, 0, width, height);
        return context2d.getImageData(0, 0, width, height).data;
    };

    return getImagePixels;
});
;FI"required_assets_digest;F"%57f46849f47a81e8350f54d611e4790fI"
_version;F"%6776f581a4329e299531e1d52aa59832

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cesium-0.18.0 test/dummy/tmp/cache/assets/CDE/FA0/sprockets%2Fbed220a29ad8d1d57258771196027c8c