问题描述
有没有一个jQuery插件或代码,我可以调整图像(或画布(与这个图像)),并将其复制到另一个图像(或画布)的大小?
图片#2是一个
编辑:
想法:也许使用 -moz-transform:scale ,sy)
/ -webkit-transform:scale(sx,sy)
?
或 ,这是一个很好的起点。
Is there a jQuery plugin or code with which I could resize an image (or canvas (with this image)) and copy that into another image (or canvas)?Picture #2 is a
EDIT:Idea: Maybe make use of -moz-transform: scale(sx, sy)
/-webkit-transform: scale(sx, sy)
?Or this Resizing an image in an HTML5 canvas
You can resize-and-copy an image or canvas into another canvas easily.
context.drawImage(image, dx, dy, dw, dh)
allows you to resize any image (or canvas) you want to draw as you draw it.
You can draw a 100x100 image as 50x50 or 200x200.
There is additionally context.drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh)
if you only want to draw a portion of the original image.
You want the drawn images to be resizable and movable? That's a whole 'nother can of worms, such functionality is not built in to canvas in the least, meaning you'll have to make it. I wrote a small tutorial on getting resizable, movable objects in the canvas, which is a good place to start.
这篇关于画布 - 图像调整大小并复制到另一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!