You Are Here:

Community: Developer Discussion Boards

#1 Old Update an image in a Canvas - 2003-07-24, 11:39

Join Date: Apr 2003
Posts: 184
zivgr
Offline
Regular Contributor
I have one Canavs in my application and I update from time to time an Image on it.
The problem is that sometimes after the update, the last image is gone (which is what I want) and sometimes it remains (or to be more precise its parts that were not covered by the new image).

The cases in which it is gone are not the ones that the old image is smaller than the new one.
Reply With Quote

#2 Old 2003-07-24, 11:54

Join Date: Jul 2003
Posts: 1,094
Location: Finland, Tampere
doctordwarf
Offline
Super Contributor
zivgr
Actually I can't see the reason why old image should go away (if you don't use double buffering).

You painted old image. Then you updated some pixels with a new image. Why the remaining ones should go away? And what means "go away", how system would guess which color you consider being background one?
If you want to erase it, fill whole screen with some background color before painting new image there

Yep, I'm surprized that sometimes after the update, the last image is gone (which is what I want)

Could you post here main parts of your code?
Reply With Quote

#3 Old 2003-07-24, 12:19

Join Date: Apr 2003
Posts: 184
zivgr
Offline
Regular Contributor
I'll try to isolate the relevant parts.
I know that in Canvas nothing is deleted but is painted again and that's why I'm surprised.
Concerning double buffering, I didn't implement it myself but maybe the phone does it automatically?

However, even if there is double buffering, As far as I understood double buffering is aimed to avoid flickering so is it relevant to our issue?
Reply With Quote

#4 Old 2003-07-24, 12:35

Join Date: Jul 2003
Posts: 1,094
Location: Finland, Tampere
doctordwarf
Offline
Super Contributor
zivgr
I know that in Canvas nothing is deleted but is painted again

Not really. I'd rather advise to think about Canvas as about an ordinary Image - just a pack of pixels to set color. You just paint over and over it. Not erasing old image, but putting a new one over.

Once again, how will system guess which color you consider being background one, to which value should it reset "automatically erased" pixels?

Concerning double buffering, I didn't implement it myself but maybe the phone does it automatically?
No, it doesn't

As far as I understood double buffering is aimed to avoid flickering so is it relevant to our issue?
It's times faster to draw something in memory and then just copy the whole picture. Of course if you need to alter just a small part of screen double buffering might not give large effect while eating memory.

so is it relevant to our issue?
If you painted everything in some screen-sized image and then copied it to screen, then everything old on the screen would be replaced.
Reply With Quote

#5 Old 2003-07-24, 14:31

Join Date: Apr 2003
Posts: 184
zivgr
Offline
Regular Contributor
doube buffering -
Isn't the method isDoubleBuffered() answering this question???
Reply With Quote

#6 Old 2003-07-24, 14:41

Join Date: Jul 2003
Posts: 1,094
Location: Finland, Tampere
doctordwarf
Offline
Super Contributor
zivgr
Isn't the method isDoubleBuffered() answering this question???

It is, but not conserning your issue :)

public boolean isDoubleBuffered() - Checks if the Graphics is double buffered by the implementation.

This is a bit different double buffering. As I understand (I can be mistaken, hope you remember it :) ) if this method returns true, then you paint on a COMPLETE COPY of currently displayed screen. Hence, from the your program's point of view it is the same as there was no double buffering.

When I described it earlier, I had in mind that you might create/clear some image in memory for every frame and then copy it to screen.
Reply With Quote

#7 Old 2003-07-24, 14:45

Join Date: Apr 2003
Posts: 184
zivgr
Offline
Regular Contributor
Thanks doctordwarf.
I think I found the problem.
The cases in which the Canvas is "deleted" are after another displayable is set to be current.
In the description of the function it is written that: "The contents of the Canvas are never saved if it is hidden and then is made visible again. "

so I assume this the answer.
Reply With Quote

#8 Old 2003-07-24, 14:47

Join Date: Jul 2003
Posts: 1,094
Location: Finland, Tampere
doctordwarf
Offline
Super Contributor
zivgr
The contents of the Canvas are never saved if it is hidden and then is made visible again

Yep :)
The actual screen is just a single pack of pixels used by different Froms, Canvases, etc.
Reply With Quote

#9 Old 2003-07-25, 10:19

Join Date: Mar 2003
Posts: 31
Location: Denmark
pekkert
Offline
Registered User
try calling serviceRepaints(); after your call to repaint. this makes the exec stop until the repaint has been done. if you dont call the
servicerepaints then you wont know when your repaint will be serviced.
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