예제 #1
0
파일: render.go 프로젝트: emlai/go-sdl2
// Texture (https://wiki.libsdl.org/SDL_SetTextureBlendMode)
func (texture *Texture) SetBlendMode(bm BlendMode) error {
	_ret := C.SDL_SetTextureBlendMode(texture.cptr(), bm.c())
	if _ret < 0 {
		return GetError()
	}
	return nil
}
예제 #2
0
파일: render.go 프로젝트: willemvds/sdl
func (t *Texture) SetBlendMode(mode BlendMode) error {
	if C.SDL_SetTextureBlendMode(t.c, mode.c()) != 0 {
		return getError()
	}

	return nil
}
예제 #3
0
파일: canvas.go 프로젝트: velour/ui
func texFromImage(rend *C.SDL_Renderer, img *image.NRGBA) *C.SDL_Texture {
	b := img.Bounds()
	w, h := b.Dx(), b.Dy()
	fmt := C.SDL_PIXELFORMAT_ABGR8888
	acc := C.SDL_TEXTUREACCESS_STATIC
	tex := C.SDL_CreateTexture(rend, C.Uint32(fmt), C.int(acc), C.int(w), C.int(h))
	if tex == nil {
		panic(sdlError())
	}
	if C.SDL_UpdateTexture(tex, nil, unsafe.Pointer(&img.Pix[0]), C.int(img.Stride)) < 0 {
		panic(sdlError())
	}
	if C.SDL_SetTextureBlendMode(tex, C.SDL_BLENDMODE_BLEND) < 0 {
		panic(sdlError())
	}
	return tex
}
예제 #4
0
func (t *Texture) SetBlendMode(_blendmode int) {
	C.SDL_SetTextureBlendMode(t.Get(), C.SDL_BlendMode(_blendmode))
}
예제 #5
0
파일: render.go 프로젝트: jbondeson/Go-SDL2
func (t *Texture) SetBlendMode(blendmode int) bool {
	ret := C.SDL_SetTextureBlendMode(t.cTexture, C.SDL_BlendMode(blendmode))
	return int(ret) == 0
}
예제 #6
0
func (texture *Texture) SetBlendMode(blendMode uint32) int {
	_texture := (*C.SDL_Texture)(unsafe.Pointer(texture))
	_blendMode := (C.SDL_BlendMode)(C.Uint32(blendMode))
	return (int)(C.SDL_SetTextureBlendMode(_texture, _blendMode))
}
예제 #7
0
파일: render.go 프로젝트: JalfResi/go-sdl2
func (texture *Texture) SetBlendMode(bm BlendMode) int {
	return int(C.SDL_SetTextureBlendMode(texture.cptr(), bm.c()))
}