FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   fast pixel blitting vs. color()
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: fast pixel blitting vs. color()  (Read 316 times)
elout

12747371274737 WWW
fast pixel blitting vs. color()
« on: Aug 28th, 2003, 2:07pm »

I just installed prossesing - 058 today for the first time and started playing around with it.
 
One of my first goals was to test out the blitting speed, and found out that color() seems a bit slow.
 
http://www.xs4all.nl/~elout/pro55esing/fastnoise3/
 
click on the screen to compare the routine using this;
pixels[i] = ( ( my_grey << 16 ) | ( my_grey << 8 ) | my_grey );
 
or this;
 
pixels[i] = color(my_grey, my_grey,my_grey);
 
 
arielm

WWW
Re: fast pixel blitting vs. color()
« Reply #1 on: Aug 28th, 2003, 3:56pm »

i guess it's not a surprise since color() is supposed to be a high level function, e.g. enabling to work with HSB values instead of RGB, or even to use the range 0.0 - 1.0 instead of 0 - 255 for color values...
 

Ariel Malka | www.chronotext.org
fry


WWW
Re: fast pixel blitting vs. color()
« Reply #2 on: Aug 28th, 2003, 5:08pm »

yes, this is by design. color() is not intended to be fast for exactly the reasons arielm sites.  
 
we full intend for the people who want it to work quickly to learn to pack colors into ints like you're doing in your second example.
 
though this reminds me that we oughta have the slight optimization to just fall back to this int packing when the colorMode is RGB and 255, since that's prolly 80% of most projects.
 
Pages: 1 

« Previous topic | Next topic »