Current location: Hot Scripts Forums » General Web Coding » HTML5 » Draw multiple circles filled with image content


Draw multiple circles filled with image content

Reply
  #1 (permalink)  
Old 04-12-11, 06:23 AM
JorjPacha JorjPacha is offline
New Member
 
Join Date: Apr 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Draw multiple circles filled with image content

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.

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.

Last edited by JorjPacha; 04-12-11 at 06:31 AM.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Make a div follow page scroll - the continued k-knudsen JavaScript 7 07-25-09 03:38 AM
div css theighost CSS 11 09-14-08 02:30 AM
TreeView Control - Background Image? tim8w Windows .NET Programming 1 04-11-07 12:43 PM
Error On Registeration timmy408 ASP 2 09-05-04 02:53 PM


All times are GMT -5. The time now is 09:31 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.