purpose of format in createImage

What is the use of format in createImage? I would expect that creating a image with ALPHA would be faster then ARGB but it makes no difference.

void setup() {

  for (int j = 0; j < 10; j++) { 

    int start = millis();

    for (int i = 0; i < 1000; i++) {
      PImage img = createImage(1000, 1000, ALPHA);
    }

    int t = millis()-start;
    println(t);
  }


  for (int j = 0; j < 10; j++) { 

    int start = millis();

    for (int i = 0; i < 1000; i++) {
      PImage img = createImage(1000, 1000, ARGB);
    }

    int t = millis()-start;
    println(t);
  }
}

Also i can draw colors in a ALPHA one:

PImage a;

void setup() {


  a = createImage(1000, 1000, ALPHA);

  for(int i = 0; i < a.pixels.length; i++) {
    a.pixels[i] = (int) random(MAX_INT); 
  }

}


void draw() {
 background(0);
 image(a, 0, 0); 
}

Does someone know what it's for?

Answers

  • Answer ✓

    I see differences in the treatment of blur(), and get() only returns a grayscale value. Apparently, it is also here to support a TGA format.
    And I think it is also used for VLW fonts.

  • Ok thanks. Nothing to worry about really :)

Sign In or Register to comment.