在改造具体坐标位图或ImageView的 [英] Transform Bitmap or ImageView at specific coordinates
问题描述
我试图通过拖动点,具体坐标例这种转变位图和ImageView的正在起草的应用程序。这是使它的最好方法?我应该使用OpenGL?谢谢
I am trying to transform bitmap and imageview by dragging points to specific coordinates Example this is drawing app. Which is the best way to make it ? Should i use OpenGL ? Thank You
编辑:我用canvas.drawBitmapMesh固定感谢大家的帮助,我真的AP preciate它
I fixed by using canvas.drawBitmapMesh thank you all for your help i really appreciate it .
推荐答案
您可以尝试创建第二可变位像这样
You can try creating second mutable bitmap like this
Bitmap originalBitmap;
Bitmap b = Bitmap.createBitmap(originalBitmap.getWidth(), originalBitmap.getHeight(), Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(b)
然后你可以借鉴的新位图转换申请前原有的位图。请参见帆布 API的更多细节。
例如使用下面的方法:
c.drawBitmap(Bitmap bitmap, Matrix matrix, Paint paint)
更新
关于使用矩阵,它只是一个猜测,你可以尝试的方法mapPoints(浮动[] SRC,浮动[] DEST)。我还做了谷歌快速搜索,发现网页面举例。一看。
Regarding use of Matrix, it's just a guess, you can try method mapPoints(float[] src, float[] dest). I also did a quick search on Google and found web page with examples. Have a look.
更新2
Dardan才实现他与下面的方法目标:
Dardan was able to achieve his goal with the following method:
drawBitmapMesh(Bitmap bitmap, int meshWidth, int meshHeight, float[] verts, int vertOffset, int[] colors, int colorOffset, Paint paint);
方法说明:
通过网格,网格的地方顶点均匀地绘制位图
跨位分布。跨有meshWidth + 1个顶点,
和meshHeight + 1个顶点了。在绿党数组访问中
行优先顺序,使得第一meshWidth + 1顶点
跨越位图的顶部分布从左到右。更
这种方法的一般版本是drawVertices()。
Draw the bitmap through the mesh, where mesh vertices are evenly distributed across the bitmap. There are meshWidth+1 vertices across, and meshHeight+1 vertices down. The verts array is accessed in row-major order, so that the first meshWidth+1 vertices are distributed across the top of the bitmap from left to right. A more general version of this method is drawVertices().
这篇关于在改造具体坐标位图或ImageView的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!