Re: [android-developers] Re: how to create irregular polygon and handle events within its boundary
Vectoring parts of a photographic image is going to be more difficult than the example I lnked. I think you'l have to zoom the vertices in the polygon yourself, but you might try using some drawing transformation methods - you may have to dig deeper into OpenGL. Now that you've given more problem details, maybe polygons isn't the only approach. Are you trying to map the touch coordinates to a certain shade in the man's arm, or to a particlar part of the arm? In the latter case, it might work out to just use points for the center of each part (bicep, tricep, elbow, etc.) and use an algorithm based on the distances of the centers to the touch point. This may involve additional geometry skills, such as dividing an area into regions based on such centroids. However, sometimes looking at a problem from a different perwspective leads to a better solution. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: how to create irregular polygon and handle events within its boundary
I suppose it seemed simple for me since I'm done it with AWT before. Basically, you build up a Polygon object with vertices. You pass it to the Graphics.draw method to display it (or not if you want an invisible hit test layer over the image). You intercept click or touch events and use the Polygon's inside() or contains() method to do the hit test. Depending on the complexity and display size of the image, you may run into some hit test accuracy issues due to the touch UI. If you have the original artwork in Adobe Illustrator, you ought to be able to get a vertex list therefrom. If not, google for a raster-to-vector tool of your choice, for example: http://freegeographytools.com/2007/converting-raster-area-images-into-polygon-shapefiles -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en