A metaphor

A metaphor

The effect of drawBitmapMesh can be thought as pinching a point of an

*canvas, and pull it to another point. The*

**elastic***image is very similar to what we shall get through drawBitmapMesh. Like the figures below show.*

**distorted****How the mesh affects the bitmap**

The bitmap to be drawn is divided into equal size blocks. And the division is defined by the mesh, which is a float array. The array defines the lines that divide the bitmap. To have a division of W*H blocks, there needs to be (W+1)*(H+1) lines. These lines intersect at (W+1)*(H+1) points. Every two consecutive elements in the array corresponds to the x coordinate and y coordinate of an intersection. So, the mesh array comprises of 2*(W+1)*(H*1) elements. Given the bitmap's size is known, the drawing engine can find out the x and y coordinates of intersections by dividing the width or height of the image to W or H, respectively. So, if the x and y coordinates of an intersection supplied in the mesh doesn't equal to its intact values, the drawing engine will "pinch and pull" the intersection from its original location to the location we define.

Keep in mind that for a intersection that deviates its original location, only those four blocks that around it will be affected. All other blocks that are more than one blocks away from the intersection will remain intact.

## 5 comments:

Thank you, very helpful

Thank you very much! This helps me a lot :-)

Thank you very much! It is very useful

Thanks, this was confusing me too earlier :)

thank you very much.this post gives me some insight : )

Post a Comment