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 ¶
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 ¶
Monochrome is an in-memory monochromatic image, with 8 pixels packed into one byte. Its At method returns color.Gray values.
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).