Wicklers / Tee-Designer

A Simple T-shirt Designing Web App to create custom tees.
156 stars 92 forks source link

How To Render Rotation Image with drawImage Function?? #9

Open Anastaufan opened 5 years ago

Anastaufan commented 5 years ago

I have continues this code with jquery.ui.rotatable.js and that work when I rotate image (clip art or text), the problem is how to render image with rotation. I found this code, but it just resize and dragable render method. How To Render Rotation Image with drawImage function like this code :

`

function renderImage(ctx, element, image, bounds, borders) { var paddingLeft = getCSSInt(element, 'paddingLeft'), paddingTop = getCSSInt(element, 'paddingTop'), paddingRight = getCSSInt(element, 'paddingRight'), paddingBottom = getCSSInt(element, 'paddingBottom'); drawImage( ctx, image, 0, //sx posisi x 0, //sy posisi y image.width, //sw image.height, //sh bounds.left + paddingLeft + borders[3].width, //dx bounds.top + paddingTop + borders[0].width, // dy bounds.width - (borders[1].width + borders[3].width + paddingLeft + paddingRight), //dw bounds.height - (borders[0].width + borders[2].width + paddingTop + paddingBottom) //dh ); } `