当我使用网络浏览器时,我可以下载图像,但是当我将其转换为apk时无法下载它 我是Cordova的新手,所以如果您会推荐插件,请告诉我如何使用 //绘制
// draw the canvas
function draw() {
var canvas = document.getElementById("imageCanvas");
var ctx = canvas.getContext("2d");
ctx.fillStyle = "rgba(125, 46, 138, 0.5)";
ctx.fillRect(25, 25, 100, 100);
ctx.fillStyle = "rgba( 0, 146, 38, 0.5)";
ctx.fillRect(58, 74, 125, 100);
}
// convert to image
function to_image() {
var canvas = document.getElementById("imageCanvas");
document.getElementById("theimage").src = canvas.toDataURL();
Canvas2Image.saveAsPNG(canvas);
}
</script>
//html code
<div class="page-wrap">
<div class="controls">
<input class="controls__input" type="file" id="imageLoader" name="imageLoader" style="visibility: hidden" />
<!-- <label class="controls__label" for="name">First, choose an image.</label>-->
<label class="controls__label" for="name"> اختر لون الكتابة</label>
<select id="myselect">
<option id="white">ابيض</option>
<option id="black">اسود</option>
</select>
<input class="controls__input" id="name" type="text" value="" placeholder="اكتب اسمك هنا" style="width: 40%;" />
<label class="controls__label" for="name">اكتب هنا</label>
</div>
<div id="canvas-wrap">
<canvas id="imageCanvas" style="
margin: auto;" height=400 width="300">
<canvas id="canvasID"></canvas>
</canvas>
</div>
</div>
预先感谢