關(guān)于第一種思路的縮小時的問題
sx = ( imageWidth - canvas.width ) / 2
sy = ( imageHeight - canvas.height ) / 2
context.drawImage( sx, sy, canvas.width, canvas.height, 0, 0, canvas.width, canvas.height )
此方法在圖像縮小時會出現(xiàn)位置偏移
關(guān)于這個問題,老師的說法是sw和sh應(yīng)該比canvas.width和canvas.height小,請問為什么要???當(dāng)直接采用上述代碼時,圖像向左上角偏移了,并且顯示的尺寸小于0.5,這是怎么回事呢?
2015-12-07
不小就過外擴出去
2015-12-06
1、第一個參數(shù)你都沒給。img參數(shù)呢。
2、回答你問題的人大多都沒看過視頻。你只給一部分代碼,我們是看不懂的。