0
我有一個畫布,我添加了一個背景圖像到我的源代碼中,然後從本地計算機插入圖像並添加文本到圖像,我可以移動/旋轉圖像和文字沒有問題。 我希望能夠將上傳的圖像和文本移到背景圖像的前面,我找不到解決方案,我認爲它涉及多個Canvas圖層或類似的東西。請有人建議一種方法來做到這一點?Canvas上的多個圖像/圖層
<div class="well" style="height:350px;">
<a name="1"><center>Sonstiges</center></a>
<div class="cleaner_h3"></div>
<img style="cursor:pointer;width:90px;height:120px;" class="img-polaroid" src="img/phones/designs/son01r.png">
<img style="cursor:pointer;width:90px;height:120px;" class="img-polaroid" src="img/phones/designs/son02r.png">
<img style="cursor:pointer;width:90px;height:120px;" class="img-polaroid" src="img/phones/designs/son09.png">
<img style="cursor:pointer;width:90px;height:120px;" class="img-polaroid" src="img/phones/designs/son04p.png">
<img style="cursor:pointer;width:90px;height:120px;" class="img-polaroid" src="img/phones/designs/son05p.png">
</div>
Jquery portion where I add the background image
$(".img-polaroid").click(function(e){
var el = e.target;
var design = $(this).attr("src"); //src is the particular image you click on
$('#tcanvas').css({
'backgroundImage': 'url(' + design +')',
'backgroundRepeat': 'no-repeat',
'backgroundPosition': 'top center',
'background-size': '100% 100%'
});
});
Canvas element
<div id="phoneDiv" class="page" style="width: 800px; height: 800px; position: relative;left:5%; background-color: rgb(255, 255, 255);">
<canvas id="tcanvas" width=800 height="800" class="hover" style="-webkit-user-select: none;"></canvas>
</div>