我试图从 Codrops添加背景裁剪画布区域
这是非常好的一个带有调整大小和种植脚本工作然而如果图像没有填满种植面积脚本失败,所有的图像圈黑色。
我的想法是先创建一个实体图像,然后在上面应用裁剪后的图像。但我很挣扎。
我猜的地方在这里:
var crop_canvas,
left = $('.size_guide').offset().left - $container.offset().left,
top = $('.size_guide').offset().top - $container.offset().top,
width = $('.size_guide').width(),
height = $('.size_guide').height();
crop_canvas = document.createElement('canvas');
crop_canvas.width = width;
crop_canvas.height = height;
crop_canvas.getContext('2d').drawImage(image_target, left, top, width, height, 0, 0, width, height);
任何想法上怎样去这或尝试不同的解决方案吗? 非常感谢
你是明星,非常感谢你。 – Kris 2014-12-02 10:34:52