func (p *RGBAM) SetRGBAM(x, y int, c npcolor.RGBAM) {
	if !(image.Point{x, y}.In(p.Rect)) {
		return
	}
	i := p.PixOffset(x, y)
	if c.M == p.Model.M {
		p.Pix[i+0] = c.R
		p.Pix[i+1] = c.G
		p.Pix[i+2] = c.B
		p.Pix[i+3] = c.A
	} else {
		p.Set(x, y, c)
	}
}
SetRGBAM sets the pixel at (x, y) to a given color, expressed as an
npcolor.RGBAM.
package netpbm
import (
	"bufio"
	"errors"
	"fmt"
	"image"
	"image/color"
	"io"
	"strconv"
	"strings"
	"github.com/spakin/netpbm/npcolor"
)
type pamTupleType int
const (
	pamBlackAndWhite pamTupleType = iota
	pamBlackAndWhiteAlpha
	pamGrayscale
	pamGrayscaleAlpha
	pamColor
	pamColorAlpha
)
var ttToInt = map[string]pamTupleType{
	"BLACKANDWHITE":       pamBlackAndWhite,
	"BLACKANDWHITE_ALPHA": pamBlackAndWhiteAlpha,
	"GRAYSCALE":           pamGrayscale,
	"GRAYSCALE_ALPHA":     pamGrayscaleAlpha,
	"RGB":                 pamColor,
	"RGB_ALPHA":           pamColorAlpha,
}
type RGBAM struct {
	Pix []uint8
	Stride int
	Rect image.Rectangle
	Model npcolor.RGBAMModel
}
func (p *RGBAM) ColorModel() color.Model { return p.Model }
func (p *RGBAM) Bounds() image.Rectangle { return p.Rect }
func (p *RGBAM) At(x, y int) color.Color {
	return p.RGBAMAt(x, y)
}
func (p *RGBAM) RGBAMAt(x, y int) npcolor.RGBAM {
	if !(image.Point{x, y}.In(p.Rect)) {
		return npcolor.RGBAM{}
	}
	i := p.PixOffset(x, y)
	return npcolor.RGBAM{
		R: p.Pix[i+0],
		G: p.Pix[i+1],
		B: p.Pix[i+2],
		A: p.Pix[i+3],
		M: p.Model.M,
	}
}
func (p *RGBAM) PixOffset(x, y int) int {
	return (y-p.Rect.Min.Y)*p.Stride + (x-p.Rect.Min.X)*4
}
func (p *RGBAM) Set(x, y int, c color.Color) {
	if !(image.Point{x, y}.In(p.Rect)) {
		return
	}
	i := p.PixOffset(x, y)
	c1 := p.Model.Convert(c).(npcolor.RGBAM)
	p.Pix[i+0] = c1.R
	p.Pix[i+1] = c1.G
	p.Pix[i+2] = c1.B
	p.Pix[i+3] = c1.A
}