These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:13 pm Advanced search

Draw multiple circles filled with image content

If you are stuck or have questions regarding HTML or other Web technologies, ask your questions here. No question too dumb!

Draw multiple circles filled with image content

Postby JorjPacha » Tue Apr 12, 2011 11:33 am

Hi there,

I am trying to draw circles on a canvas filled with portions from an image. Imagine clicking on a white canvas and where the user clicked reveal a portion of a photo.

I have found ways to draw 1 circle, but can not succeed using this to draw multiples. If I repeat the action with other coordinates the drawing is not happening.

Code: Select all
function start_drawing(){
ctx.beginPath();
ctx.fillStyle = "rgb(255,255,255)";
ctx.fillRect(0,0,canvas.width,canvas.height);//fill the background. color is default black
ctx.arc(mouse.x,mouse.y,45,0,6.28,false);//draw the circle
ctx.arc(mouse.x+100,mouse.y+100,45,0,6.28,false);
ctx.clip();//call the clip method so the next render is clipped in last path
ctx.drawImage(img,0,0);
ctx.closePath();
}


Any idea on how this can be achieved ?
Thank you.
JorjPacha
<h6>
 
Posts: 1
Joined: Tue Apr 12, 2011 11:32 am

Re: Draw multiple circles filled with image content

Postby zcorpan » Tue Apr 12, 2011 10:55 pm

Hi, welcome to the forums. I don't follow what you're trying to do exactly. Could you post a complete example, maybe a URL?
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden


Return to Help & Advice

Who is online

Users browsing this forum: No registered users and 1 guest