function

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 8 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 function evaluates the functions of a PDF file (ISO 32000-2, 7.10): sampled (type 0), exponential (type 2), stitching (type 3) and PostScript calculator (type 4) functions. A colour space made by a function, Separation or DeviceN, makes its colours with one.

A function takes m numbers and gives n. Its inputs are clipped to its Domain, and its outputs to its Range where it has one. What a function cannot compute, a PostScript program that leaves too few numbers or divides by zero, gives zeros, clipped to its Range.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Func

type Func struct {
	// contains filtered or unexported fields
}

Func is a function, parsed. It is not safe for concurrent use.

func (*Func) Cost

func (fn *Func) Cost() int

Cost is the work of one evaluation, about the operations it takes.

func (*Func) Eval

func (fn *Func) Eval(in, out []float64)

Eval computes the function of in, len(in) of In(), into out, of Out().

func (*Func) In

func (fn *Func) In() int

In and Out are the numbers of the function's inputs and outputs.

func (*Func) Out

func (fn *Func) Out() int

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

A Reader reads the functions of one file: a function dictionary or stream, or an array of functions of one output each that together make one of as many outputs as there are functions.

A function that is an object is read once. Where it is referred to again, from the same function or another, the Reader gives what it read, so that a file cannot make it read one object over and over; and the work of all it reads is bounded by maxWork. Neither the Reader nor the functions it gives are safe for concurrent use.

func NewReader

func NewReader(f *file.File) *Reader

NewReader returns a Reader of the functions of f.

func (*Reader) Check

func (r *Reader) Check(v syntax.Value) (*Func, error)

Check reads the function v as far as its dictionaries go: nothing is decoded, neither the samples of a sampled function nor the program of a calculator function, and the function gives zeros.

func (*Reader) Read

func (r *Reader) Read(v syntax.Value, limit int64) (fn *Func, decoded int64, err error)

Read reads the function v, its samples and programs decoded up to limit bytes; decoded says how many bytes were. Past the limit, err is file.ErrTruncated. A function given again decodes nothing.

Jump to

Keyboard shortcuts

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