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 <[hidden email]>: Hi everybody, Hi,
How do you draw the picture? Is it an ImageMorph or do you use directly Athens for drawing the image? nicolai
|
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.
|
2015-05-19 13:09 GMT+02:00 Christopher Coat <[hidden email]>:
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. 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
|
Free forum by Nabble | Edit this page |