rect

package
v4.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: LGPL-3.0 Imports: 4 Imported by: 0 modules, 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 rect provides the rectangle type shared by pipeline parameters and result views.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Rect

type Rect [4]int

Rect represents a 2D rectangle as [4]int: x, y, width, height.

func (Rect) Height

func (r Rect) Height() int

Height returns the vertical size.

func (Rect) IsZero

func (r Rect) IsZero() bool

IsZero reports whether both coordinates and both dimensions are zero. It lets the encoding/json "omitzero" option omit empty rectangles, so pipeline defaults and parent-node inheritance apply.

func (*Rect) UnmarshalJSON

func (r *Rect) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes a rectangle from a JSON array of integers, mirroring the upstream pipeline parser: [x, y] expands to a 1x1 rectangle at (x, y), and [x, y, w, h] is used as-is. Any other length, null, or non-integer element is an error; on error the rectangle is left unchanged.

func (Rect) Width

func (r Rect) Width() int

Width returns the horizontal size.

func (Rect) X

func (r Rect) X() int

X returns the left coordinate.

func (Rect) Y

func (r Rect) Y() int

Y returns the top coordinate.

Jump to

Keyboard shortcuts

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