HTML5 canvas drawImage()不会在Firefox上绘制大图像

时间:2014-09-04 11:48:04

标签: html5 firefox html5-canvas

如果我尝试在localhost中启动代码。这没有显示mozilla firefox的图像,但在其他浏览器中显示成功。如果我尝试加载小图像加载

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<canvas id="containerScaled"></canvas>
<script>
$(document).ready(function() {  
    var canvasScaled = document.getElementById("containerScaled");
    var ctxScaled = canvasScaled.getContext("2d");

    var imageWidth = 500; 
    var imageHeight = 500;


    img = new Image();
    img.onload = function() {
        ctxScaled.drawImage(img, 0, 0, imageWidth, imageHeight);
    };

    img.src = 'http://upload.wikimedia.org/wikipedia/commons/3/3f/Fronalpstock_big.jpg'
});
</script>

1 个答案:

答案 0 :(得分:0)

以下是它在这种情况下的表现:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<canvas id="containerScaled"></canvas>
simulation <- structure(list(simulation = c(124786.7479,269057.2118,80432.47896,119513.0161,660840.5843,190983.7893)), .Names = "simulation", row.names = c(NA,6L), class = "data.frame")
limits <- structure(list(limits = c(5000L,10000L,15000L, 20000L,25000L,30000L)), .Names = "limits", row.names = c(NA, 6L), class = "data.frame")

library(bigstatsr)
# Create the filebacked matrix on disk (in `/tmp/` by default)
mat <- FBM(nrow(simulation), nrow(limits))
# Fill this matrix in Rcpp
Rcpp::sourceCpp('fill-FBM.cpp')
fillMat(mat, limits[[1]], simulation[[1]])  
# Access the whole matrix in RAM to verify
# or you could access only block of columns
mat[]
mat[, 1:3]