Extends Item
The Raster item represents an image in an Illustrator document.
Constructors
Creates a raster object
- Parameters:
- type: String ('rgb', 'cmyk', 'gray', 'bitmap', 'argb', 'acmyk', 'agray', 'abitmap') — optional
- width: Number — optional
- height: Number — optional
- Returns:
- Raster
Creates a raster item from an AWT image.
- Parameters:
- image: Image — the AWT image to be converted to a raster item
- Returns:
- Raster
Creates a raster item from a local image file.
Sample code:
var file = new java.io.File('/folder/image.jpg');
var raster = new Raster(file);
- Parameters:
- file: File — the image file to be loaded
- Returns:
- Raster
Creates a raster image from a URL. This blocks until the image is loaded or an error occured.
Sample code:
var url = new java.net.URL('http://www.server.com/image.jpg');
var raster = new Raster(url);
- Parameters:
- url: URL — the URL of the image to load
- Returns:
- Raster
- Throws:
- IOException
Properties
The color type of the raster.
- Returns:
- String ('rgb', 'cmyk', 'gray', 'bitmap', 'argb', 'acmyk', 'agray', 'abitmap')
The average color of the raster. Read-only.
- Returns:
- Color
Functions
- Parameters:
- x: Number
- y: Number
- width: Number
- height: Number
- Returns:
- BufferedImage
- Parameters:
- image: Image
- x: Number
- y: Number
Average Color
Pixels
Sets the color of a pixel in the raster. Sample code:
// Creates an RGB raster of 1px*1px var raster = new Raster(Color.TYPE_RGB,1,1); // Changes the color of the first pixel to red var redColor = new RGBColor(1,0,0); raster.setPixel(0,0,redColor)
- Parameters:
- x: Number
- y: Number
- color: Color
Sets the color of a pixel in the raster.
Sample code:
// Creates an RGB raster of 1px*1px var raster = new Raster(Color.TYPE_RGB,1,1); // Changes the color of the first pixel to red var redColor = new RGBColor(1,0,0); var point = new Point(0,0); raster.setPixel(point,redColor)
Inheritance
- Item
-
- name
- position
- style
- selected
- fullySelected
- locked
- visible
- clipMask
- targeted
- blendMode
- opacity
- isolated
- knockout
- alphaIsShape
- data
- document
- layer
- parent
- children
- firstChild
- lastChild
- nextSibling
- previousSibling
- index
- bounds
- strokeBounds
- controlBounds
- strokeColor
- strokeWidth
- strokeCap
- strokeJoin
- dashOffset
- dashArray
- miterLimit
- strokeOverprint
- fillColor
- fillOverprint
- windingRule
- resolution
- rasterize(items[, type[, resolution, antialiasing[, width, height]]])
- remove()
- removeChildren()
- copyTo(document)
- copyTo(item)
- clone()
- getKnockout(inherited)
- reverseChildren()
- hitTest(point[, request[, tolerance]])
- hitTest(point, tolerance)
- expand([flags[, steps]])
- rasterize([type[, resolution[, antialiasing[, width, height]]]])
- hasChildren()
- isEditable()
- isValid()
- appendTop(item)
- appendBottom(item)
- moveAbove(item)
- moveBelow(item)
- isAbove(item)
- isBelow(item)
- isParent(item)
- isChild(item)
- isDescendant(item)
- isAncestor(item)
- isGroupedWith(item)
- scale(sx, sy[, center])
- scale(scale[, center])
- translate(t)
- rotate(angle[, center])
- shear(shx, shy)
- transform(matrix[, flags])