I want to write code to flash a color image of a person in a window for a short period of time. The duration of the flash is important, not the frequency of the flashes, which will be low and probably controlled by pressing a key.
Ideally, the duration should be an integral number of frames, starting from 1 and increasing to a much larger number. With a 60 Hz monitor, one frame would be 0.0167 seconds. The images would be low to moderate resolution, e.g. 70K to 1 Mb Can this be done entirely in Pharo or would it be necessary to use the Unified FFI with operating system commands? If it can be done in Pharo, what are the classes needed to display an image filed in from the hard drive? I am using a 27 inch iMAC (10.11.6) with 4GHz, 8 GB ram, and AMD Radeon R9 M395X 4096 MB video card. Pharos is new to me but I wrote Smalltalk code with VisualWorks a few years back. Thanks very much. Lou Cleveland
|
| image morph | image := Form fromFileNamed: 'path/(.jpg|.png)'. morph := image asMorph. morph openCenteredInWorld. morph addAlarm: #delete after: 2000 "ms". ---------------------------- Ps. Pharo UI runs at 50Hz Best regards, Henrik From: Pharo-users [mailto:[hidden email]]
On Behalf Of William L. Cleveland I want to write code to flash a color image of a person in a window for a short period of time. The duration of the flash is important, not the frequency of the flashes, which will be low and probably controlled by pressing a key. Ideally, the duration should be an integral number of frames, starting from 1 and increasing to a much larger number. With a 60 Hz monitor, one frame would be 0.0167 seconds. The images would be low to moderate resolution, e.g. 70K to 1
Mb Can this be done entirely in Pharo or would it be necessary to use the Unified FFI with operating system commands? If it can be done in Pharo, what are the classes needed to display an image filed in from the hard drive? I am using a 27 inch iMAC (10.11.6) with 4GHz, 8 GB ram, and AMD Radeon R9 M395X 4096 MB video card. Pharos is new to me but I wrote Smalltalk code with VisualWorks a few
years back. Thanks very much. Lou Cleveland |
In reply to this post by W. L. Cleveland
Flashing is basically animation. All you need is an ImageMorph and to add stepping using the step method. step is the method that does the animation loop (step = frame)step "super step." self managerModel mode = 'clock' ifTrue: [ time := DateAndTime current. timeStr color: Color white ]. self managerModel mode = 'timer' | (self managerModel mode = 'stopwatch') ifTrue: [ time := ('0:' , self managerModel timeDisplay) asDuration minutes asDuration. self managerModel phase = 'work' ifTrue: [ timeStr color: Color green ]. self managerModel phase = 'break' ifTrue: [ timeStr color: Color red ] ]. secondsTimer form: (self secondsTimerForm at: time seconds + 1). self setTimeLabel. World submorphs do: [ :each| (each isKindOf: TaskbarMorph) ifTrue: [each updateTaskButtons]] stepTime ^ 1000 Form fromFileNamed: wp / ('images/panels/mainPanel/secondsTimer/secondsTimer0001.png') wd := FileSystem disk workingDirectory . On Mon, Nov 28, 2016 at 10:43 PM William L. Cleveland <[hidden email]> wrote:
|
In reply to this post by Henrik Nergaard-2
WorldState MinCycleLapse: 16 will make it 60 FPS. Much smoother on Windows. Ok, some CPU is used. Phil On Mon, Nov 28, 2016 at 9:53 PM, Henrik Nergaard <[hidden email]> wrote:
|
In reply to this post by Henrik Nergaard-2
If you need fullscreen show:
|
Free forum by Nabble | Edit this page |