pixie/images

    Dark Mode
Search:
Group by:
  Source   Edit

Types

Image = ref object
  width*, height*: int
  data*: seq[ColorRGBX]
Image object that holds bitmap data in RGBA format.   Source   Edit

Procs

proc `$`(image: Image): string {....raises: [], tags: [].}
Prints the image size.   Source   Edit
proc `[]=`(image: Image; x, y: int; color: SomeColor) {.inline, ...raises: [].}
Sets a pixel at (x, y) or does nothing if outside of bounds.   Source   Edit
proc `[]`(image: Image; x, y: int): ColorRGBX {.inline, ...raises: [], tags: [].}
Gets a pixel at (x, y) or returns transparent black if outside of bounds.   Source   Edit
proc applyOpacity(image: Image; opacity: float32) {....raises: [], tags: [].}
Multiplies alpha of the image by opacity.   Source   Edit
proc blur(image: Image; radius: float32;
          outOfBounds: SomeColor = color(0, 0, 0, 0)) {....raises: [PixieError].}
Applies Gaussian blur to the image given a radius.   Source   Edit
proc copy(image: Image): Image {....raises: [PixieError], tags: [].}
Copies the image data into a new image.   Source   Edit
proc dataIndex(image: Image; x, y: int): int {.inline, ...raises: [], tags: [].}
  Source   Edit
proc diff(master, image: Image): (float32, Image) {....raises: [PixieError],
    tags: [].}
Compares the parameters and returns a score and image of the difference.   Source   Edit
proc draw(a, b: Image; transform = mat3(); blendMode = NormalBlend) {.inline,
    ...raises: [PixieError], tags: [RootEffect].}
Draws one image onto another using matrix with color blending.   Source   Edit
proc draw(a, b: Mask; transform = mat3(); blendMode = MaskBlend) {.inline,
    ...raises: [PixieError], tags: [RootEffect].}
Draws a mask onto a mask using a matrix with color blending.   Source   Edit
proc draw(image: Image; mask: Mask; transform = mat3(); blendMode = MaskBlend) {.
    inline, ...raises: [PixieError], tags: [RootEffect].}
Draws a mask onto an image using a matrix with color blending.   Source   Edit
proc draw(mask: Mask; image: Image; transform = mat3(); blendMode = MaskBlend) {.
    inline, ...raises: [PixieError], tags: [RootEffect].}
Draws a image onto a mask using a matrix with color blending.   Source   Edit
proc drawTiled(dst, src: Image; mat: Mat3; blendMode = NormalBlend) {.
    ...raises: [PixieError], tags: [RootEffect].}
  Source   Edit
proc fill(image: Image; color: SomeColor) {.inline, ...raises: [].}
Fills the image with the color.   Source   Edit
proc flipHorizontal(image: Image) {....raises: [], tags: [].}
Flips the image around the Y axis.   Source   Edit
proc flipVertical(image: Image) {....raises: [], tags: [].}
Flips the image around the X axis.   Source   Edit
proc getColor(image: Image; x, y: int): Color {.inline, ...raises: [], tags: [].}
Gets a color at (x, y) or returns transparent black if outside of bounds.   Source   Edit
proc getRgbaSmooth(image: Image; x, y: float32; wrapped = false): ColorRGBX {.
    ...raises: [], tags: [].}
Gets a interpolated color with float point coordinates. Pixels outside the image are transparent.   Source   Edit
proc inside(image: Image; x, y: int): bool {.inline, ...raises: [], tags: [].}
Returns true if (x, y) is inside the image.   Source   Edit
proc invert(image: Image) {....raises: [], tags: [].}
Inverts all of the colors and alpha.   Source   Edit
proc isOneColor(image: Image): bool {....raises: [], tags: [].}
Checks if the entire image is the same color.   Source   Edit
proc isOpaque(image: Image): bool {....raises: [], tags: [].}
Checks if the entire image is opaque (alpha values are all 255).   Source   Edit
proc isTransparent(image: Image): bool {....raises: [], tags: [].}
Checks if this image is fully transparent or not.   Source   Edit
proc magnifyBy2(image: Image; power = 1): Image {....raises: [PixieError], tags: [].}
Scales image up by 2 ^ power.   Source   Edit
proc minifyBy2(image: Image; power = 1): Image {....raises: [PixieError], tags: [].}
Scales the image down by an integer scale.   Source   Edit
proc newImage(mask: Mask): Image {....raises: [PixieError], tags: [].}
  Source   Edit
proc newImage(width, height: int): Image {....raises: [PixieError], tags: [].}
Creates a new image with the parameter dimensions.   Source   Edit
proc newMask(image: Image): Mask {....raises: [PixieError], tags: [].}
Returns a new mask using the alpha values of the image.   Source   Edit
proc resize(srcImage: Image; width, height: int): Image {....raises: [PixieError],
    tags: [RootEffect].}
Resize an image to a given height and width.   Source   Edit
proc resize(srcMask: Mask; width, height: int): Mask {....raises: [PixieError],
    tags: [RootEffect].}
Resize a mask to a given height and width.   Source   Edit
proc rotate90(image: Image) {....raises: [PixieError], tags: [].}
Rotates the image 90 degrees clockwise.   Source   Edit
proc setColor(image: Image; x, y: int; color: Color) {.inline, ...raises: [],
    tags: [].}
Sets a color at (x, y) or does nothing if outside of bounds.   Source   Edit
proc shadow(image: Image; offset: Vec2; spread, blur: float32; color: SomeColor): Image {.
    ...raises: [PixieError].}
Create a shadow of the image with the offset, spread and blur.   Source   Edit
proc subImage(image: Image; x, y, w, h: int): Image {....raises: [PixieError],
    tags: [].}
Gets a sub image from this image.   Source   Edit
proc superImage(image: Image; x, y, w, h: int): Image {....raises: [PixieError],
    tags: [RootEffect].}
Either cuts a sub image or returns a super image with padded transparency.   Source   Edit

Templates

template `[]=`(view: UnsafeImage; x, y: int; color: ColorRGBX)
Sets a color from (x, y) coordinates.
  • No bounds checking *

Make sure that x, y are in bounds. Failure in the assumptions will cause unsafe memory writes.

  Source   Edit
template `[]`(view: UnsafeImage; x, y: int): var ColorRGBX
Gets a color from (x, y) coordinates.
  • No bounds checking *

Make sure that x, y are in bounds. Failure in the assumptions will cause unsafe memory reads.

  Source   Edit
template unsafe(src: Image): UnsafeImage
  Source   Edit