コード例 #1
0
ファイル: canvas.go プロジェクト: griffy/starfish
//Draws the image at the given coordinates.
func (me *Canvas) DrawImage(img *Image, x, y int) {
	C.SDL_SetAlpha(img.img, C.SDL_SRCALPHA, 255)
	var dest C.SDL_Rect
	dest.x = C.Sint16(x + me.origin.X)
	dest.y = C.Sint16(y + me.origin.Y)
	C.SDL_BlitSurface(img.img, nil, me.pane, &dest)
}
コード例 #2
0
ファイル: sdl.go プロジェクト: kearsley/Go-SDL
// Adjusts the alpha properties of a Surface.
func (s *Surface) SetAlpha(flags uint32, alpha uint8) int {
	s.mutex.Lock()
	status := int(C.SDL_SetAlpha(s.cSurface, C.Uint32(flags), C.Uint8(alpha)))
	s.mutex.Unlock()
	return status
}
コード例 #3
0
ファイル: sdl.go プロジェクト: gnanderson/Go-SDL
// Adjusts the alpha properties of a Surface.
func (s *Surface) SetAlpha(flags uint32, alpha uint8) int {
	return int(C.SDL_SetAlpha((*C.SDL_Surface)(cast(s)), C.Uint32(flags), C.Uint8(alpha)))
}
コード例 #4
0
ファイル: video.go プロジェクト: beoran/fungo
// This function sets the alpha value for the entire surface, as opposed to
// using the alpha component of each pixel. This value measures the range
// of transparency of the surface, 0 being completely transparent to 255
// being completely opaque. An 'alpha' value of 255 causes blits to be
// opaque, the source pixels copied to the destination (the default). Note
// that per-surface alpha can be combined with colorkey transparency.
//
// If 'flag' is 0, alpha blending is disabled for the surface.
// If 'flag' is SDL_SRCALPHA, alpha blending is enabled for the surface.
// OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the
// surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed.
//
// The 'alpha' parameter is ignored for surfaces that have an alpha channel.
func setAlpha(surface *C.SDL_Surface, flag uint32, alpha uint8) int {
	return int(C.SDL_SetAlpha(surface, C.Uint32(flag), C.Uint8(alpha)))
}