utils

package module
v0.0.0-...-8770549 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2022 License: MIT Imports: 7 Imported by: 10

Documentation

Index

Constants

View Source
const MaxUint16 = ^uint16(0)

MaxUint16 - maximum value which can be held in an uint16

View Source
const MaxUint8 = ^uint8(0)

MaxUint8 - maximum value which can be held in an uint8

View Source
const MinUint16 = 0

MinUint16 - minimum value which can be held in an uint8

View Source
const MinUint8 = 0

MinUint8 - minimum value which can be held in an uint8

Variables

This section is empty.

Functions

func ClampF64

func ClampF64(value float64, min float64, max float64) float64

ClampF64 returns min if value is lesser then min, max if value is greater them max or value if the input value is between min and max.

func ClampInt

func ClampInt(value int, min int, max int) int

ClampInt returns min if value is lesser then min, max if value is greater them max or value if the input value is between min and max.

func CompareGrayImages

func CompareGrayImages(t *testing.T, expected *image.Gray, actual *image.Gray)

CompareGrayImages Compares two Gray images and prints out if there is a difference between the pixels

func CompareGrayImagesWithOffset

func CompareGrayImagesWithOffset(t *testing.T, expected *image.Gray, actual *image.Gray, offset uint16)

CompareGrayImagesWithOffset Compares two Gray images within a given interval (pixel +/- offset) and prints out if there is a difference between the pixels

func CompareRGBAImages

func CompareRGBAImages(t *testing.T, expected *image.RGBA, actual *image.RGBA)

CompareRGBAImages Compares two RGBA images and prints out if there is a difference between the pixels

func CompareRGBAImagesWithOffset

func CompareRGBAImagesWithOffset(t *testing.T, expected *image.RGBA, actual *image.RGBA, offset uint16)

CompareRGBAImagesWithOffset Compares two RGBA images within a given interval (pixel +/- offset) and prints out if there is a difference between the pixels

func ForEachGrayPixel

func ForEachGrayPixel(img *image.Gray, f func(pixel color.Gray))

ForEachGrayPixel loops through the image and calls f functions for each gray pixel.

func ForEachPixel

func ForEachPixel(size image.Point, f func(x int, y int))

ForEachPixel loops through the image and calls f functions for each [x, y] position.

func ForEachRGBAAlphaPixel

func ForEachRGBAAlphaPixel(img *image.RGBA, f func(r uint8))

ForEachRGBAAlphaPixel loops through the image and calls f functions for alpha component of each RGBA pixel

func ForEachRGBABluePixel

func ForEachRGBABluePixel(img *image.RGBA, f func(r uint8))

ForEachRGBABluePixel loops through the image and calls f functions for blue component of each RGBA pixel.

func ForEachRGBAGreenPixel

func ForEachRGBAGreenPixel(img *image.RGBA, f func(r uint8))

ForEachRGBAGreenPixel loops through the image and calls f functions for green component of each RGBA pixel.

func ForEachRGBAPixel

func ForEachRGBAPixel(img *image.RGBA, f func(pixel color.RGBA))

ForEachRGBAPixel loops through the image and calls f functions for each RGBA pixel.

func ForEachRGBARedPixel

func ForEachRGBARedPixel(img *image.RGBA, f func(r uint8))

ForEachRGBARedPixel loops through the image and calls f functions for red component of each RGBA pixel.

func GetMax

func GetMax(v []uint64) uint64

GetMax returns the maximum value from a slice

func IsEqualFloat64

func IsEqualFloat64(x float64, y float64) bool

IsEqualFloat64 Compares 2 float values and returns true if they are inside of the interval of [-eps, +eps]

func ParallelForEachPixel

func ParallelForEachPixel(size image.Point, f func(x int, y int))

ParallelForEachPixel loops through the image and calls f functions for each [x, y] position. The image is divided into N * N blocks, where N is the number of available processor threads. For each block a parallel Goroutine is started.

func PrintGray

func PrintGray(t *testing.T, gray *image.Gray)

PrintGray Print out gray image pixels to console

func PrintRGBA

func PrintRGBA(t *testing.T, rgba *image.RGBA)

PrintRGBA Print out gray image pixels to console

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL