imageutil

package
v0.0.0-...-1aa240f Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package imageutil provides helpers for decoding images into weighted pixel samples.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PixelsUnweighted

func PixelsUnweighted(img image.Image) []color.Color

PixelsUnweighted returns all pixel colors from the image in row-major order. Kept for internal use where a flat []color.Color slice is needed.

Types

type WeightedPixel

type WeightedPixel struct {
	Color  color.Color
	Weight float32
}

WeightedPixel is a color sample with a weight in [0.0, 1.0]. Weight reflects alpha: fully opaque = 1.0, fully transparent = 0.0.

func Pixels

func Pixels(img image.Image) []WeightedPixel

Pixels returns all non-transparent pixels from the image as WeightedPixels. Fully transparent pixels (alpha == 0) are skipped. Semi-transparent pixels are included with weight = alpha / 65535. Fully opaque pixels have weight 1.0.

Jump to

Keyboard shortcuts

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