View Single Post
Old 09-18-2007, 04:19 AM   #1 (permalink)
Thumbs Must Hurt
Join Date: Jun 2007
Model: 8800
Carrier: GPRS
Posts: 68
Post Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation zoom in the text on the image

Please Login to Remove!


I'm research on how to zoom in the texts or lines which drawing on the image, and I want to know how to implement it .
public void OpenFile()
        try {
            FileConnection fconn = (FileConnection)"file:///SDCard/BlackBerry/pictures/ddd78e99bb07e70d6e068c9b.jpg");
            // If no exception is thrown, then the URI is valid, but the file may or may not exist.
            if (fconn.exists()) 
                InputStream input = fconn.openInputStream();
                int available = (int)fconn.fileSize();
                byte[] data = new byte[available];
      , 0, available);
                EncodedImage image = EncodedImage.createEncodedImage(data,0,data.length);
                image.setScale(2); //zoom out the image to 50%    
                Bitmap b = image.getBitmap();  
                Graphics myGraphics = new Graphics(b);//draw a text! 
                myGraphics.drawText("myText", 20, 5); 
                BitmapField picture = new BitmapField(b);    
                //show the picture
                System.out.println("Picture does not exist");
        catch (Exception ioe) 
As well know to all , we can zoom in or out the image by image.setScale(). I draw a text on the Bitmap got by the image.getBitmap() , but the when the image is zoomed in or out , the text is not changed , so how could I implement this?
In my opinion, I should change the bitmap b into EncodedImage after I draw the text on it. So I can call the method setScale() to zoom in or out the text with the origin image. But how can I change the bitmap b into EncodedImage?
Does anyone have any suggestions?
Thank you very much!!
Offline   Reply With Quote