mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 07:06:58 +08:00
improve examples (#708)
This commit is contained in:
31
examples/client-record-format-h265/dummy_image.go
Normal file
31
examples/client-record-format-h265/dummy_image.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"image"
|
||||
"image/color"
|
||||
)
|
||||
|
||||
var dummyImageCount = 0
|
||||
|
||||
func createDummyImage() *image.RGBA {
|
||||
img := image.NewRGBA(image.Rect(0, 0, 640, 480))
|
||||
|
||||
var cl color.RGBA
|
||||
switch dummyImageCount {
|
||||
case 0:
|
||||
cl = color.RGBA{255, 0, 0, 0}
|
||||
case 1:
|
||||
cl = color.RGBA{0, 255, 0, 0}
|
||||
case 2:
|
||||
cl = color.RGBA{0, 0, 255, 0}
|
||||
}
|
||||
dummyImageCount = (dummyImageCount + 1) % 3
|
||||
|
||||
for y := 0; y < img.Rect.Dy(); y++ {
|
||||
for x := 0; x < img.Rect.Dx(); x++ {
|
||||
img.SetRGBA(x, y, cl)
|
||||
}
|
||||
}
|
||||
|
||||
return img
|
||||
}
|
Reference in New Issue
Block a user