Exemplo n.º 1
0
func TextureFromImageWhole(img Image) (Texture, error) {
	tex := C.sfTexture_createFromImage(img.Cref, nil)
	if tex == nil {
		return Texture{nil}, errors.New("Couldn't create texture from image")
	}
	return Texture{tex}, nil
}
Exemplo n.º 2
0
// \brief Create a new texture from an image
// \param image Image to upload to the texture
// \param area  Area of the source image to load (NULL to load the entire image)
// \return A new sfTexture object, or NULL if it failed
// sfTexture* sfTexture_createFromImage(const sfImage* image, const sfIntRect* area);
func TextureFromImageRect(img Image, area IntRect) (Texture, error) {
	tex := C.sfTexture_createFromImage(img.Cref, area.Cref)
	if tex == nil {
		return Texture{nil}, errors.New("Couldn't create texture from image")
	}
	return Texture{tex}, nil
}