我对黑莓来说是个新手。我有一个图像,我需要旋转到一定程度上取决于来自用户的输入..我试过搜索,但似乎无法找到任何东西。任何一个人都可以指向正确的方向吗?在黑莓中以任意角度旋转位图图像
回答
按照下列步骤操作:在一面BitmapRotate:
从这个链接下载的ZIP 文件。
提取并取ImageManipulator.java从添加到您的项目;
,并使用此代码从这个链接:RotatingBitmap on Blackberry
,我认为这可以帮助你;
或
采取以下BitmapRotate.zip代码为旋转图像从这个链接:
有一个J2ME Army Knife library,检查它。
它也包含旋转功能。
您还可以检查[此链接](HTTP://supportforums.blackberry。 com/t5/Java-Development/how-to-rotate-Image-or-Graphic/mp/232750/highlight/true#M36233)如果有麻烦移植一些J2ME军刀代码可用于RIM的类库(例如'Bitmap') – Nate
这是黑莓知识库文章的一部分.. 传递你的位图&角度到这个函数得到旋转位图。
public static Bitmap rotate(Bitmap oldImage) throws Exception
{
int w = oldImage.getWidth();
int h = oldImage.getHeight();
int d = Math.max(w, h);
int amountPxAdded = 0;
if (w > h) {
amountPxAdded = w - h;
}
Bitmap oldBitmapSquared = new Bitmap(d, d);
int[] data = new int[w * h];
oldImage.getARGB(data, 0, w, 0, 0, w, h);
oldBitmapSquared.setARGB(data, 0, w, 0, 0, w, h);
Bitmap finalRes = new Bitmap(h, w);
int fW = finalRes.getWidth();
int fH = finalRes.getHeight();
oldImage = null;
Bitmap rotated = rotateSquareImage(oldBitmapSquared, <Angle>);
oldBitmapSquared = null;
data = new int[fW * fH];
rotated.getARGB(data, 0, fW, amountPxAdded, 0, fW, fH);
rotated = null;
finalRes.setARGB(data, 0, fW, 0, 0, fW, fH);
return finalRes;
}
private static Bitmap rotateSquareImage(Bitmap oldB, int angle) throws Exception {
int w = oldB.getWidth();
int h = oldB.getHeight();
Bitmap newB = new Bitmap(w, h);
int[] oldD = new int[w * h];
int[] newD = new int[w * h];
oldB.getARGB(oldD, 0, w, 0, 0, w, h);
int[][] old2d = new int[h][w];
int[] js;
int old2dLen = old2d.length;
int jsLen;
for (int i = 0; i < old2dLen; i++) {
js = old2d[i];
jsLen = js.length;
for (int j = 0; j < jsLen; j++) {
js[j] = oldD[i * w + j];
}
}
int[][] rotated = new int[h][w];
for (int i = 0; i < h; ++i) {
for (int j = 0; j < w; ++j) {
rotated[i][j] = old2d[h - j - 1][i];
}
}
old2d = null;
for (int i = 0; i < h; ++i) {
for (int j = 0; j < w; ++j) {
newD[i * w + j] = rotated[i][j];
}
}
rotated = null;
newB.setARGB(newD, 0, w, 0, 0, w, h);
return newB;
}
它不起作用 –
你面临什么问题......? –
旋转功能如何发送
- 1. EasyBMP以任意角度旋转图像
- 2. 黑莓位图的旋转
- 3. 转换位图图像到黑莓J2ME
- 4. IOS中的多角度图像旋转
- 5. 如何在matlab中以任意角度旋转边界框?
- 6. 如何在Android中以任意角度旋转相机屏幕?
- 7. 图像在角落旋转
- 8. 黑莓 - 居中位图
- 9. Android ||位图图像旋转
- 10. 旋转位图图像
- 11. 你如何旋转一个位图的任意度数?
- 12. 黑莓:WebBitmapField中心图像
- 13. 在饼图中计算旋转角度
- 14. 在黑莓的上方位图字段中加载gif图像
- 15. 旋转图像重叠角
- 16. UIGraphicsGetImageFromCurrentImageContext随意旋转图像?
- 17. 在图像中旋转三角形 - MATLAB
- 18. 旋转图像,并显示旋转角度
- 19. Opencv - 将图像转换为python中的任意位深度
- 20. 算法以任意方式旋转任意梯度90度
- 21. 如何旋转从相机意图接收的位图图像
- 22. 在Android中旋转位图程度
- 23. 在黑莓中显示位图字段
- 24. C#旋转位图90度
- 25. 是黑莓地图定位
- 26. 使用UIRotationGestureRecognizer以固定角度(任意方向)旋转UIView?
- 27. 以平稳的速度旋转图像
- 28. 以15度的增量旋转图像?
- 29. 印度的黑莓地图
- 30. 如何在JavaScript中旋转关于任意点的图像
我使用此代码,但删除透明度,请给我另一个例子 –
检查更新之一;取邮政编码并运行;然后让我知道。 – alishaik786
请给我链接更新zip文件 –