Documentation ¶
Index ¶
- Constants
- func AutoScale(im *image.RGBA64, maxbytes, bits int, mipmap bool) (*image.RGBA64, error)
- func CreateMipMaps(im *image.RGBA64) ([]*image.RGBA64, error)
- func IsEmpty(im *image.RGBA) bool
- func Pack(im *image.RGBA, f SizedFormat, layout Layout) ([]byte, error)
- func ReadPNG(filename string) (image.Image, error)
- func Scale(im *image.RGBA64, xbits, ybits int) (*image.RGBA64, error)
- func TileSize(xsize, ysize, bits int) int
- func ToRGBA(im image.Image) *image.RGBA
- func ToRGBA16(im *image.RGBA, gamma float64) *image.RGBA64
- func ToRGBA8(im *image.RGBA64) *image.RGBA
- func ToSizedFormat(f SizedFormat, im *image.RGBA, dithering Dithering) error
- func Trim(im *image.RGBA) *image.RGBA
- type Dithering
- type Format
- type Layout
- type PixelSize
- type SizedFormat
Constants ¶
const MemSize = 4096
MemSize is the maximum size in memory of a texture.
Variables ¶
This section is empty.
Functions ¶
func AutoScale ¶
AutoScale scales the image to fit within the given number of bytes. The number of bits per pixel is given in 'bits'.
func CreateMipMaps ¶
CreateMipMaps creates the mipmap levels for an image.
func Scale ¶
Scale returns an image scaled down by the given number of factors of two in the X and Y directions.
func ToSizedFormat ¶
func ToSizedFormat(f SizedFormat, im *image.RGBA, dithering Dithering) error
ToSizedFormat changes the values in an image to be within range for a texture format and rescales them to 0-255. For I and IA formats, the red channel is used for intensity, and it is copied to the green and blue channels. For the I format, it is also copied to alpha. CI formats are not supported.
Types ¶
type Dithering ¶
type Dithering uint32
A Dithering is a dithering technique.
func ParseDithering ¶
ParseDithering parses a dithering algorithm name.
type Format ¶
type Format uint32
A Format is an unsized pixel format.
type Layout ¶
type Layout uint32
A Layout describes the texture layout.
const ( // Linear is the ordinary linear texture layout, with rows of pixels packed // after each other. Linear Layout = iota // Native is the texture layout that the texture unit on the RDP uses. The // exact layout depends on the size, and is described in section 13.8 of the // programming manual. In general, texels are reordered so that any 2x2 // block of texels can be fetched in a single cycle. Native )
type PixelSize ¶
type PixelSize uint32
PixelSize is a texture pixel size.
type SizedFormat ¶
A SizedFormat is a combination pixel format and size.
func (SizedFormat) ChannelBits ¶
func (f SizedFormat) ChannelBits() (bits [4]int, err error)
ChannelBits returns the number of bits in each channel. Four channels are always returned. For I and IA textures, the red channel is used as the intensity channel, and the blue and green channels are given zero bits.
func (*SizedFormat) Set ¶
func (f *SizedFormat) Set(s string) error
Set sets the sized format to a string value.
func (*SizedFormat) String ¶
func (f *SizedFormat) String() (s string)
String converts the sized format to a string.