Documentation ¶
Overview ¶
Package image2d provides classes for creating and storing 2d images.
Index ¶
- type Image2D
- func Make(width, height, channels int) (Image2D, error)
- func MakeFromData(width, height, channels int, data []uint8) (Image2D, error)
- func MakeFromFrameBuffer(width, height, channels int) (Image2D, error)
- func MakeFromPath(path string) (Image2D, error)
- func MakeFromPathFixedChannels(path string, channels int) (Image2D, error)
- func (img *Image2D) ConvertToPowerOfTwo()
- func (img *Image2D) FlipX()
- func (img *Image2D) FlipY()
- func (img *Image2D) GetA(x, y int) uint8
- func (img *Image2D) GetB(x, y int) uint8
- func (img *Image2D) GetByteDepth() int
- func (img *Image2D) GetChannels() int
- func (img *Image2D) GetData() []uint8
- func (img *Image2D) GetDataPointer() unsafe.Pointer
- func (img *Image2D) GetG(x, y int) uint8
- func (img *Image2D) GetHeight() int
- func (img *Image2D) GetPixelType() uint32
- func (img *Image2D) GetR(x, y int) uint8
- func (img *Image2D) GetRGB(x, y int) (uint8, uint8, uint8)
- func (img *Image2D) GetRGBA(x, y int) (uint8, uint8, uint8, uint8)
- func (img *Image2D) GetWidth() int
- func (img *Image2D) IsPowerOfTwo() bool
- func (img *Image2D) IsQuadratic() bool
- func (img *Image2D) SaveToPath(path string) error
- func (img *Image2D) SetA(x, y int, a uint8)
- func (img *Image2D) SetB(x, y int, b uint8)
- func (img *Image2D) SetG(x, y int, g uint8)
- func (img *Image2D) SetR(x, y int, r uint8)
- func (img *Image2D) SetRGB(x, y int, r, g, b uint8)
- func (img *Image2D) SetRGBA(x, y int, r, g, b, a uint8)
- func (img Image2D) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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 MakeFromData ¶
MakeFromData constructs an image of the specified width and height and the specified data.
func MakeFromFrameBuffer ¶
MakeFromFrameBuffer grabs the data from the frame buffer and copies it into an image.
func MakeFromPath ¶
MakeFromPath constructs the image data from the specified path. If there is no image at the specified path an error is returned instead.
func MakeFromPathFixedChannels ¶
MakeFromPathFixedChannels constructs the image data from the specified path. the second parameter fixes the number of channels of the output image to the specified number. If there is no image at the specified path an error is returned instead.
func (*Image2D) ConvertToPowerOfTwo ¶
func (img *Image2D) ConvertToPowerOfTwo()
ConvertToPowerOfTwo subsamples an image to be quadratic and be a power of two.
func (*Image2D) FlipX ¶
func (img *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 (img *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) GetByteDepth ¶
GetByteDepth returns the number of bytes a channel consists of.
func (*Image2D) GetChannels ¶
GetChannels return the number of the channels of the image.
func (*Image2D) GetDataPointer ¶
GetDataPointer returns an pointer to the beginning of the image data.
func (*Image2D) GetPixelType ¶
GetPixelType gets the data type of the pixel data.
func (*Image2D) IsPowerOfTwo ¶
IsPowerOfTwo returns true if width and height are both powers or two
func (*Image2D) IsQuadratic ¶
IsQuadratic returns true if width equals height.
func (*Image2D) SaveToPath ¶
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.