PImage \ Language (API) \ Processing 1.0
Search processing.org:
Language (A-Z) \
Libraries \
Tools \
Environment \
Compare \
Troubleshooting
Reference for Processing version 1.0+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.
Name
PImage
Examples
PImage b;
b = loadImage("laDefense.jpg");
image(b, 0, 0);
Description
Datatype for storing images. Processing can display .gif, .jpg, .tga, and .png images. Images may be displayed in 2D and 3D space. Before an image is used, it must be loaded with the loadImage() function. The PImage object contains fields for the width and height of the image, as well as an array called pixels[] which contains the values for every pixel in the image. A group of methods, described below, allow easy access to the image's pixels and alpha channel and simplify the process of compositing.
Before using the pixels[] array, be sure to use the loadPixels() method on the image to make sure that the pixel data is properly loaded.
To create a new image, use the createImage() function (do not use new PImage()).
Fields
width
Image width
height
Image height
pixels[]
Array containing the color of every pixel in the image
Methods
get()
Reads the color of any pixel or grabs a rectangle of pixels
set()
Writes a color to any pixel or writes an image into another
copy()
Copies the entire image
mask()
Masks part of the image from displaying
blend()
Copies a pixel or rectangle of pixels using different blending modes
filter()
Converts the image to grayscale or black and white
save()
Saves the image to a TIFF, TARGA, PNG, or JPEG file
resize()
Changes the size of an image to a new width and height
loadPixels()
Loads the pixel data for the image into its pixels[] array
updatePixels()
Updates the image with the data in its pixels[] array
Constructor
PImage()
PImage(width, height)
PImage(width, height, format)
PImage(img)
Parameters
width
int: image width
height
int: image height
format
Either RGB, ARGB, ALPHA (grayscale alpha channel)
img
java.awt.Image: assumes a MediaTracker has been used to fully download the data and the img is valid
Usage
Web & Application
Related
loadImage()imageMode()createImage()
Updated on November 22, 2008 10:09:31pm PST
Processing was initiated by Ben Fry and Casey Reas. It is developed by a small team of volunteers.
© Info \
Site hosted by Media Temple!
Wyszukiwarka
Podobne podstrony:
PImage loadPixelsPImage filterPImage resizePImage alphaPImage blendPImage getPImage copyPImage heightPImage pixelsPImage filterPImage maskPImage setPImage updatePixelsPImage savePImage pixelsPImage resizePImage blendPImage heightPImage widthwięcej podobnych podstron