Per ottenere un effetto caleidoscopico di un'immagine di formato PNG con le risorse del Componente
gb.media, bisogna utilizzare l'elemento "kaleidoscope" della libreria di
GStreamer.
Semplicissimo esempio pratico:
Private tb As ToggleButton
Private dr As DrawingArea
Private imm As String
Private pl As MediaPipeline
Public Sub _new()
Dim w As Integer
Dim h As Integer
imm = "/percorso/del/file/immagine.png"
w = ImageStat(imm).Width
h = ImageStat(imm).Height
With Me
.W = w + 200
.H = w + 100
End With
With tb = New ToggleButton(Me) As "Tasto"
.X = Me.w - 30
.Y = 10
.W = 30
.H = 40
.Text = "Start"
End With
With dr = New DrawingArea(Me)
.X = 0
.Y = 0
.W = w
.H = h
End With
End
Public Sub Form_Open()
Dim src, pdc, kal, con1, frz, con2, snk As MediaControl
pl = New MediaPipeline
src = New MediaControl(pl, "filesrc")
src["location"] = imm
pdc = New MediaControl(pl, "pngdec")
kal = New MediaControl(pl, "kaleidoscope")
kal["angle"] = Rad(45)
kal["angle2"] = Rad(140)
kal["sides"] = 10
con1 = New MediaControl(pl, "videoconvert")
frz = New MediaControl(pl, "imagefreeze")
con2 = New MediaControl(pl, "videoconvert")
snk = New MediaControl(pl, "xvimagesink")
src.LinkTo(pdc)
pdc.LinkTo(kal)
kal.LinkTo(con1)
con1.LinkTo(frz)
frz.LinkTo(con2)
con2.LinkTo(snk)
snk.SetWindow(dr)
End
Public Sub Tasto_Click() ' _
If tb.Value Then
pl.Play()
tb.Text = "Stop"
Else
pl.Stop()
pl.Close()
Me.Close
Endif
End