GSDP:GAM100/CProcessing/imageCreateTintAdvanced()
From Inside
< GSDP:GAM100 | CProcessing
imageCreateTintAdvanced()
Description
Returns a tinted copy of a PImage using an input PColor . You must have created the image using one of the advanced image functions and set the copyPixelData flag.
Parameters
imageCreateTintAdvanced(PImage srcImg, PColor tint, bool copyPixelData, bool usePixelPerfectFiltering)
- srcImg - (PImage) The image to apply the tint
- tint - (PColor ) The tint to apply to the image
- copyPixelData - (bool) Copies the pixel data of the image so it can be manipulated later
- usePixelPerfectFiltering - (bool) Turns off bilinear smoothing for images, good for pixel art.
Example
PImage justin_face;
void init()
{
justin_face = loadImageAdvanced("./Assets/justin1.png", true, false);
}
PImage tint = NULL;
PImage tint2 = NULL;
float rot_counter = 0;
void update()
{
// Increment rotation lerp factor or reset
if (rot_counter >= 1.0f)
rot_counter -= 1.0f;
else
rot_counter += dt();
// Lerp rotation and draw image
float rot = lerpFloat(0.0f, 360.0f, rot_counter);
background(color(255, 255, 255, 255));
if (tint != NULL)
{
freeImage(&tint);
}
if (tint2 != NULL)
{
freeImage(&tint2t);
}
tint = imageCreateTintAdvanced(justin_face, color(frameCount, 10, 10, 255), true, false);
tint2 = imageCreateTint(tint, color(100, 100, 255, 255));
imageRotated(tint, mouseX, mouseY, 100, 150, 255, rot);
imageRotated(tint2t, (float)(canvasWidth/2), (float)(canvasHeight/2), 100, 150, 255, -rot);
}
Related
- Main Page
- loadImage()
- loadImageAdvanced()
- image()
- imageRotated()
- imageSize()
- imageMode()
- createImage()
- createImageAdvanced()
- freeImage()
- imageWidth()
- imageHeight()
- imagePixel()
- imageCreateSubimage()
- imageCreateSubimageAdvanced()
- imageCreateTint()
- imageCreateTintAdvanced()
- imageData()
- imageUpdate()
- readFrameBuffer()
- readFrameBufferAdvanced()