private Bitmap ZoomImage(String FilePath, int zoomFactor) {
Bitmap pictureDisplayed = null;
try {
// open the file connection to retrieve the picture from the saved
// place
FileConnection fconnForZoom = (FileConnection) Connector
.open("file://" + FilePath);
if (fconnForZoom.exists()) {
InputStream input = fconnForZoom.openInputStream();
int available = (int) fconnForZoom.fileSize();
byte[] data = new byte[available];
input.read(data, 0, available);
EncodedImage ePictureOriginal = EncodedImage
.createEncodedImage(data, 0, data.length);
ePictureOriginal.setScale(20);
if (zoomFactor == 100) {
int scaleFP = Fixed32.tenThouToFP((int) 1 * 10000);
EncodedImage ePictureDisplayed = ePictureOriginal
.scaleImage32(scaleFP, scaleFP);
pictureDisplayed = ePictureDisplayed.getBitmap();
} else if (zoomFactor == 200) {
int scaleFP = Fixed32.tenThouToFP((int) 2 * 10000);
EncodedImage ePictureDisplayed = ePictureOriginal
.scaleImage32(scaleFP, scaleFP);
pictureDisplayed = ePictureDisplayed.getBitmap();
}
// I keep in memory the bitmap to get a smooth picture scrolling
input.close();
} else {
pictureDisplayed = new Bitmap(0, 0);
}
fconnForZoom.close();
} catch (Exception ioe) {
}
return pictureDisplayed;
}
I hope to share my knowledge with the others in software and networking industry
Zooming Bitmap images in blackberry Mobile Development
In our projects we may need zoom in or out images before they display.so this method will do it for you.simple but useful. you must have access to signed api's in blackberry
Subscribe to:
Post Comments (Atom)
Empowering the Future of API Management: Unveiling the Journey of WSO2 API Platform for Kubernetes (APK) Project and the Anticipated Alpha Release
Introduction In the ever-evolving realm of API management, our journey embarked on the APK project eight months ago, and now, with great a...
-
When we increase timeout value in API Manager we have to set 3 properties. 1) Global timeout defined in synapse.properties (\repository\...
-
No matching resource found error or authentication failure can happen due to few reasons. Here we will discuss about errors can happen d...
-
Address and WSDL endpoints can be suspended if they are detected as failed endpoints. When an endpoint is in in suspended state for a speci...
No comments:
Post a Comment