img

package
Version: v0.4.10 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2021 License: BSD-3-Clause Imports: 4 Imported by: 50

Documentation

Overview

Package img is a simple library to load images of various formats as SDL surfaces.

Index

Constants

View Source
const (
	INIT_JPG  = 0x00000001 // JPG
	INIT_PNG  = 0x00000002 // PNG
	INIT_TIF  = 0x00000004 // TIF
	INIT_WEBP = 0x00000008 // WebP
)

Flags which may be passed to img.Init() to load support of image formats, can be bitwise OR'd together.

Variables

This section is empty.

Functions

func GetError

func GetError() error

GetError returns the last error that occurred, or an empty string if there hasn't been an error message set since the last call to sdl.ClearError(). (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_45.html)

func Init

func Init(flags int) error

Init loads dynamic libraries and prepares them for use. Flags should be one or more flags from IMG_InitFlags OR'd together. It returns the flags successfully initialized, or 0 on failure. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_8.html)

func IsBMP

func IsBMP(src *sdl.RWops) bool

IsBMP reports whether BMP format is supported and image data is readable as a BMP. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_32.html)

func IsCUR

func IsCUR(src *sdl.RWops) bool

IsCUR reports whether CUR format is supported and image data is readable as a CUR. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_30.html)

func IsGIF

func IsGIF(src *sdl.RWops) bool

IsGIF reports whether GIF format is supported and image data is readable as a GIF. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_37.html)

func IsICO

func IsICO(src *sdl.RWops) bool

IsICO reports whether ICO format is supported and image data is readable as an ICO. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_31.html)

func IsJPG

func IsJPG(src *sdl.RWops) bool

IsJPG reports whether JPG format is supported and image data is readable as a JPG. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_38.html)

func IsLBM

func IsLBM(src *sdl.RWops) bool

IsLBM reports whether LBM format is supported and image data is readable as an LBM. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_41.html)

func IsPCX

func IsPCX(src *sdl.RWops) bool

IsPCX reports whether PCX format is supported and image data is readable as a PCX. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_36.html)

func IsPNG

func IsPNG(src *sdl.RWops) bool

IsPNG reports whether PNG format is supported and image data is readable as a PNG. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_40.html)

func IsPNM

func IsPNM(src *sdl.RWops) bool

IsPNM reports whether PNM format is supported and image data is readable as a PNM. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_33.html)

func IsTIF

func IsTIF(src *sdl.RWops) bool

IsTIF reports whether TIF format is supported and image data is readable as a TIF. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_39.html)

func IsWEBP

func IsWEBP(src *sdl.RWops) bool

IsWEBP reports whether WEBP format is supported and image data is readable as a WEBP.

func IsXCF

func IsXCF(src *sdl.RWops) bool

IsXCF reports whether XCF format is supported and image data is readable as an XCF. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_35.html)

func IsXPM

func IsXPM(src *sdl.RWops) bool

IsXPM reports whether XPM format is supported and image data is readable as an XPM. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_34.html)

func IsXV

func IsXV(src *sdl.RWops) bool

IsXV reports whether XV format is supported and image data is readable as an XV thumbnail. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_42.html)

func LinkedVersion

func LinkedVersion() *sdl.Version

LinkedVersion returns the version of the dynamically linked SDL_image library. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_7.html)

func Load

func Load(file string) (*sdl.Surface, error)

Load loads a file for use as an image in a new surface. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_11.html)

func LoadBMPRW added in v0.3.0

func LoadBMPRW(src *sdl.RWops) (*sdl.Surface, error)

LoadBMPRW loads a BMP image from an SDL data source for use as a surface. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_16.html)

func LoadCURRW added in v0.3.0

func LoadCURRW(src *sdl.RWops) (*sdl.Surface, error)

LoadCURRW loads a CUR image from an SDL data source for use as a surface. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_14.html)

func LoadGIFRW added in v0.3.0

func LoadGIFRW(src *sdl.RWops) (*sdl.Surface, error)

LoadGIFRW loads a GIF image from an SDL data source for use as a surface. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_21.html)

func LoadICORW added in v0.3.0

func LoadICORW(src *sdl.RWops) (*sdl.Surface, error)

LoadICORW loads an ICO image from an SDL data source for use as a surface. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_15.html)

func LoadJPGRW added in v0.3.0

func LoadJPGRW(src *sdl.RWops) (*sdl.Surface, error)

LoadJPGRW loads a JPG image from an SDL data source for use as a surface. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_22.html)

func LoadLBMRW added in v0.3.0

func LoadLBMRW(src *sdl.RWops) (*sdl.Surface, error)

LoadLBMRW loads an LBM image from an SDL data source for use as a surface. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_26.html)

func LoadPCXRW added in v0.3.0

func LoadPCXRW(src *sdl.RWops) (*sdl.Surface, error)

LoadPCXRW loads a PCX image from an SDL data source for use as a surface. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_20.html)

func LoadPNGRW added in v0.3.0

func LoadPNGRW(src *sdl.RWops) (*sdl.Surface, error)

LoadPNGRW loads a PNG image from an SDL data source for use as a surface. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_24.html)

func LoadPNMRW added in v0.3.0

func LoadPNMRW(src *sdl.RWops) (*sdl.Surface, error)

LoadPNMRW loads a PNM image from an SDL data source for use as a surface. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_17.html)

func LoadRW added in v0.3.0

func LoadRW(src *sdl.RWops, freesrc bool) (*sdl.Surface, error)

LoadRW loads an image from an SDL data source for use as a surface. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_12.html)

func LoadTGARW added in v0.3.0

func LoadTGARW(src *sdl.RWops) (*sdl.Surface, error)

LoadTGARW loads a TGA image from an SDL data source for use as a surface. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_25.html)

func LoadTIFRW added in v0.3.0

func LoadTIFRW(src *sdl.RWops) (*sdl.Surface, error)

LoadTIFRW loads a TIF image from an SDL data source for use as a surface. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_23.html)

func LoadTexture

func LoadTexture(renderer *sdl.Renderer, file string) (*sdl.Texture, error)

LoadTexture loads an image directly into a render texture.

func LoadTextureRW added in v0.3.0

func LoadTextureRW(renderer *sdl.Renderer, src *sdl.RWops, freesrc bool) (*sdl.Texture, error)

LoadTextureRW loads an image from an SDL data source directly into a render texture.

func LoadTypedRW added in v0.3.0

func LoadTypedRW(src *sdl.RWops, freesrc bool, type_ string) (*sdl.Surface, error)

LoadTypedRW loads an image from an SDL data source. The 'type' may be one of: "BMP", "GIF", "PNG", etc. If the image format supports a transparent pixel, SDL will set the colorkey for the surface. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_13.html)

func LoadWEBPRW added in v0.3.0

func LoadWEBPRW(src *sdl.RWops) (*sdl.Surface, error)

LoadWEBPRW loads a WEBP image from an SDL data source for use as a surface.

func LoadXCFRW added in v0.3.0

func LoadXCFRW(src *sdl.RWops) (*sdl.Surface, error)

LoadXCFRW loads an XCF image from an SDL data source for use as a surface. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_19.html)

func LoadXPMRW added in v0.3.0

func LoadXPMRW(src *sdl.RWops) (*sdl.Surface, error)

LoadXPMRW loads an XPM image from an SDL data source for use as a surface. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_18.html)

func LoadXVRW added in v0.3.0

func LoadXVRW(src *sdl.RWops) (*sdl.Surface, error)

LoadXVRW loads an XV thumbnail image from an SDL data source for use as a surface. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_27.html)

func Quit

func Quit()

Quit unloads libraries loaded with img.Init(). (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_9.html)

func ReadXPMFromArray

func ReadXPMFromArray(xpm string) (*sdl.Surface, error)

ReadXPMFromArray loads an XPM image from xpm data for use as a surface. (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_28.html)

func SavePNG

func SavePNG(surface *sdl.Surface, file string) error

SavePNG saves a surface as PNG file.

func SavePNGRW added in v0.3.0

func SavePNGRW(surface *sdl.Surface, dst *sdl.RWops, freedst int) error

SavePNGRW saves a surface to an SDL data source.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL