This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
The canvas, like any other element canvas respond to mouse events.
You can save a canvas to an image by calling on the canvas:
For example, to create a png, it would be:
I'm not sure what you have in mind in terms of pixel manipulation but this part of the spec has some information on that.
Joined: Nov 13, 2008
the last link is not operational, when I click this I do not get a new page?Please update ... And ...
I want to do for my degree a program for teaching pupils how to draw graph functions and I need to draw pixel by pixel a graph that is a test/learn part and before that draw by mouse that graph function and then analyze if the original graph is outside the bold mouse drawing and evaluate the pupil.
Pixel by pixel I mean I need to go through x0y0 to xny0 and then x0y1 to xny1 nad then ... x0yn to xnyn and to see if the graph matches and how much,
I also have a question if the canvas is stored in pnggifjpegbmp whatever how can I load the picture into canvas?
thanks for everything, Grega from Slovenia
Joined: Apr 18, 2009
If the first link works, the second should (and both work for me). It's an anchor on the same page. Try going to the first link and searching for "Pixel Manipulation." The second link contains the function calls to get pixel data which you can then manipulate. Though it's slightly different than what you are asking, here is a tutorial that displays a video file in a canvas and manipulates the canvas pixels. It shows how to apply various effects to canvas pixels.
Images can be inserted into canvases. You can even draw a canvas inside another canvas.
There are a couple different signatures for drawing an image as you can draw a subportion of an image or scale it. The most basic flow to draw an image a (0,0) would be