0
我想在編碼的圖像上畫一條線,這樣我會得到一個新的圖像。如果你願意,你可以給我關於這方面的信息嗎? 非常感謝。 這裏我給我的代碼,我得到了編碼的圖像。如何在bb中的編碼圖像上繪製一條線?
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();
byteArray = 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);
您可能已經考慮過這一點,但請注意Google的靜態地圖API明確禁止在網絡瀏覽器之外顯示靜態地圖,除非您是Google Maps API Premier客戶:http://code.google.com/apis/ maps/documentation/staticmaps /#概述 – 2011-03-24 16:58:30