how to draw a line on an encoded image in bb?
I want to draw a line on the encoded image so I will get a new image. Can you please give me information about that if you want ? Thank you very much. Here I give my code that I got the encoded image.
String URL = "http://maps.google.com/maps/api/staticmap?center="
+ centerX + "," + centerY + "&zoom=15&size=480x320&"
+ "path=color:0x0000ff|weight:5" + path
+ "&maptype=roadmap&sensor=true;deviceside=true";
try {
conn = (HttpConnection) Connector.open(URL);
stream = conn.openInputStream();
byteArr开发者_运维技巧ay = new ByteArrayOutputStream();
int dataToWrite = 0;
while ((dataToWrite = stream.read()) != -1) {
byteArray.write(dataToWrite);
}
byte[] bArray = byteArray.toByteArray();
EncodedImage image =
EncodedImage.createEncodedImage(bArray, 0, bArray.length);
imageBitmap = image.getBitmap();
vfm.deleteAll();
bitField = new BitmapField(imageBitmap);
vfm.add(bitField);
create a
Graphics
objectGraphics graphics = new Graphics(imageBitmap);
Invoke
Graphics.drawLine()
to draw line on that bitmap.graphics.drawLine(x1,y1,x2,y2);
Now imageBitmap is a new bitmap with line.
精彩评论