07-28-2010 07:59 AM
It was a nice try, but it still doesn't work. Does anyone know the reason for this IllegalArgumentException? (API 4.5.0 net.rim.device.api.ui.Graphics: line 1325)
I guess it's safe to assume their tiff support is broken. This isn't the first time their API has sent me on a wild goose chase.
Either way, thanks for your help.
07-28-2010 09:38 AM
If you don't mind do you think you can post up the TIFF image?
07-28-2010 12:16 PM
I must be blind. I can't see how to post an attachment.
07-28-2010 01:14 PM
RIght side, under "Tags"
07-28-2010 01:15 PM
When posting, to the right of the area you type into, there is an Attachments panel, with a Browse Button, plus Remove/Add Attachment links.
07-28-2010 01:41 PM
For some reason i don't have that option. I posted the tiff on filedropper. Here's the link: http://www.filedropper.com/a_35
07-28-2010 08:18 PM - edited 07-29-2010 04:47 AM
OK, got it, and got your problem.
Then I shrunk the file down, and problem went away.
I suspect a problem in the decoding program, they probably assumed some arbitrary maximum size and barf if it is bigger than that.
I would raise this on Issue Tracker, but I don't think you will have much joy with installed devices. So I would see if you can scale down the image you send to the BlackBerry. Alternatively, I don't think Tiff is too hard, perhaps you can decode it yourself?
07-28-2010 08:42 PM
I believe it is definitely a bug because if you debug into the getBitmap function it actually creates the Bitmap but somewhere it breaks but otherwise it does load and decode.
07-29-2010 07:49 AM
Thanks for the help! For the record, here's a working snippet of code:
protected void paint(Graphics graphics) {
EncodedImage image = EncodedImage.getEncodedImageResource("A.TIF");
int currentWidthFixed32 = Fixed32.toFP(image.getWidth());
int currentHeightFixed32 = Fixed32.toFP(image.getHeight());
int requiredWidthFixed32 = Fixed32.toFP(graphics.getScreenWidth());
int requiredHeightFixed32 = Fixed32.toFP(graphics.getScreenHeight());
int scaleXFixed32 = Fixed32.div(currentWidthFixed32, requiredWidthFixed32);
int scaleYFixed32 = Fixed32.div(currentHeightFixed32, requiredHeightFixed32);
EncodedImage scaledImage = image.scaleImage32(scaleXFixed32, scaleYFixed32);
graphics.drawImage(0, 0, scaledImage.getWidth(), scaledImage.getHeight(), scaledImage, 0, 0, 0);
}
07-29-2010 08:54 AM
Excellent, thanks for the code snippet.
Can you mark this as solved?