goma

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2020 License: MIT Imports: 12 Imported by: 2

README

goma

App Engine Standardで動く適当なimage library

Documentation

Index

Constants

View Source
const (
	Default = iota
	PNG
	JPEG
)

Variables

This section is empty.

Functions

func ComposeCMYK

func ComposeCMYK(width int, height int, requests []*ComposeImageRequest) image.Image

func ComposeRGBA

func ComposeRGBA(width int, height int, requests []*ComposeImageRequest) image.Image

func LoadFont

func LoadFont(path string, size float64) (font.Face, error)

func Open

func Open(path string) (image.Image, error)

func Resize

func Resize(src image.Image, width, height int) *image.NRGBA

Resize is 画像をリサイズを行う ex. width:500, height:0 アスペクト比を保ったまま、width:500でリサイズする

func ResizeToFitLongSide

func ResizeToFitLongSide(src image.Image, size int) *image.NRGBA

ResizeToFitLongSide is 長辺が指定したサイズになるようにアスペクト比を維持してリサイズする

func Write

func Write(w io.Writer, img image.Image, ft FormatType) error

Types

type ComposeImageRequest

type ComposeImageRequest struct {
	// contains filtered or unexported fields
}

type FormatType

type FormatType int

func (FormatType) ImagingFormat

func (ft FormatType) ImagingFormat() imaging.Format

type GomaType

type GomaType struct {
	FormatType  FormatType
	ContentType string
}

type StorageService

type StorageService struct {
	// contains filtered or unexported fields
}

func NewStorageService

func NewStorageService(ctx context.Context, gcs *storage.Client) *StorageService

func (*StorageService) AddObjectACL

func (s *StorageService) AddObjectACL(ctx context.Context, bucket string, object string, entity storage.ACLEntity, role storage.ACLRole) error

func (*StorageService) Read

func (s *StorageService) Read(ctx context.Context, bucket string, object string) (image.Image, *GomaType, error)

func (*StorageService) Write

func (s *StorageService) Write(ctx context.Context, img image.Image, ft FormatType, bucket string, object string, ops ...WithStorageWriteOption) (rerr error)

type TextService

type TextService struct {
	BaseFont  font.Face
	EmojiFont font.Face // カラー絵文字には対応してないので、今のところ使ってない https://github.com/tenntenn/nigari/issues/1
}

func NewTextService

func NewTextService(ctx context.Context, baseFont font.Face, emojiFont font.Face) *TextService

func (*TextService) Draw

func (s *TextService) Draw(dst draw.Image, spacing float64, width fixed.Int26_6, fg image.Image, text string, x int, y int)

type WithStorageWriteOption

type WithStorageWriteOption func(ctx context.Context, oh *storage.ObjectHandle, w *storage.Writer) error

func WithMaxAge

func WithMaxAge(age int) WithStorageWriteOption

Jump to

Keyboard shortcuts

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