×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    43

    Wrong canvas size on 5800 with 1.9.5 on full_max mode?

    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.

  2. #2
    Nokia Developer Expert
    Join Date
    Apr 2007
    Posts
    131

    Re: Wrong canvas size on 5800 with 1.9.5 on full_max mode?

    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.

  3. #3
    Super Contributor
    Join Date
    Mar 2003
    Location
    Espoo, Finland
    Posts
    976

    Re: Wrong canvas size on 5800 with 1.9.5 on full_max mode?

    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

  4. #4
    Super Contributor
    Join Date
    Nov 2007
    Location
    Sertaozinho/Brazil
    Posts
    768

    Re: Wrong canvas size on 5800 with 1.9.5 on full_max mode?

    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.

  5. #5
    Registered User
    Join Date
    Oct 2008
    Posts
    43

    Re: Wrong canvas size on 5800 with 1.9.5 on full_max mode?

    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.

  6. #6
    Super Contributor
    Join Date
    Nov 2007
    Location
    Sertaozinho/Brazil
    Posts
    768

    Re: Wrong canvas size on 5800 with 1.9.5 on full_max mode?

    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.

  7. #7
    Registered User
    Join Date
    Oct 2008
    Posts
    43

    Re: Wrong canvas size on 5800 with 1.9.5 on full_max mode?

    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?

  8. #8
    Super Contributor
    Join Date
    Nov 2007
    Location
    Sertaozinho/Brazil
    Posts
    768

    Re: Wrong canvas size on 5800 with 1.9.5 on full_max mode?

    Hello

    It seems we are approaching to a conclusion here !

    > 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.

    > 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.

    > 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,

  9. #9
    Registered User
    Join Date
    Oct 2008
    Posts
    43

    Re: Wrong canvas size on 5800 with 1.9.5 on full_max mode?

    Muito obrigado, Marcelo!


    (I hope I said that right :-) )

  10. #10
    Super Contributor
    Join Date
    Nov 2007
    Location
    Sertaozinho/Brazil
    Posts
    768

    Re: Wrong canvas size on 5800 with 1.9.5 on full_max mode?

    Quote Originally Posted by carlosl View Post
    Muito obrigado, Marcelo!


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

    (It is perfect ! )

Similar Threads

  1. Canvas size in 7210
    By Griffel in forum Mobile Java General
    Replies: 3
    Last Post: 2003-04-29, 20:56
  2. microedition.platform and canvas size for Nokia 3510i
    By LiamQ in forum Mobile Java General
    Replies: 1
    Last Post: 2002-10-22, 11:08
  3. 6310i Emulator Canvas Size.
    By fmhunter in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2002-07-23, 10:38
  4. Change the paintable canvas size of the emulator
    By Nokia_Archived in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2002-05-17, 18:07
  5. canvas size
    By topisystems in forum Mobile Java General
    Replies: 2
    Last Post: 2002-05-15, 12:28

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×