pixie/images

    Dark Mode
Search:
Group by:
  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 ceil(image: Image) {....raises: [], tags: [].}
A value of 0 stays 0. Anything else turns into 255.   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) {.
    ...raises: [PixieError], tags: [RootEffect].}
Draws one image onto another using a matrix transform and 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 opaqueBounds(image: Image): Rect {....raises: [], tags: [].}
Returns the bounds of opaque pixels. Some images have transparency around them, use this to find just the visible part of the image and then use subImage to cut it out. Returns zero rect if whole image is transparent. Returns just the size of the image if no edge is transparent.   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 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; rect: Rect): Image {....raises: [PixieError], tags: [].}
Gets a sub image from this image via rectangle. Rectangle is snapped/expanded to whole pixels first.   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