clone

package
v0.0.0-...-dd063a6 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package clone provides image cloning function.

Index

Constants

View Source
const (
	// NoFill leaves the padded pixels empty.
	NoFill = iota
	// EdgeExtend extends the closest edge pixel.
	EdgeExtend
	// EdgeWrap wraps around the pixels of an image.
	EdgeWrap
)

Variables

This section is empty.

Functions

func AsRGBA

func AsRGBA(src image.Image) *image.RGBA

AsRGBA returns an RGBA copy of the supplied image.

func AsShallowRGBA

func AsShallowRGBA(src image.Image) *image.RGBA

AsShallowRGBA tries to cast to image.RGBA to get reference. Otherwise makes a copy

func Pad

func Pad(src image.Image, padX, padY int, m PadMethod) *image.RGBA

Pad returns an RGBA copy of the src image parameter with its edges padded using the supplied PadMethod. Parameter padX and padY correspond to the amount of padding to be applied on each side. Parameter m is the PadMethod to fill the new pixels.

Usage example:

result := Pad(img, 5,5, EdgeExtend)

Types

type PadMethod

type PadMethod uint8

PadMethod is the method used to fill padded pixels.

Jump to

Keyboard shortcuts

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