Documentation ¶
Index ¶
- func Clone(img image.Image) *image.NRGBA
- func Crop(img image.Image, rect image.Rectangle) *image.NRGBA
- func CropAnchor(img image.Image, width, height int, anchor Anchor) *image.NRGBA
- func CropCenter(img image.Image, width, height int) *image.NRGBA
- func FlipH(img image.Image) *image.NRGBA
- func FlipV(img image.Image) *image.NRGBA
- func New(width, height int, fillColor color.Color) *image.NRGBA
- func Overlay(background, img image.Image, pos image.Point, opacity float64) *image.NRGBA
- func OverlayCenter(background, img image.Image, opacity float64) *image.NRGBA
- func Paste(background, img image.Image, pos image.Point) *image.NRGBA
- func PasteCenter(background, img image.Image) *image.NRGBA
- func Rotate(img image.Image, angle float64, bgColor color.Color) *image.NRGBA
- func Rotate180(img image.Image) *image.NRGBA
- func Rotate270(img image.Image) *image.NRGBA
- func Rotate90(img image.Image) *image.NRGBA
- func Transpose(img image.Image) *image.NRGBA
- func Transverse(img image.Image) *image.NRGBA
- type Anchor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Crop ¶
Crop cuts out a rectangular region with the specified bounds from the image and returns the cropped image.
func CropAnchor ¶
CropAnchor cuts out a rectangular region with the specified size from the image using the specified anchor point and returns the cropped image.
func CropCenter ¶
CropCenter cuts out a rectangular region with the specified size from the center of the image and returns the cropped image.
func FlipH ¶
FlipH flips the image horizontally (from left to right) and returns the transformed image.
func FlipV ¶
FlipV flips the image vertically (from top to bottom) and returns the transformed image.
func New ¶
New creates a new image with the specified width and height, and fills it with the specified color.
func Overlay ¶
Overlay draws the img image over the background image at given position and returns the combined image. Opacity parameter is the opacity of the img image layer, used to compose the images, it must be from 0.0 to 1.0.
Usage examples:
// Draw spriteImage over backgroundImage at the given position (x=50, y=50). dstImage := imaging.Overlay(backgroundImage, spriteImage, image.Pt(50, 50), 1.0) // Blend two opaque images of the same size. dstImage := imaging.Overlay(imageOne, imageTwo, image.Pt(0, 0), 0.5)
func OverlayCenter ¶
OverlayCenter overlays the img image to the center of the background image and returns the combined image. Opacity parameter is the opacity of the img image layer, used to compose the images, it must be from 0.0 to 1.0.
func Paste ¶
Paste pastes the img image to the background image at the specified position and returns the combined image.
func PasteCenter ¶
PasteCenter pastes the img image to the center of the background image and returns the combined image.
func Rotate ¶
Rotate rotates an image by the given angle counter-clockwise . The angle parameter is the rotation angle in degrees. The bgColor parameter specifies the color of the uncovered zone after the rotation.
func Rotate180 ¶
Rotate180 rotates the image 180 degrees counter-clockwise and returns the transformed image.
func Rotate270 ¶
Rotate270 rotates the image 270 degrees counter-clockwise and returns the transformed image.
func Rotate90 ¶
Rotate90 rotates the image 90 degrees counter-clockwise and returns the transformed image.