예제 #1
0
파일: canvas.go 프로젝트: velour/ui
// Color returns the current drawing color.
func (c Canvas) color() color.Color {
	var r, g, b, a C.Uint8
	if C.SDL_GetRenderDrawColor(c.win.rend, &r, &g, &b, &a) < 0 {
		panic(sdlError())
	}
	return color.NRGBA{uint8(r), uint8(g), uint8(b), uint8(a)}
}
예제 #2
0
func (renderer *Renderer) GetDrawColor(r, g, b, a *uint8) int {
	_renderer := (*C.SDL_Renderer)(unsafe.Pointer(renderer))
	_r := (*C.Uint8)(unsafe.Pointer(r))
	_g := (*C.Uint8)(unsafe.Pointer(g))
	_b := (*C.Uint8)(unsafe.Pointer(b))
	_a := (*C.Uint8)(unsafe.Pointer(a))
	return (int)(C.SDL_GetRenderDrawColor(_renderer, _r, _g, _b, _a))
}
예제 #3
0
파일: render.go 프로젝트: JalfResi/go-sdl2
func (renderer *Renderer) GetDrawColor() (r, g, b, a uint8, status int) {
	_r := (*C.Uint8)(unsafe.Pointer(&r))
	_g := (*C.Uint8)(unsafe.Pointer(&g))
	_b := (*C.Uint8)(unsafe.Pointer(&b))
	_a := (*C.Uint8)(unsafe.Pointer(&a))
	status = int(C.SDL_GetRenderDrawColor(renderer.cptr(), _r, _g, _b, _a))
	return
}
예제 #4
0
파일: render.go 프로젝트: willemvds/sdl
func (r *Renderer) GetDrawColor() (red, g, b, a uint8, err error) {
	var cr, cg, cb, ca C.Uint8
	if C.SDL_GetRenderDrawColor(r.c, &cr, &cg, &cb, &ca) != 0 {
		return 0, 0, 0, 0, getError()
	}

	return uint8(cr), uint8(cg), uint8(cb), uint8(ca), nil
}
예제 #5
0
파일: render.go 프로젝트: jbondeson/Go-SDL2
func (r *Renderer) GetDrawColor() Color {
	cr := C.Uint8(0)
	cg := C.Uint8(0)
	cb := C.Uint8(0)
	ca := C.Uint8(0)
	ret := C.SDL_GetRenderDrawColor(r.cRenderer, &cr, &cg, &cb, &ca)
	if int(ret) == 0 {
		return Color{uint8(cr), uint8(cg), uint8(cb), uint8(ca)}
	}
	return Color{0, 0, 0, 0}
}
예제 #6
0
파일: render.go 프로젝트: emlai/go-sdl2
// Renderer (https://wiki.libsdl.org/SDL_GetRenderDrawColor)
func (renderer *Renderer) GetDrawColor() (r, g, b, a uint8, err error) {
	_r := (*C.Uint8)(unsafe.Pointer(&r))
	_g := (*C.Uint8)(unsafe.Pointer(&g))
	_b := (*C.Uint8)(unsafe.Pointer(&b))
	_a := (*C.Uint8)(unsafe.Pointer(&a))
	_ret := C.SDL_GetRenderDrawColor(renderer.cptr(), _r, _g, _b, _a)
	if _ret < 0 {
		err = GetError()
		return r, g, b, a, err
	}
	return r, g, b, a, nil
}