You Are Here:

Community: Developer Discussion Boards

#1 Old Wrong canvas size on 5800 with 1.9.5 on full_max mode? - 2009-06-23, 01:40

Join Date: Oct 2008
Posts: 43
carlosl
Offline
Registered User
Hi:


My app uses the whole canvas. I was using large mode and drawing was OK. But when I use full_max mode I'm noticing the lower part of the screen is not being drawn by the app, like if the reported vertical canvas size was smaller than the actual dimensions.


To use the full canvas I'm adding 153 to the vertical size.


I'm assuming somebody already came across this. Can someone confirm 153 is the correct value ?


Thanks.
Reply With Quote

#2 Old Re: Wrong canvas size on 5800 with 1.9.5 on full_max mode? - 2009-06-23, 05:25

Join Date: Apr 2007
Posts: 131
mahesh.sayibabu's Avatar
mahesh.sayibabu
Offline
Regular Contributor
Screen size returned by canvas.size should work as is. You can check out the scribble example, available under extras\Scribble in the PyS60 source package.
Reply With Quote

#3 Old Re: Wrong canvas size on 5800 with 1.9.5 on full_max mode? - 2009-06-23, 08:22

Join Date: Mar 2003
Posts: 937
Location: Espoo, Finland
JOM's Avatar
JOM
Offline
Forum Nokia Champion
I've used full_max in 5800 with 1.9.5 without any problems. Maybe you could write a minimal test application to check, if you have size problems always or only in your app.

If it's your app, then you might have to check if there's something special in your app which might cause this. Maybe your screen update routines are hardcoded to smaller size, maybe you change screen size during execution of application?

Cheers,

--jouni
Reply With Quote

#4 Old Re: Wrong canvas size on 5800 with 1.9.5 on full_max mode? - 2009-06-23, 19:24

Join Date: Nov 2007
Posts: 318
Location: Sertaozinho/Brazil
Send a message via MSN to marcelobarrosalmeida Send a message via Skype™ to marcelobarrosalmeida
marcelobarrosalmeida's Avatar
marcelobarrosalmeida
Offline
Forum Nokia Champion
HI

I having using canvas without problems in XM 5800. However, due to bugs in my applications I was forced to put some debug routine inside resize callback and it was possible to see that canvas was resized one or two times when you the program went from normal to full_max (with different sizes at each call). This way, canvas size will change.


Marcelo Barros
Nokia E71, N800, N95 and XM 5800
http://www.croozeus.com
http://wordmobi.wordpress.com
http://jedizone.wordpress.com
Reply With Quote

#5 Old Re: Wrong canvas size on 5800 with 1.9.5 on full_max mode? - 2009-06-26, 03:54

Join Date: Oct 2008
Posts: 43
carlosl
Offline
Registered User
I'm still having problems.

I wrote a very small program for testing and it's giving me the correct values:


normal 360,487
large 360,579
full 360,579
full_max 360,640


However, in my application I'm getting

normal 360,487
large 360,579
full 360,579
full_max 360,487


I'm using this code

Code:
        appuifw.app.screen='full_max'
        self.o_Canvas = appuifw.Canvas(redraw_callback = self.v_Redraw)

        # Get horizontal and vertical dimensions
        self.t_CanvasSize = (self.o_Canvas.size[0], self.o_Canvas.size[1])

        self.v_Print(str(self.t_CanvasSize[0])+ " " + str(self.t_CanvasSize[1]) + appuifw.app.screen)

The v_Print ouputs a string to screen at a fixed position. Output is buffered, so it's still valid to write to the screen at this point (before creating the Draw object).

Any additional ideas are welcome.
Reply With Quote

#6 Old Re: Wrong canvas size on 5800 with 1.9.5 on full_max mode? - 2009-06-26, 14:59

Join Date: Nov 2007
Posts: 318
Location: Sertaozinho/Brazil
Send a message via MSN to marcelobarrosalmeida Send a message via Skype™ to marcelobarrosalmeida
marcelobarrosalmeida's Avatar
marcelobarrosalmeida
Offline
Forum Nokia Champion
Carlos, what I was trying to tell you is the following: you have two resize events on canvas before reaching full size. And if you use size() before the last event, it is smaller. You need to handle resize callback. Please, take a look in the following program:

Code:
from appuifw import *
import e32
import graphics

cv = None

f = open('e:\\szcanvas.txt','wt')
def resize_canvas(sz):
    global f
    global cv
    f.write('size: %d,%d\r\n'%sz)
    if cv:
        f.write('b) canvas size: %d,%d\r\n'%cv.size)
    f.flush()
    
lock = e32.Ao_lock()

app.menu = [(u"Quit", lambda: lock.signal())]
app.screen = "full_max"
cv = Canvas(resize_callback=resize_canvas)
f.write('a) canvas size: %d,%d\r\n'%cv.size)
app.body = cv

lock.wait()

f.close()
Its output after launching (do not rotate):

Code:
size: 360,487
a) canvas size: 360,487
size: 360,640
b) canvas size: 360,640
Got it ? Original size is 360,487 but after two resize callback, size() will return 360,640.


Marcelo Barros
Nokia E71, N800, N95 and XM 5800
http://www.croozeus.com
http://wordmobi.wordpress.com
http://jedizone.wordpress.com
Reply With Quote

#7 Old Re: Wrong canvas size on 5800 with 1.9.5 on full_max mode? - 2009-06-26, 19:49

Join Date: Oct 2008
Posts: 43
carlosl
Offline
Registered User
Thanks Marcelo. I see your code and understand what you're saying, but I don't see why or when is the resize callback actually called.


Also, you mention the callbacks needs to be called two times, but I see it's only called once (when printing "b) .... "


Another question: Is this behavior actually a bug?


One more thing... In my original code I now tried assigning the Canvas to the application body before (not after) asking for canvas size and the correct dimensions are now returned:

Code:
        # Create full size canvas
        appuifw.app.screen='full_max'
        self.o_Canvas = appuifw.Canvas(redraw_callback = self.v_Redraw)
        appuifw.app.body=self.o_Canvas
        
        # Set horizontal and vertical dimensions
        self.t_CanvasSize = (self.o_Canvas.size[0], self.o_Canvas.size[1])

        self.v_Print(str(self.t_CanvasSize[0])+ " " + str(self.t_CanvasSize[1]) + appuifw.app.screen)

Does the assignment actually call the callback??? Or it's that probably the correct way to do it?
Reply With Quote

#8 Old Re: Wrong canvas size on 5800 with 1.9.5 on full_max mode? - 2009-06-26, 20:25

Join Date: Nov 2007
Posts: 318
Location: Sertaozinho/Brazil
Send a message via MSN to marcelobarrosalmeida Send a message via Skype™ to marcelobarrosalmeida
marcelobarrosalmeida's Avatar
marcelobarrosalmeida
Offline
Forum Nokia Champion
Hello

It seems we are approaching to a conclusion here !

Quote:
> I don't see why or when is the resize callback actually called.
> "Another question: Is this behavior actually a bug?
It is a callback, O.S. decides when a resize is necessary and just notifies your program about this. So, your code need to be prepared to it (for instance, when rotation takes place). It seems that we have a resize after creating a canvas and another one when assigning it to app.body. Ok, not documented, but it does not seems a bug.

Quote:
> but I see it's only called once (when printing "b)
It is called twice, but first time cv is None. You can see two "size:" (no letter before).
Strange, I know. But I need to check the buffer in resize events. All coded I did it was necessary.

Quote:
> assigning the Canvas to the application body before (not after) asking for canvas size and the correct dimensions are now returned:
Yes, I was just thinking about this. It seems the better way to get the correct dimension.

Since I want to handle screen rotations, I decided to receive resize callbacks and I allocated a large screen buffer, like:

Code:
sz = max(sysinfo.display_pixels())
self.scr_buf = graphics.Image.new((sz,sz))
This way I will have always a screen that fits into the buffer, avoiding any additional operation. And at redraw callback, I just put a call to blit and save new size.

Code:
self.canvas.blit(self.scr_buf)
See you,


Marcelo Barros
Nokia E71, N800, N95 and XM 5800
http://www.croozeus.com
http://wordmobi.wordpress.com
http://jedizone.wordpress.com
Reply With Quote

#9 Old Re: Wrong canvas size on 5800 with 1.9.5 on full_max mode? - 2009-06-29, 22:07

Join Date: Oct 2008
Posts: 43
carlosl
Offline
Registered User
Muito obrigado, Marcelo!


(I hope I said that right :-) )
Reply With Quote

#10 Old Re: Wrong canvas size on 5800 with 1.9.5 on full_max mode? - 2009-06-30, 02:41

Join Date: Nov 2007
Posts: 318
Location: Sertaozinho/Brazil
Send a message via MSN to marcelobarrosalmeida Send a message via Skype™ to marcelobarrosalmeida
marcelobarrosalmeida's Avatar
marcelobarrosalmeida
Offline
Forum Nokia Champion
Quote:
Originally Posted by carlosl View Post
Muito obrigado, Marcelo!


(I hope I said that right :-) )
De nada !

(It is perfect ! )


Marcelo Barros
Nokia E71, N800, N95 and XM 5800
http://www.croozeus.com
http://wordmobi.wordpress.com
http://jedizone.wordpress.com
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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 Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Canvas size in 7210 Griffel Mobile Java General 3 2003-04-29 21:56
microedition.platform and canvas size for Nokia 3510i LiamQ Mobile Java General 1 2002-10-22 12:08
6310i Emulator Canvas Size. fmhunter Mobile Java Tools & SDKs 1 2002-07-23 11:38
Change the paintable canvas size of the emulator Nokia_Archived Mobile Java Tools & SDKs 1 2002-05-17 19:07
canvas size topisystems Mobile Java General 2 2002-05-15 13:28

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