Fast images with the class MakeScreenImage

We can create high quality image files of high-resolution using cubic pixel interpolation and anti-aliasing as discussed in “Interpolation of pixels” and “Smoothing and anti-aliasing“. But this takes a lot of time and is not suitable for on-screen images. Instead we have to generate screen images very rapidly for interactive image editing.

The lower resolution of the computer screen, no pixel interpolation and no anti-aliasing already speeds up drawing images. But we can still do better. For images such as in “Nautilus“, we have to make a mapping of space that requires a lot of computer time. This we can prepare once and do not have to repeat, saving time.

Thus I have written the class MakeScreenImage. You find its code in the next post. Similarly as the class MakeOutputImage it is rather a template and we have to adapt it to each project. Typically, we would call its “createMappedVectors()” method in the “setup()” routine to make a table with a mapped image vector for each pixel. The “imageFromVectors()” method is called in the “draw()” routine to get the screen image.

Here is a sample program using this class:

MakeScreenImage makeScreenImage;

void setup(){
  makeScreenImage=new MakeScreenImage();

void draw(){

color ripples(float i,float j){
  float a=400*sq(cos(PI*i*j/600));
  return color(a,100,100);

It shows the aliasing of narrowing rainbows:


This entry was posted in programming and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s