Types
Image = ref object width*, height*: int data*: seq[ColorRGBA]
- Image object that holds bitmap data in RGBA format.
Procs
proc newImage(width, height: int): Image {...}{.raises: [PixieError], tags: [].}
- Creates a new image with the parameter dimensions.
proc wh(image: Image): Vec2 {...}{.inline, raises: [], tags: [].}
- Return with and height as a size vector.
proc copy(image: Image): Image {...}{.raises: [PixieError], tags: [].}
- Copies the image data into a new image.
proc `$`(image: Image): string {...}{.raises: [], tags: [].}
- Prints the image size.
proc inside(image: Image; x, y: int): bool {...}{.inline, raises: [], tags: [].}
- Returns true if (x, y) is inside the image.
proc dataIndex(image: Image; x, y: int): int {...}{.inline, raises: [], tags: [].}
proc getRgbaUnsafe(image: Image; x, y: int): ColorRGBA {...}{.inline, raises: [], tags: [].}
-
Gets a color from (x, y) coordinates.
- No bounds checking *
Make sure that x, y are in bounds. Failure in the assumptions will case unsafe memory reads.
proc `[]`(image: Image; x, y: int): ColorRGBA {...}{.inline, raises: [], tags: [].}
- Gets a pixel at (x, y) or returns transparent black if outside of bounds.
proc setRgbaUnsafe(image: Image; x, y: int; rgba: ColorRGBA) {...}{.inline, raises: [], tags: [].}
-
Sets a color from (x, y) coordinates.
- No bounds checking *
Make sure that x, y are in bounds. Failure in the assumptions will case unsafe memory writes.
proc `[]=`(image: Image; x, y: int; rgba: ColorRGBA) {...}{.inline, raises: [], tags: [].}
- Sets a pixel at (x, y) or does nothing if outside of bounds.
proc fillUnsafe(data: var seq[ColorRGBA]; rgba: ColorRGBA; start, len: int) {...}{. raises: [], tags: [].}
- Fills the image data with the parameter color starting at index start and continuing for len indices.
proc fill(image: Image; rgba: ColorRGBA) {...}{.inline, raises: [], tags: [].}
- Fills the image with the parameter color.
proc flipHorizontal(image: Image) {...}{.raises: [], tags: [].}
- Flips the image around the Y axis.
proc flipVertical(image: Image) {...}{.raises: [], tags: [].}
- Flips the image around the X axis.
proc subImage(image: Image; x, y, w, h: int): Image {...}{.raises: [PixieError], tags: [].}
- Gets a sub image from this image.
proc superImage(image: Image; x, y, w, h: int): Image {...}{.raises: [PixieError], tags: [].}
- Either cuts a sub image or returns a super image with padded transparency.
proc minifyBy2(image: Image; power = 1): Image {...}{.raises: [PixieError], tags: [].}
- Scales the image down by an integer scale.
proc magnifyBy2(image: Image; power = 1): Image {...}{.raises: [PixieError], tags: [].}
- Scales image image up by 2 ^ power.
proc toPremultipliedAlpha(image: Image) {...}{.raises: [], tags: [].}
- Converts an image to premultiplied alpha from straight alpha.
proc applyOpacity(target: Image | Mask; opacity: float32)
- Multiplies alpha of the image by opacity.
proc invert(target: Image | Mask)
- Inverts all of the colors and alpha.
proc blur(target: Image | Mask; radius: float32; offBounds: uint32 = 0)
- Applies Gaussian blur to the image given a radius.
proc newMask(image: Image): Mask {...}{.raises: [PixieError], tags: [].}
- Returns a new mask using the alpha values of the parameter image.
proc getRgbaSmooth(image: Image; x, y: float32): ColorRGBA {...}{.raises: [], tags: [].}
proc getRgbaSmoothWrapped(image: Image; x, y: float32): ColorRGBA {...}{.raises: [], tags: [].}
proc draw(a, b: Image; mat: Mat3; blendMode = bmNormal) {...}{.inline, raises: [PixieError, Exception], tags: [RootEffect].}
- Draws one image onto another using matrix with color blending.
proc draw(a, b: Image; pos = vec2(0, 0); blendMode = bmNormal) {...}{.inline, raises: [PixieError, Exception], tags: [RootEffect].}
- Draws one image onto another using a position offset with color blending.
proc draw(image: Image; mask: Mask; mat: Mat3; blendMode = bmMask) {...}{.inline, raises: [PixieError, Exception], tags: [RootEffect].}
- Draws a mask onto an image using a matrix with color blending.
proc draw(image: Image; mask: Mask; pos = vec2(0, 0); blendMode = bmMask) {...}{. inline, raises: [PixieError, Exception], tags: [RootEffect].}
- Draws a mask onto an image using a position offset with color blending.
proc draw(a, b: Mask; mat: Mat3; blendMode = bmMask) {...}{.inline, raises: [PixieError, Exception], tags: [RootEffect].}
- Draws a mask onto a mask using a matrix with color blending.
proc draw(a, b: Mask; pos = vec2(0, 0); blendMode = bmMask) {...}{.inline, raises: [PixieError, Exception], tags: [RootEffect].}
- Draws a mask onto a mask using a position offset with color blending.
proc draw(mask: Mask; image: Image; mat: Mat3; blendMode = bmMask) {...}{.inline, raises: [PixieError, Exception], tags: [RootEffect].}
- Draws a image onto a mask using a matrix with color blending.
proc draw(mask: Mask; image: Image; pos = vec2(0, 0); blendMode = bmMask) {...}{. inline, raises: [PixieError, Exception], tags: [RootEffect].}
- Draws a image onto a mask using a position offset with color blending.
proc resize(srcImage: Image; width, height: int): Image {...}{. raises: [PixieError, Exception], tags: [RootEffect].}
- Resize an image to a given hight and width.
proc shift(target: Image | Mask; offset: Vec2)
- Shifts the target by offset.