so I sat down to find a good way to import pngs with transparence in pharo and animate them and I ended up to this code
morph:= AlphaImageMorph new. morph openInWorld . form1 :=Form fromFileNamed:'/Users/kilon/Pictures/box.png'. form2 :=Form fromFileNamed:'/Users/kilon/Pictures/box2.png'. [(1 to: 100) do: [ :index| morph image: form1 . (Delay forMilliseconds: 2) wait. morph image: form2 . (Delay forMilliseconds: 2) wait. ]]fork. gave me a basic animation then I did the proper thing and I created my own class subclassing AlphaImageMorphing and used stepping every 40 milliseconds (25 fps) to create an animation of 2 frames , frame 1 is image box.png and frame 2 is image box2.png. Both images are 600x600 and contain transparency. Now one morph is fine , seems to work ok and does not raise my cpu much. However when I kept adding instances of the class I found out that after 3 the animation was considerably slow down, pharo also slow down with slow response to my command , when I reached 6 instance I saw failed redrawing of the moprh which was like it was cutting pieces out of the image for a second or so and pharo interaction was quite slow. The cpu one of the four cores were up to 50%. CPU consumption is not bad at all , I compared with playing a youtube FULL HD video which was the same resolution and it was consuming 30% of the cpu. However I wonder if this the best way to do this. Its clear that there is no way with my current solution I can fully animate a big pharo window that is more than 1200x1200 without serious flickering and ideally I should not animate more than 1000x1000 for smooth animation. So is this all ? Are there any improvements I may apply ? Would Athens be faster in this case ? I did not try because Athens is using Morphic anyway so it should be same if not worse. |
Le 13/09/2014 19:49, kilon alios a écrit :
> Would Athens be faster in this case ? I did not try because Athens is > using Morphic anyway so it should be same if not worse. Athens may be faster because only the final drawaing is done on the morph, not your intermediate drawing, if I understand correctly, so worth trying. Why do you need AlphaImageMorph? You want to adjust the overall transparency of your morph canvas? In that case, I think it will be always slow because software rendered. Note: for PNG file coming with alpha transparency, you don't need AlphaImageMorph to get the bitmap rendered with its transparency. Hilaire -- Dr. Geo - http://drgeo.eu iStoa - http://istao.drgeo.eu |
well I just tried plain ImageMorph, indeed the pngs render with their transparency but I get the exact same performance. No I dont need my canvas to be transparent only the pngs that will render on top of it. No idea how to do with Athens , I am looking at the examples but so far no luck. On Sun, Sep 14, 2014 at 11:30 AM, Hilaire <[hidden email]> wrote: Le 13/09/2014 19:49, kilon alios a écrit : |
Le 14/09/2014 11:02, kilon alios a écrit :
> No idea how to do with Athens , I am looking at the examples but so far > no luck. For example, check in DrGeo, in the category item-view you will find a bitmap morph for rendering in Athens -- Dr. Geo - http://drgeo.eu iStoa - http://istao.drgeo.eu |
thank you, I will take a look shortly also it just crossed my mind that I can also use NBOpenGL for even more performance and this way I can leverage the power of my GPU :) On Sun, Sep 14, 2014 at 12:26 PM, Hilaire <[hidden email]> wrote: Le 14/09/2014 11:02, kilon alios a écrit : |
In reply to this post by HilaireFernandes
trying to load drgeo using the smalltalkhub instructions gives me this error both in Pharo 3 and Pharo 4 Gofer new package: 'ConfigurationOfDrGeo'; load. ((Smalltalk at: #ConfigurationOfDrGeo) project version: #development) load. MetacelloFetchingMCSpecLoader(MetacelloCommonMCSpecLoader)>>retryingResolvePackageSpecReferences:gofer: MetacelloFetchingMCSpecLoader>>linearLoadPackageSpec:gofer: in Block: linearLoadPackageSpec: packageSpec gofer: gofer... MetacelloPharo30Platform(MetacelloPlatform)>>do:displaying: MetacelloFetchingMCSpecLoader>>linearLoadPackageSpec:gofer: MetacelloPackageSpec>>loadUsing:gofer: MetacelloFetchingMCSpecLoader(MetacelloCommonMCSpecLoader)>>linearLoadPackageSpecs:repositories: in Block: [ :pkg | pkg loadUsing: self gofer: gofer ] OrderedCollection>>do: MetacelloFetchingMCSpecLoader(MetacelloCommonMCSpecLoader)>>linearLoadPackageSpecs:repositories: MetacelloFetchingMCSpecLoader>>linearLoadPackageSpecs:repositories: in Block: [ super linearLoadPackageSpecs: packageSpecs repos...etc... BlockClosure>>ensure: MetacelloLoaderPolicy>>pushLoadDirective:during: MetacelloLoaderPolicy>>pushLinearLoadDirectivesDuring:for: MetacelloFetchingMCSpecLoader>>linearLoadPackageSpecs:repositories: MetacelloFetchingMCSpecLoader(MetacelloCommonMCSpecLoader)>>load MetacelloMCVersionSpecLoader>>load MetacelloMCVersion>>executeLoadFromArray: MetacelloMCVersion>>fetchRequiredFromArray: in Block: [ :dict | ^ self executeLoadFromArray: anArray ] MetacelloPharo30Platform(MetacelloPlatform)>>useStackCacheDuring:defaultDictionary: in Block: [ ^ aBlock value: dict ] BlockClosure>>on:do: MetacelloPharo30Platform(MetacelloPlatform)>>useStackCacheDuring:defaultDictionary: MetacelloMCVersion>>fetchRequiredFromArray: in Block: [ ... BlockClosure>>ensure: MetacelloMCVersion>>fetchRequiredFromArray: in Block: [ ... MetacelloPharo30Platform(MetacelloPlatform)>>do:displaying: MetacelloMCVersion>>fetchRequiredFromArray: MetacelloMCVersion>>doLoadRequiredFromArray: in Block: [ ... BlockClosure>>ensure: MetacelloMCVersion>>doLoadRequiredFromArray: MetacelloMCVersion>>load UndefinedObject>>DoIt On Sun, Sep 14, 2014 at 12:26 PM, Hilaire <[hidden email]> wrote: Le 14/09/2014 11:02, kilon alios a écrit : |
Yeah, change #development to #stable.
I edited the information page accordingly. Hilaire Le 14/09/2014 11:48, kilon alios a écrit : > trying to load drgeo using the smalltalkhub instructions gives me this > error both in Pharo 3 and Pharo 4 > > Gofer new > url: 'http://smalltalkhub.com/mc/HilaireFernandes/DrGeo/main'; > package: 'ConfigurationOfDrGeo'; > load. > ((Smalltalk at: #ConfigurationOfDrGeo) project version: #development) load. > -- Dr. Geo - http://drgeo.eu iStoa - http://istao.drgeo.eu |
yeap now it works, thanks, i can see the DrGBitmapMorph On Sun, Sep 14, 2014 at 1:14 PM, Hilaire <[hidden email]> wrote: Yeah, change #development to #stable. |
Free forum by Nabble | Edit this page |