Thanks for all your replies, @ twilsoncom : I also think to your solution, but using the hidden DIV tags to map position of every shape was created. Those DIV shows only when "fill" mode is active. They are transparent to users, but Gypaint can track mouse events to know which is underlying element... I will try :)
@ porneL, Andraž Kos : you are right. SVG is truly an effective support for the graphics on the web, but I feel it difficult to become a web standard such as canvas. Another problem is the selection. Let me explain briefly about how I deal with the selection. When selection mode is turned on, and has a click-and-drag event on the canvas, a rectanglar is drawn. When mouseup, Gypaint will capture the parameters [left, top, width, height] of that rectanglar before removing it from the canvas, then create a second canvas overlaps the original. This second canvas uses parameters [left, top, width, height] of the rectanglar was drawn and erased. Here, supposing the user have a "copy" action, Gypaint will : 1, in the original canvas, using getImageData method of its context to retrieve the portion want to clone. 2, in the second canvas, putImageData method used to create duplicates based on data obtained in step 1. Now, if users move the floating selection to another postision and press Ctrl + V, Gypaint will retrieve data from step one to put on the original canvas at new location. At this point, the paste-down content will overwrite the original content although I have set the value of globalCompositeOperation to "lighter". Why there is overlap, even when two image objects are transparent ? What I can do to the inserted part keep its transparency ? -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
