示例#1
0
func sample_pinp(vsw *libvsw.Vsw, mainSrc, subSrc int) {
	vsw.Cut(mainSrc)
	vsw.CutSub(0) // Erase sub screen
	// Scale quarter size, No cropping
	vsw.PinpGeometry(0, 0, 65536/4, 65536/4, 0, 0, 65536, 65536)
	vsw.PinpBorder(0x00ff00ff, 4)
	vsw.SetSubMode(libvsw.SUB_MODE_PINP)
	rate := 1000
	vsw.MixSub(rate, subSrc) // Show sub screen slowly
	time.Sleep(time.Duration(rate) * time.Millisecond)
	for {
		for i := 1; i < 4; i++ {
			time.Sleep(time.Duration(rate) * time.Millisecond)
			vsw.PinpGeometry(65536/4*i, 0, 65536/4, 65536/4, 0, 0, 65536, 65536)
		}
		for i := 1; i < 4; i++ {
			time.Sleep(time.Duration(rate) * time.Millisecond)
			vsw.PinpGeometry(65536/4*3, 65536/4*i, 65536/4, 65536/4, 0, 0, 65536, 65536)
		}
		for i := 2; i >= 0; i-- {
			time.Sleep(time.Duration(rate) * time.Millisecond)
			vsw.PinpGeometry(65536/4*i, 65536/4*3, 65536/4, 65536/4, 0, 0, 65536, 65536)
		}
		for i := 2; i >= 0; i-- {
			time.Sleep(time.Duration(rate) * time.Millisecond)
			vsw.PinpGeometry(65536/4*0, 65536/4*i, 65536/4, 65536/4, 0, 0, 65536, 65536)
		}
	}
}
示例#2
0
func sample_chromakey(vsw *libvsw.Vsw) {
	wait := 8000
	vsw.CutSub(0)
	vsw.Cut(1)

	// You have to insert a writable SD card to LiveWedge.
	vsw.UploadFile("greenback.jpg")
	vsw.SetChromaKey(libvsw.CHROMA_KEY_GREEN)
	vsw.CutSub(4)
	time.Sleep(time.Duration(wait) * time.Millisecond)
	vsw.CutSub(0)

	vsw.UploadFile("blueback.jpg")
	vsw.SetChromaKey(libvsw.CHROMA_KEY_BLUE)
	vsw.MixSub(2000, 4)
	time.Sleep(time.Duration(wait) * time.Millisecond)
	vsw.MixSub(2000, 0)

	vsw.UploadFile("purpleback.jpg")
	vsw.SetChromaKey(libvsw.CHROMA_KEY_PURPLE)
	vsw.CutSub(4)
	time.Sleep(time.Duration(wait) * time.Millisecond)
	vsw.CutSub(0)

	vsw.UploadFile("redback.jpg")
	vsw.SetChromaKey(libvsw.CHROMA_KEY_RED)
	vsw.MixSub(2000, 4)
	time.Sleep(time.Duration(wait) * time.Millisecond)
	vsw.MixSub(2000, 0)
}