image

package
v0.0.0-...-1504d7f Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2016 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package image allows using CUPS raster pages in combination with image.Image.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Image

func Image(p *raster.Page) (image.Image, error)

Image returns an image.Image of the page.

Depending on the color space and bit depth used, image.Image implementations from this package or from the Go standard library image package may be used. The mapping is as follows:

  • 1-bit, ColorSpaceBlack -> *Monochrome
  • 8-bit, ColorSpaceBlack -> *image.Gray
  • 8-bit, ColorSpaceCMYK -> *image.CMYK
  • Other combinations are not currently supported and will return ErrUnsupported. They might be added in the future.

No calls to ReadLine or ReadAll must be made before or after calling Image. That is, Image consumes the entire stream of the page.

Note that decoding an entire page at once may use considerable amounts of memory. For efficient, line-wise processing, a combination of ReadLine and ParseColors should be used instead.

Types

type Monochrome

type Monochrome struct {
	Pix    []uint8
	Stride int
	Rect   image.Rectangle
}

Monochrome is an in-memory monochromatic image, with 8 pixels packed into one byte. Its At method returns color.Gray values.

func (*Monochrome) At

func (img *Monochrome) At(x, y int) color.Color

func (*Monochrome) Bounds

func (img *Monochrome) Bounds() image.Rectangle

func (*Monochrome) ColorModel

func (img *Monochrome) ColorModel() color.Model

func (*Monochrome) PixOffset

func (img *Monochrome) PixOffset(x, y int) int

PixOffset returns the index of the first element of Pix that corresponds to the pixel at (x, y).

Jump to

Keyboard shortcuts

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