func toPaletted(o *ora.ORA, name string, palette color.Palette) (*image.Paletted, error) { var p *image.Paletted if l := o.Layer(name); l != nil { p = image.NewPaletted(o.Bounds(), palette) i, err := l.Image() if err != nil { return nil, err } draw.Draw(p, image.Rect(0, 0, p.Bounds().Max.X, p.Bounds().Max.Y), i, image.Point{}, draw.Src) } return p, nil }
func toGray(o *ora.ORA, name string) (*image.Gray, error) { var p *image.Gray if l := o.Layer(name); l != nil { p = image.NewGray(o.Bounds()) i, err := l.Image() if err != nil { return nil, err } draw.Draw(p, image.Rect(0, 0, p.Bounds().Max.X, p.Bounds().Max.Y), i, image.Point{}, draw.Src) } return p, nil }