image2d

package
v0.0.0-...-00121b1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package texture provides classes for creating and storing images.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveGif

func SaveGif(filepath string, images []Image2D) error

Types

type Image2D

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

Image2D stores the dimensions, data format and it's pixel data. It can be used to manipulate single pixels and is used to upload it's data to a texture.

func Make

func Make(width, height, channels int) (Image2D, error)

Make constructs a white image of the specified width and height and number of channels.

func MakeFromData

func MakeFromData(width, height int, data []uint8) (Image2D, error)

MakeFromData constructs an image of the specified width and height and the specified data.

func MakeFromFrameBuffer

func MakeFromFrameBuffer(width, height, channels int) (Image2D, error)

func MakeFromPath

func MakeFromPath(path string) (Image2D, error)

MakeFromPath constructs the image data from the specified path. If there is no image at the specified path an error is returned instead.

func (*Image2D) FlipX

func (image *Image2D) FlipX()

FlipX changes the order of the columns by swapping the first column of a row with the last column of the same row, the second column of this row with the second last column of this row etc.

func (*Image2D) FlipY

func (image *Image2D) FlipY()

FlipY changes the order of the rows by swapping the first row with the last row, the second row with the second last row etc.

func (*Image2D) GetA

func (image *Image2D) GetA(x, y int) uint8

GetA returns the alpha value of the pixel at (x,y).

func (*Image2D) GetB

func (image *Image2D) GetB(x, y int) uint8

GetB returns the blue value of the pixel at (x,y).

func (*Image2D) GetChannels

func (image *Image2D) GetChannels() int

GetChannels return the number of the channels of the image.

func (*Image2D) GetData

func (image *Image2D) GetData() []uint8

GetData returns a copy of the image's data

func (*Image2D) GetDataPointer

func (image *Image2D) GetDataPointer() unsafe.Pointer

GetDataPointer returns an pointer to the beginning of the image data.

func (*Image2D) GetG

func (image *Image2D) GetG(x, y int) uint8

GetG returns the green value of the pixel at (x,y).

func (*Image2D) GetHeight

func (image *Image2D) GetHeight() int

GetHeight returns the height of the image.

func (*Image2D) GetPixelType

func (image *Image2D) GetPixelType() uint32

GetPixelType gets the data type of the pixel data.

func (*Image2D) GetR

func (image *Image2D) GetR(x, y int) uint8

GetR returns the red value of the pixel at (x,y).

func (*Image2D) GetRGB

func (image *Image2D) GetRGB(x, y int) (uint8, uint8, uint8)

GetRGB returns the RGB values of the pixel at (x,y).

func (*Image2D) GetRGBA

func (image *Image2D) GetRGBA(x, y int) (uint8, uint8, uint8, uint8)

GetRGBA returns the RGBA value of the pixel at (x,y).

func (*Image2D) GetWidth

func (image *Image2D) GetWidth() int

GetWidth returns the width of the image.

func (*Image2D) SaveToPath

func (img *Image2D) SaveToPath(path string) error

SaveToPath saves the image at the specified path in the png format. The specified image path has to have the fileextension .png. An error is thrown if the path is not valid or any of the specified directories don't exist.

func (*Image2D) SetA

func (image *Image2D) SetA(x, y int, a uint8)

SetA sets the alpha value of the pixel at (x,y).

func (*Image2D) SetB

func (image *Image2D) SetB(x, y int, b uint8)

SetB sets the blue value of the pixel at (x,y).

func (*Image2D) SetG

func (image *Image2D) SetG(x, y int, g uint8)

SetG sets the green value of the pixel at (x,y).

func (*Image2D) SetR

func (image *Image2D) SetR(x, y int, r uint8)

SetR sets the red value of the pixel at (x,y).

func (*Image2D) SetRGB

func (image *Image2D) SetRGB(x, y int, r, g, b uint8)

SetRGB sets the RGB values of the pixel at (x,y).

func (*Image2D) SetRGBA

func (image *Image2D) SetRGBA(x, y int, r, g, b, a uint8)

SetRGBA sets the RGBA values of the pixel at (x,y).

func (Image2D) String

func (image Image2D) String() string

func (*Image2D) ToImage

func (img *Image2D) ToImage() (image.Image, error)

Jump to

Keyboard shortcuts

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