Class: Caman.Pixel
Defined in: | src/core/pixel.coffee |
Overview
Represents a single Pixel in an image.
Class Method Summary
Instance Method Summary
- - (void) constructor(r = 0, g = 0, b = 0, a = 255, c = null) Constructor
- - (void) setContext(c)
- - (void) locationXY() Retrieves the X, Y location of the current pixel.
- - (void) pixelAtLocation(loc)
- - (void) getPixelRelative(horiz, vert) Returns an RGBA object for a pixel whose location is specified in relation to the current pixel.
- - (void) putPixelRelative(horiz, vert, rgba) The counterpart to getPixelRelative, this updates the value of a pixel whose location is specified in relation to the current pixel.
- - (void) getPixel(x, y) Gets an RGBA object for an arbitrary pixel in the canvas specified by absolute X, Y coordinates
- - (void) putPixel(x, y, rgba) Updates the pixel at the given X, Y coordinate
- - (void) toString()
- - (void) toHex(includeAlpha = false)
Class Method Details
+ (void) coordinatesToLocation(x, y, width)
+ (void) locationToCoordinates(loc, width)
Constructor Details
- (void) constructor(r = 0, g = 0, b = 0, a = 255, c = null)
Instance Method Details
- (void) setContext(c)
- (void) locationXY()
Retrieves the X, Y location of the current pixel. The origin is at the bottom left corner of the image, like a normal coordinate system.
- (void) pixelAtLocation(loc)
- (void) getPixelRelative(horiz, vert)
Returns an RGBA object for a pixel whose location is specified in relation to the current pixel.
- (void) putPixelRelative(horiz, vert, rgba)
The counterpart to getPixelRelative, this updates the value of a pixel whose location is specified in relation to the current pixel.
- (void) getPixel(x, y)
Gets an RGBA object for an arbitrary pixel in the canvas specified by absolute X, Y coordinates
- (void) putPixel(x, y, rgba)
Updates the pixel at the given X, Y coordinate
- (void) toString()
- (void) toHex(includeAlpha = false)