GSDP:GAM100/CProcessing/setImageFlags()

From Inside
Jump to: navigation, search

setImageFlags()

Description

Lets you set flags for different functionality when loading an image.

Parameters

imageMode(int imageFlags)

  • imageFlags - (int) The flags you want to set when loading the image as listed below.

Flags

  • CP_IMAGE_GENERATE_MIPMAPS - Generate mipmaps during creation of the image.
  • CP_IMAGE_REPEATX - Repeat image in X direction.
  • CP_IMAGE_REPEATY - Repeat image in Y direction.
  • CP_IMAGE_FLIPY - Flips (inverses) image in Y direction when rendered.
  • CP_IMAGE_NEAREST - Image interpolation is Nearest instead Linear.
  • CP_IMAGE_STORE_PIXEL_DATA - This saves a copy of the pixel data (NOTE: this can be memory expensive)

Example

PImage justin_face;
PImage sub_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);
  sub_justin_face = imageCreateSubimage(justin_face, 0, 0, x_size, y_size / 2);
}

void update()
{
  background(color(255, 255, 255, 255));
  image(sub_justin_face, mouseX, mouseY, x_size, y_size/2, 255);
}

Related

Personal tools
Namespaces

Variants
Actions
Navigation
NameSpaces:>
Tools
Dynamic:>