gira una imagen de mapa de bits en cualquier grado en blackberry
Frecuentes
Visto 392 veces
1
I am kind of new to Blackberry. I have an Image that I need to rotate to certain degree depending on input from user.. I have tried searching but cant seem to find anything on it. Can any one point me to right direction?
3 Respuestas
1
Sigue estos pasos:
Descargue nuestro Código Postal file from this link: BitmapRotate at down side.
Extract and take the ImageManipulator.java from that add to your project;
and use this code from this link: RotatingBitmap on Blackberry
I think this helps you;
or
take the below BitmapRotate.zip code to for rotate an image from this link:
Respondido el 20 de junio de 20 a las 10:06
1
Hay una J2ME Army Knife library, revisalo.
It does contain rotate functionality too.
Respondido 25 ago 12, 12:08
También puede comprobar este enlace if there are troubles porting some of that J2ME army knife code to be usable with the classes in RIM's libraries (e.g. Bitmap
) - Nate
1
This is a part of KB article in Blackberry .. Pass your bitmap & Angle to this function to get rotated bitmap.
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;
}
Respondido 27 ago 12, 21:08
What problem you are facing... ? - Shashank Agarval
rotate function how to send <Angle> valuse Bitmap rotated = rotateSquareImage(oldBitmapSquared, <Angle>); and how to use rotateSquareImage function i modify public static Bitmap rotate(Bitmap oldImage, int ang) and pass Bitmap rotated = rotateSquareImage(oldBitmapSquared, ang); but png bitmap not rotat - Hiresh Bansodkar
in place of <Angle> use 90 , & first simply check Are you able to rotate image to 90 or not. Simply use rotate(<Your bitmap object>)> This function will imlicitly call RotateSquare Function to 90. - Shashank Agarval
i check it rotate 90 degree but i want to rotate all angle game run time - Hiresh Bansodkar
Cant you pass a integer variable in place of 90 , & change this int value according to ur business logic. It must rotate to that angle. - Shashank Agarval
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas blackberry bitmap or haz tu propia pregunta.
i use this code but remove transparency please send me another example - Hiresh Bansodkar
Check the update one; Take the zip code and run it; and then let me know. - alishaik786
To get the file from this link: box.com/files#/files/0/f/0/1/f_2980271171 You should have a member in this link; First signUp and then try; - alishaik786
your file is delete form your server send me hiresh.scs@gmail.com - Hiresh Bansodkar