| Reply | « Previous Thread | Next Thread » |
|
Hello everyone!
I have done this school project for Visual User Interface class. It is pretty cool but I do not like that the way I have done the animation everything is blinking and it does not look good. I wonder if there is anyway to remove this flicker by using backbuffer or similar thing so it can be drawn before displaying. If anyone can give me a hint that will be great. I use blit() function of the canvas class. Is there a better way? I have uploaded everything you need to run it in emulator. Put the "shoes.rar" in a directory /shoes of your python directory. http://www.box.net/shared/zy7gb39c0c and thses are the two modules: http://www.box.net/shared/ssyldn9yck http://www.box.net/shared/iphqu3sdcc Here is a small snippet from the code: Code:
def Draw(self,key,level,moveInDirection=None,frame=None):
"""Drawing of the current item and its neigbour if possible."""
global targetRecHandler
if (level > 0):
if(moveInDirection == None): #check if we are in the process of animation
target = targetRecHandler.GetMeRectangle(zoomLvl=itemHandler.currentZoomLevel,key=key) #gets the rectangle needed
if(target is not None): #check if we actually have an rectangle
canvas.blit(self.picture, #takes current picture
target=target,scale = 1)#draws current item
else:
if ((moveInDirection != "+") & (moveInDirection != "-")):
animKey = key + str(itemHandler.currentZoomLevel-1) + "->" + key + moveInDirection + str(itemHandler.currentZoomLevel-1) #creates the animation key
animKey = animKey.replace("ns","") #fixing some string problems with animation
animKey = animKey.replace("sn","")
animKey = animKey.replace("ew","")
animKey = animKey.replace("we","")
elif moveInDirection == "+":
animKey = key + str(itemHandler.currentZoomLevel-1) + "->" + key + str(itemHandler.currentZoomLevel-2)
else:
animKey = key + str(itemHandler.currentZoomLevel-1) + "->" + key + str(itemHandler.currentZoomLevel)
target = targetRecHandler.GetMeRectangle(key=animKey,frame=frame) #gets the rectangle needed
if(target is not None): #check if we actually have an rectangle
canvas.blit(self.picture,target=target,scale = 1)#draws current item
self.__DrawNeighbours(key,level,moveInDirection,frame)
|
|
Hi Zamoth_bg,
Did try your application, is really cool one. Now about that blinking part is because image is being redrawn continuously.I think if you want the GUI types of maybe Apple's OS X then you need to use some graphics libraries. The experts maybe will be able to elaborate more, i am really newbie in this GUI part. IDEAS is all they need but still they think only Genius can give them that. |
| shubhendra |
| View Public Profile |
| Find all posts by shubhendra |
|
Thank you for the nice words. No I am saying if I can work on the same platform, same language if I can connect it to graphical API. Something to hack the code so it can dispaly stuff better.
|
|
Use double buffering, never ever draw directly on the canvas. In worst cases you can use also triple buffering.
Cheers, --jouni sorry for being busy |
|
I know but, how? Point me to what I need to use and a possible solution.
|
|
Quote:
![]() Just updated Rol-a-Bol to version 1.4, wanted to experiment with triple buffering ![]() http://jouni.miettunen.googlepages.com/rol-a-bol Double Buffering:
That's good enough for simple cases, no problems. In more demanding cases you have to optimize:
Cheers, --jouni |
|
There is no real support of back buffer? I just create empty image and "draw" on it. Then just blip the image? Ok.
|
|
Quote:
It's just as easy as you said: create your own empty image, draw everything on it and blit on top of canvas. Enjoy, --jouni |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Canvas Drawing | g_haddrell | Mobile Java Media (Graphics & Sounds) | 1 | 2008-02-04 14:22 |
| Canvas keyPressed() not invoked when pressing too fast | vichoty | Mobile Java General | 0 | 2005-12-18 09:42 |
| Drawing on canvas close to edge is clipping | james_levander | Mobile Java Media (Graphics & Sounds) | 1 | 2004-02-03 22:53 |
| Major problem with delegation to Canvas | bartekn | Mobile Java Media (Graphics & Sounds) | 8 | 2003-10-08 18:46 |
| 7650 and 3650 Canvas and FullCanvas memory | marcilgen | Mobile Java General | 5 | 2003-07-08 13:24 |