im8

package module
v0.0.0-...-f0e6d84 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: MIT Imports: 4 Imported by: 0

README

im8

A 6- or 8-bit color and image format in Go.

Documentation

Overview

Package im8 provides a 6- or 8-bit image format.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Im8

type Im8 struct {
	// Pix holds the image's pixels. The pixel at (x, y) is at Pix[(y-Rect.Min.Y)*Stride + (x-Rect.Min.X)].
	Pix []uint8

	// Stride is the Pix stride (in bytes) between vertically adjacent pixels.
	Stride int

	// Rect is the image's bounds.
	Rect image.Rectangle
}

Im8 is an in-memory image whose At method returns col8.Col8 values.

func Convert

func Convert(src image.Image) *Im8

Convert turns any image.Image into an Im8.

func NewIm8

func NewIm8(r image.Rectangle) *Im8

NewIm8 returns a new Im8 image with the given bounds.

func (*Im8) At

func (i *Im8) At(x, y int) color.Color

At returns the color of the pixel at (x, y). At(Bounds().Min.X, Bounds().Min.Y) returns the upper-left pixel of the grid. At(Bounds().Max.X-1, Bounds().Max.Y-1) returns the lower-right one.

func (*Im8) Bounds

func (i *Im8) Bounds() image.Rectangle

Bounds returns the domain for which At can return non-zero color. The bounds do not necessarily contain the point (0, 0).

func (*Im8) Col8At

func (i *Im8) Col8At(x, y int) col8.Col8

Col8At returns the col8.Col8 pixel at (x, y).

func (*Im8) ColorModel

func (i *Im8) ColorModel() color.Model

ColorModel returns the Image's color model.

func (*Im8) Opaque

func (i *Im8) Opaque() bool

Opaque scans the entire image and reports whether it is fully opaque.

func (*Im8) PixOffset

func (i *Im8) PixOffset(x, y int) int

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

func (*Im8) Set

func (i *Im8) Set(x, y int, c color.Color)

Set sets the pixel at (x, y) to c, after converting to a col8.Col8.

func (*Im8) SetCol8

func (i *Im8) SetCol8(x, y int, c col8.Col8)

SetCol8 sets the pixel at (x, y) to c.

func (*Im8) SubImage

func (i *Im8) SubImage(r image.Rectangle) image.Image

SubImage returns an image representing the portion of the image p visible through r. The returned value shares pixels with the original image.

Directories

Path Synopsis
Package col8 provides an 8-bit color type Col8.
Package col8 provides an 8-bit color type Col8.
Package im8f contains a format for encoding/decoding im8 images.
Package im8f contains a format for encoding/decoding im8 images.

Jump to

Keyboard shortcuts

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