aboutsummaryrefslogtreecommitdiff
path: root/image.go
blob: c95dd94a2b8ac795fb2cd8cd43af5fa98890c3a4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

package main

import (
	"image/color"

	"github.com/hajimehoshi/ebiten/v2"
)

func NewColorImage(size Point, color color.Color) *ebiten.Image {
	image := ebiten.NewImage(size.X, size.Y)
	image.Fill(color)
	return image
}

func NewHaloImage(sourceImage *ebiten.Image, color color.Color, width int) *ebiten.Image {
	image := NewColorImage(sourceImage.Bounds().Size().Add(Point{2 * width, 2 * width}), color)
	op := &ebiten.DrawImageOptions{}
	op.GeoM.Translate(float64(width), float64(width))
	image.DrawImage(sourceImage, op)
	return image
}