GSDP:GAM100/CProcessing/freeImage()

freeImage()

Description

Frees a PImage from image memory. The image to free can be any image created by a function that returns a PImage.

Parameters

freeImage(PImage* img)

  • img - (PImage*) The image to free from memory

Example

PImage justin_face;
int x_size, y_size;

void init()
{
  setImageFlags(CP_IMAGE_STORE_PIXEL_DATA);
  justin_face = loadImage("./Assets/justin1.png");

  x_size = imageWidth(justin_face);
  y_size = imageHeight(justin_face);
}

PImage frame_buffer;

void update()
{
  freeImage(&frame_buffer);
  frame_buffer = readFrameBuffer(0, 0, canvasWidth, canvasHeight);

  background(color(255, 255, 255, 255));
  image(justin_face, canvasWidth/2, canvasHeight/2, x_size, y_size, 255);
  image(frame_buffer, mouseX, mouseY, canvasWidth / 2, canvasHeight / 2, 255);
}

Related