BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 09-23-2004, 01:41 PM   #1
will
New Member
 
Join Date: Sep 2004
Posts: 4
Default Drawing text to an image

Please Login to Remove!

Hi All,

There appears to be a bug with creating an image of ODD width and drawing text to that image. For example,

protected void paint(Graphics g)
{
Image img = Image.createImage(101, 100);
Graphics gi = img.getGraphics();
gi.drawString("test", 0, 0, Graphics.TOP | Graphics.LEFT);
g.drawImage(img, 0, 0, Graphics.TOP | Graphics.LEFT);
}

The text in the image appears "skewed". However, if the image is created with an EVEN width(Image.createImage(100,100)) everything is fine. This only happens on color devices(7200 and 7700). Does anyone know a fix for "bug"?


Thanks
Offline  
Old 09-23-2004, 03:29 PM   #2
Mark Rejhon
Retired BBF Moderator
 
Mark Rejhon's Avatar
 
Join Date: Aug 2004
Location: Ottawa, Ontario, Canada
Model: Bold
Carrier: Rogers
Posts: 4,870
Default

Moved to developer forum (merged duplicate posts into one).

That's interesting; this might be worth reporting to RIM although I am 99% sure they know already after all of this time, and I suspect Reqwireless already does this (since it displays the text "Trial" on top of every image). In the meantime, I would imagine a workaround would be to make sure that the width is an even number. Basically, round up to the nearest pixel.

If loading an image of an odd width, you may have to change the size of the image by adding an unused column of pixels or cropping a column, or if that was not possible, then blitting (copying) to a different bitmap of even-numbered width. The fastest/most efficient method will need to be determined.

This might be fixed in certain versions of BlackBerryOS -- what version of BlackBerryOS are you using?
__________________
Thanks,
Mark Rejhon
Author of XMPP extension XEP-0301:
www.xmpp.org/extensions/xep-0301.html - specification
www.realjabber.org - open source
Offline  
Old 09-24-2004, 07:39 AM   #3
will
New Member
 
Join Date: Sep 2004
Posts: 4
Default

Hi Mark,

The BBOS version on the 7210 device is 3.7.0.58, with the 7700 device the OS version is 3.7.1.21. NOTE, these are color devices. On a black and white device(6200), an ODD width image with text is NOT an issue.

My initial thought was to do as you suggestted, always create EVEN width images. But that implies that createImage works half the time.

I posted the same query on RIM developer forums, so far no one can answere it. I will report this bug directly to RIM and see what they have to say.

Thanks
Offline  
Old 09-24-2004, 11:48 AM   #4
jbartel
Knows Where the Search Button Is
 
Join Date: Sep 2004
Posts: 17
Default

Not sure if it will help or not, but you may want to try specifying a different font to see if that solves your problem. With 3.7 they added several new fonts. If you are not specifying a font programatically the Graphics object should be using the default system font which you can set under Options->Screen/Keyboard(so you dont need to change your code to test this). If you can find a font that draws properly you could specify which font the Graphics object should use -- one thing to be careful with specifying the font -- you will want to use one that is available on 3.6 and 3.7 devices so it will work with both.
Offline  
Old 09-24-2004, 12:47 PM   #5
will
New Member
 
Join Date: Sep 2004
Posts: 4
Default

Hi All,

I brought this bug to RIM's attention. They have acknowledged it and hope to fix it in their next release.

Thanks for all your help.
Offline  
Old 09-24-2004, 12:48 PM   #6
will
New Member
 
Join Date: Sep 2004
Posts: 4
Default

Hi All,

I brought this bug to RIM's attention. They have acknowledged it and hope to fix it in their next release.

Thanks for all your help.
Offline  
Old 09-24-2004, 02:34 PM   #7
Mark Rejhon
Retired BBF Moderator
 
Mark Rejhon's Avatar
 
Join Date: Aug 2004
Location: Ottawa, Ontario, Canada
Model: Bold
Carrier: Rogers
Posts: 4,870
Default

Excellent to hear that they were able to reproduce the bug!

Surprising that they hadn't fixed it for so long; maybe it really has not been noticed for so long!
__________________
Thanks,
Mark Rejhon
Author of XMPP extension XEP-0301:
www.xmpp.org/extensions/xep-0301.html - specification
www.realjabber.org - open source
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


high quality Siemens 6SN1123-1AA00-0JA1 Brand New  6SN1 123-1AA00-0JA1 picture

high quality Siemens 6SN1123-1AA00-0JA1 Brand New 6SN1 123-1AA00-0JA1

$4300.00



SIEMENS 6ES7 214-1HG40-0XB0 SIMATIC S7-1200 PLC CPU Unit New in box picture

SIEMENS 6ES7 214-1HG40-0XB0 SIMATIC S7-1200 PLC CPU Unit New in box

$299.00



6SN1123-1AA00-0BA1 1PCS New Siemens 6SN1 123-1AA00-0BA1  Fast shipping picture

6SN1123-1AA00-0BA1 1PCS New Siemens 6SN1 123-1AA00-0BA1 Fast shipping

$406.63



Siemens SINAMICS 6SL3120-2TE13-0AA4 Servo Drive Double Motor Module 3-Phase AC picture

Siemens SINAMICS 6SL3120-2TE13-0AA4 Servo Drive Double Motor Module 3-Phase AC

$345.33



6SN1123-1AB00-0HA1 1PCS Brand NEW Siemens 6SN1123-1AB00-0HA1  Fast ship picture

6SN1123-1AB00-0HA1 1PCS Brand NEW Siemens 6SN1123-1AB00-0HA1 Fast ship

$463.21



New YASKAWA SGDH-08AE AC Servo Drive picture

New YASKAWA SGDH-08AE AC Servo Drive

$256.98







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.