loupe

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package loupe is the frozen frame the color picker and the region overlay paint behind everything, and the magnified pixel grid they show near the pointer over it: the color picker's card and the region overlay's magnifier.

Index

Constants

View Source
const (
	// Zoom is the size of one magnified source pixel.
	Zoom = 11
	// Radius is the grid's radius in source pixels: the grid is
	// 2*Radius+1 square.
	Radius = 8
	// Size is the grid's edge in logical pixels.
	Size = (2*Radius + 1) * Zoom
	// Offset is how far a card sits from the cursor, on each axis.
	Offset = 24.0
)

Grid geometry of color_picker/mod.rs.

Variables

This section is empty.

Functions

func Draw

func Draw(cv *render.Canvas, img *image.RGBA, centerX, centerY, x0, y0 int)

Draw paints the grid of img's pixels around the frame pixel (centerX, centerY) with its top-left at (x0, y0), the centre pixel boxed.

func DrawFrame added in v0.2.0

func DrawFrame(cv *render.Canvas, frame render.StillImage, box render.Rect)

DrawFrame paints the frozen frame over the logical box: one frame pixel per device pixel when the frame has the box's device size, the output's usual case, else scaled into it as it is drawn. The frame is drawn from its own pixels, never from a resampled copy, so the surface holds no raster beyond the capture.

func Pixel

func Pixel(img *image.RGBA, x, y int) color.RGBA

Pixel reads img at frame coordinates.

func Place

func Place(box render.Rect, cx, cy float64, w, h int) (int, int)

Place is the top-left of a w x h card near the cursor (cx, cy) in box: Offset below and right of it, flipped to the other side on an axis where it would leave the box.

func SampleAt

func SampleAt(img *image.RGBA, logicalW, logicalH int, lx, ly float64) (int, int)

SampleAt is the frame pixel under a surface-local logical point: the point scaled to the frame's physical resolution, truncated and clamped.

Types

This section is empty.

Jump to

Keyboard shortcuts

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