Hi everybody, Iâm currently creating a small app to display images and move them on a screen using Athens. I have all my image loaded on start and I use a loop to clear the screen and redraw all the elements (on different place and angle) every frames. The problem is that with morph, everything is fine, but as soon as I place a picture on a morph the FPS drop down. Even if the picture is a small one. Does anybody have faced the same issue ? Or is there any better way to do it ? Thanks Chris
2015-05-19 10:46 GMT+02:00 Christopher Coat <christopher.coat@inria.fr>:
Hi everybody,
Hi,
Iâm currently creating a small app to display images and move them on a screen using Athens. I have all my image loaded on start and I use a loop to clear the screen and redraw all the elements (on different place and angle) every frames.
The problem is that with morph, everything is fine, but as soon as I place a picture on a morph the FPS drop down. Even if the picture is a small one.
How do you draw the picture? Is it an ImageMorph or do you use directly Athens for drawing the image? nicolai
Does anybody have faced the same issue ? Or is there any better way to do it ?
Thanks Chris
Iâm still a beginner at Pharo and all so maybe Iâll say something wrong. One thing I didnât say is that I use osWindow. I load an image as a Form and display it using that code : "surface drawDuring:[:canvas | canvas pathTransform translateBy: myImage position. canvas pathTransform rotateByDegrees: anAngle. canvas setPaint: myImage image. canvas drawShape: ((size x) negated @ (size y) negated corner: size). ]. « myImage image. return the Form.
Le 19 mai 2015 à 11:41, Nicolai Hess <nicolaihess@web.de> a écrit :
2015-05-19 10:46 GMT+02:00 Christopher Coat <christopher.coat@inria.fr <mailto:christopher.coat@inria.fr>>: Hi everybody,
Hi,
Iâm currently creating a small app to display images and move them on a screen using Athens. I have all my image loaded on start and I use a loop to clear the screen and redraw all the elements (on different place and angle) every frames.
The problem is that with morph, everything is fine, but as soon as I place a picture on a morph the FPS drop down. Even if the picture is a small one.
How do you draw the picture? Is it an ImageMorph or do you use directly Athens for drawing the image?
nicolai
Does anybody have faced the same issue ? Or is there any better way to do it ?
Thanks Chris
2015-05-19 13:09 GMT+02:00 Christopher Coat <christopher.coat@inria.fr>:
Iâm still a beginner at Pharo and all so maybe Iâll say something wrong.
One thing I didnât say is that I use osWindow. I load an image as a Form and display it using that code :
"surface drawDuring:[:canvas | canvas pathTransform translateBy: myImage position. canvas pathTransform rotateByDegrees: anAngle. canvas setPaint: myImage image. canvas drawShape: ((size x) negated @ (size y) negated corner: size). ]. «
myImage image. return the Form.
Ok, in your drawing loop Athens will convert the form to an AthensPaint by copying the image data - on every draw call. You can - create the paint once outside of the drawDuring method. paint := surface createFormPaint: myImage image .... "in drawDuring" canvas setPaint:paint .... (You will have to take care of the paint object, because it is only valid in this vm session). - use an ImageMorph. ImageMorphs can be drawn directly as an AthensShape morph := form asMorph .... canvas drawShape:morph But I don't know if using a Morph fits well with all kind of transformations. It may happen that the morph is clipped away - I dont know for sure. You can create the morph outside of the drawing loop, but even canvas drawShape: myImage image asMorph is faster than creating directly the paint from the Form in the loop. (ImageMorphs are creating AthensPaints from its forms and they are using a cache for all paints). nicolai
Le 19 mai 2015 à 11:41, Nicolai Hess <nicolaihess@web.de> a écrit :
2015-05-19 10:46 GMT+02:00 Christopher Coat <christopher.coat@inria.fr>:
Hi everybody,
Hi,
Iâm currently creating a small app to display images and move them on a screen using Athens. I have all my image loaded on start and I use a loop to clear the screen and redraw all the elements (on different place and angle) every frames.
The problem is that with morph, everything is fine, but as soon as I place a picture on a morph the FPS drop down. Even if the picture is a small one.
How do you draw the picture? Is it an ImageMorph or do you use directly Athens for drawing the image?
nicolai
Does anybody have faced the same issue ? Or is there any better way to do it ?
Thanks Chris
participants (2)
-
Christopher Coat -
Nicolai Hess