Example #1
0
File: gfx.go Project: Zwobot/Go-SDL
func (s *Surface) Zoom(zoomX, zoomY float64, smooth bool) *Surface {
	cSmooth := C.int(0)
	if smooth {
		cSmooth = C.int(1)
	}
	return wrap(C.zoomSurface(s.cSurface, C.double(zoomX), C.double(zoomY), cSmooth))
}
Example #2
0
func resize(img *C.SDL_Surface, width, height int) *C.SDL_Surface {
	if img.w == 0 || img.h == 0 {
		return nil
	}
	xstretch := C.double(float64(width) / float64(img.w))
	ystretch := C.double(float64(height) / float64(img.h))
	retval := C.zoomSurface(img, xstretch, ystretch, 1)
	C.SDL_FreeSurface(img)
	return retval
}
Example #3
0
func ZoomSurface(src *sdl.Surface, zoomx, zoomy float64, smooth int) *sdl.Surface {
	_zoomx := C.double(zoomx)
	_zoomy := C.double(zoomy)
	_smooth := C.int(smooth)
	return (*sdl.Surface)(unsafe.Pointer(C.zoomSurface(unsafe.Pointer(src), _zoomx, _zoomy, _smooth)))
}
Example #4
0
func ZoomSurface(src *sdl.Surface, zoomx, zoomy float64, smooth bool) *sdl.Surface {
	return (*sdl.Surface)(ptr(C.zoomSurface((*C.SDL_Surface)(ptr(src)), C.double(zoomx), C.double(zoomy), b2ci(smooth))))
}