B
B
byms2016-02-02 11:36:47
JavaScript
byms, 2016-02-02 11:36:47

How to wrap a png image around its canvas edges?

pic  = new Image();
    pic.src  = image;
    reset(pic.width, pic.height);

    ctx.drawImage(pic, 0, 0);
    ctx.globalCompositeOperation = "destination-atop";
    ctx.fillStyle="blue";
    ctx.fillRect(0,0,1200,1200);

Result
69b0a387e1c3458f8ec18516d5ea9448.png
How can I make the photo of the cover rounded along its contour so that there is no blue at the edges?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan, 2016-02-04
@zeroplay

Set the css property of the canvas layer to border-radius: X% or use a quadratic bezier curve - the method for drawing such a curve is built in called quadraticCurveTo.
fillRect is not an option, simply because it doesn't round.
Isn't just painting the inside an option?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question