You Are Here:

Community: Developer Discussion Boards

#1 Old Question HELP: Mutable Image to Immutable Image? - 2005-03-24, 11:22

Join Date: Dec 2004
Posts: 25
Location: quezon city philippines
rj_cybersilver
Offline
Registered User
Im trying to create an immutable image from a mutable one.
But I've encountered problems. The image that is displayed
is either white or black. HEre is a copy of my code which
attempts to create an immutable image from a mutable one.

public Image addTextToImage(Image src, String text){
// The string text is the text to be drawn to the image

int w = src.getWidth(); // width of the copy image
int h = src.getHeight();// height of the copy image

// the folowing code creates a mutable image form an immutable image (src)
// this snipet i got from the MIDP API

Image copy = Image.createImage(w,h);
Graphics g = copy.getGraphics();
g.drawImage(src,0,0,Graphics.TOP | Graphics.LEFT);


g.drawString(text, 40, 80,...);

// i try to get the pixel data of the mutable image that was drawn
// earlier using drawRGB
// as i read in the API, pixel data is stored to the int[] parameter of
// drawRGB

g.drawRGB(pixels,...);

// I use pixels to re-create an immutable version of the
//mutable image
// hoping that the string i drew to the Image is also copied

Image imgWithString = Image.createRGBImage(pixels,w,h, true);
// please take notice of the last parameter of the
// createRGBImage method
// when true, the Image that is returned is all white
// when false, the image is all black

return imgWithString;

}// end of addTextToImage method

can someone help me with this? Thanks in advance
Reply With Quote

#2 Old I think i figured out how... - 2005-03-26, 10:58

Join Date: Dec 2004
Posts: 25
Location: quezon city philippines
rj_cybersilver
Offline
Registered User
I was able to figure out how to create Immutable images from mutable ones..so sorry for the bother..but has anybody had difficulty with anything involving getRGB and running them on the Series 60 MIDP Concept emulator? I have..

The emulator either hangs OR
throws an alert: "Bad Field Signature".

My program runs just fine on the "DefaultColorPhone" emulator available with java wireless toolkit 2.2. Can someone explain why?
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d18645X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZentertainmentQ qfnZtopicQUqfnTopicZj2meQ qfnZtopicQUqfnTopicZjavaQ qfnZtopicQUqfnTopicZmediaQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ