Creating images pixel by pixel fast
Avi Bryant
avi at beta4.com
Fri Nov 21 05:17:30 UTC 2003
On Nov 21, 2003, at 12:05 AM, Joel Shellman wrote:
> I profiled the Raytracing package example just for fun and found
> something interesting.
>
> Even if all the calculations had taken 0 time, it looks like it still
> would have taken over 8 seconds just to create the image with the
> pixels.
>
> Isn't there some way of creating an image pixel by pixel very fast?
> Any examples of how that would be done?
Hmm, very good point. Most of that goes to #bitPokerToForm:, and I
don't see why we have to do that every time. For example:
form := Form extent: 640 at 480 depth: 32
poker := BitBlt current bitPokerToForm: c.
MessageTally spyOn:
[1 to: 640 do:
[:x |
1 to: 480 do:
[:y |
poker
pixelAt: x at y
put: (Color red pixelValueForDepth: 32)]]]
Now to take advantage of this in the Raytracer...
Avi
More information about the Squeak-dev
mailing list
|