BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 12-18-2007, 11:06 AM   #1 (permalink)
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default graphics.draw on transparent imagepart

Please Login to Remove!

i have an icon of 64x64 size, only the horizontal middle is visible, the rest is transparent.

i'd like to draw a number on the transparent part, as to appear under the icon.

Code:
Bitmap b = Bitmap.getBitmapResource("icon.png");
Graphics g = new Graphics(b);
g.drawText("10", 40, 30);
unfortunately the text is cut off on the lower end of the nontransparent area.

i tried g.setGlobalAlpha(255); with no effect.

any idea how to draw on the transparent part?
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 12-19-2007, 08:01 AM   #2 (permalink)
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

it seems that drawing on a transparent image is not possible.
i draw my partly transparent image on a white one, add the text and replace all white with transparency. not pretty but it works.
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 12-19-2007, 09:35 AM   #3 (permalink)
vph
Knows Where the Search Button Is
 
Join Date: Dec 2007
Model: 8700
PIN: N/A
Carrier: Cingular
Posts: 35
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have not tried your case which you use the graphics object of the bitmap to draw the text, but I could draw text on the transparent picture by loading the BitmapField onto the screen then loading the RichTextField onto the screen and above the BitmapField.


Bitmap bm = new Bitmap(268, 196);
BitmapField bmf = new BitmapField(bm);
m.add(bmf, 0, 0, 268, 196);
Graphics g = new Graphics(bm);
Utility.drawImage(g, "about2.gif", 0, 0, 268, 196);

RichTextField f = new RichTextField();
// application name
f.setText(CohFsConstants.aboutApplication);
m.add(f, 7, 20, 300, 16);
// version

f = new RichTextField();
f.setText(CohFsConstants.aboutVersion);
m.add(f, 7, 50, 300, 16);
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

LIA3420, This IC is found on Commodore Amiga 2000 board And is a Buster Chip
$11.0
LIA3420, This IC is found on Commodore Amiga 2000 board And is a Buster Chip  pictureMOS MPS 6520 Commodore Amiga Atari PIA 40-Pin PDIP Used
$10.0
MOS MPS 6520 Commodore Amiga Atari PIA 40-Pin PDIP Used  pictureGenuine Noches Latinas UR3 Amiga Parala La Palma Vagina Mastrubator + Cream Gift
$29.99
Genuine Noches Latinas UR3 Amiga Parala La Palma Vagina Mastrubator + Cream Gift pictureGenuine Noches Latinas UR3 Amiga Para La Palma Culo Mastrubator + Cream Gift
$29.99
Genuine Noches Latinas UR3 Amiga Para La Palma Culo Mastrubator + Cream Gift pictureCSG/AMIGA 391077-01 PLCC
$14.2
CSG/AMIGA 391077-01 PLCC picture






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